mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Move instances of Client.resetPassword() in components to an action (#5167)
This commit is contained in:
committed by
George Goldberg
parent
1e5354cff3
commit
b87cd4e276
@@ -12,11 +12,14 @@ import {getChannelMembersForUserIds} from 'actions/channel_actions.jsx';
|
||||
import {loadStatusesForProfilesList, loadStatusesForProfilesMap} from 'actions/status_actions.jsx';
|
||||
|
||||
import {getDirectChannelName} from 'utils/utils.jsx';
|
||||
|
||||
import * as AsyncClient from 'utils/async_client.jsx';
|
||||
import Client from 'client/web_client.jsx';
|
||||
|
||||
import {ActionTypes, Preferences} from 'utils/constants.jsx';
|
||||
|
||||
import {browserHistory} from 'react-router/es6';
|
||||
|
||||
export function switchFromLdapToEmail(email, password, token, ldapPassword, onSuccess, onError) {
|
||||
Client.ldapToEmail(
|
||||
email,
|
||||
@@ -578,3 +581,22 @@ export function verifyEmail(uid, hid, success, error) {
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export function resetPassword(code, password, success, error) {
|
||||
Client.resetPassword(
|
||||
code,
|
||||
password,
|
||||
() => {
|
||||
browserHistory.push('/login?extra=' + ActionTypes.PASSWORD_CHANGE);
|
||||
|
||||
if (success) {
|
||||
success();
|
||||
}
|
||||
},
|
||||
(err) => {
|
||||
if (error) {
|
||||
error(err);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
// See License.txt for license information.
|
||||
|
||||
import ReactDOM from 'react-dom';
|
||||
import Client from 'client/web_client.jsx';
|
||||
import * as Utils from 'utils/utils.jsx';
|
||||
import Constants from 'utils/constants.jsx';
|
||||
|
||||
import {FormattedMessage} from 'react-intl';
|
||||
import {browserHistory} from 'react-router/es6';
|
||||
|
||||
import {resetPassword} from 'actions/user_actions.jsx';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
@@ -42,12 +42,11 @@ class PasswordResetForm extends React.Component {
|
||||
error: null
|
||||
});
|
||||
|
||||
Client.resetPassword(
|
||||
resetPassword(
|
||||
this.props.location.query.code,
|
||||
password,
|
||||
() => {
|
||||
this.setState({error: null});
|
||||
browserHistory.push('/login?extra=' + Constants.PASSWORD_CHANGE);
|
||||
},
|
||||
(err) => {
|
||||
this.setState({error: err.message});
|
||||
|
||||
Reference in New Issue
Block a user