Move instances of Client.resetPassword() in components to an action (#5167)
Этот коммит содержится в:
коммит произвёл
George Goldberg
родитель
1e5354cff3
Коммит
b87cd4e276
@@ -12,11 +12,14 @@ import {getChannelMembersForUserIds} from 'actions/channel_actions.jsx';
|
|||||||
import {loadStatusesForProfilesList, loadStatusesForProfilesMap} from 'actions/status_actions.jsx';
|
import {loadStatusesForProfilesList, loadStatusesForProfilesMap} from 'actions/status_actions.jsx';
|
||||||
|
|
||||||
import {getDirectChannelName} from 'utils/utils.jsx';
|
import {getDirectChannelName} from 'utils/utils.jsx';
|
||||||
|
|
||||||
import * as AsyncClient from 'utils/async_client.jsx';
|
import * as AsyncClient from 'utils/async_client.jsx';
|
||||||
import Client from 'client/web_client.jsx';
|
import Client from 'client/web_client.jsx';
|
||||||
|
|
||||||
import {ActionTypes, Preferences} from 'utils/constants.jsx';
|
import {ActionTypes, Preferences} from 'utils/constants.jsx';
|
||||||
|
|
||||||
|
import {browserHistory} from 'react-router/es6';
|
||||||
|
|
||||||
export function switchFromLdapToEmail(email, password, token, ldapPassword, onSuccess, onError) {
|
export function switchFromLdapToEmail(email, password, token, ldapPassword, onSuccess, onError) {
|
||||||
Client.ldapToEmail(
|
Client.ldapToEmail(
|
||||||
email,
|
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.
|
// See License.txt for license information.
|
||||||
|
|
||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
import Client from 'client/web_client.jsx';
|
|
||||||
import * as Utils from 'utils/utils.jsx';
|
import * as Utils from 'utils/utils.jsx';
|
||||||
import Constants from 'utils/constants.jsx';
|
import Constants from 'utils/constants.jsx';
|
||||||
|
|
||||||
import {FormattedMessage} from 'react-intl';
|
import {FormattedMessage} from 'react-intl';
|
||||||
import {browserHistory} from 'react-router/es6';
|
|
||||||
|
import {resetPassword} from 'actions/user_actions.jsx';
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
@@ -42,12 +42,11 @@ class PasswordResetForm extends React.Component {
|
|||||||
error: null
|
error: null
|
||||||
});
|
});
|
||||||
|
|
||||||
Client.resetPassword(
|
resetPassword(
|
||||||
this.props.location.query.code,
|
this.props.location.query.code,
|
||||||
password,
|
password,
|
||||||
() => {
|
() => {
|
||||||
this.setState({error: null});
|
this.setState({error: null});
|
||||||
browserHistory.push('/login?extra=' + Constants.PASSWORD_CHANGE);
|
|
||||||
},
|
},
|
||||||
(err) => {
|
(err) => {
|
||||||
this.setState({error: err.message});
|
this.setState({error: err.message});
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user