summaryrefslogtreecommitdiffstats
path: root/webapp/components/login
diff options
context:
space:
mode:
authorCarlos Tadeu Panato Junior <ctadeu@gmail.com>2017-01-27 11:39:13 +0100
committerGeorge Goldberg <george@gberg.me>2017-01-27 10:39:13 +0000
commitd72547433af3ec5829ce0de4f4e1cfd440be7142 (patch)
tree6bd7664e9058468842c7b7bb7c7a76abf1b7c5e3 /webapp/components/login
parent49c677f6b46409289210abc0e0bda63735be3e9f (diff)
downloadchat-d72547433af3ec5829ce0de4f4e1cfd440be7142.tar.gz
chat-d72547433af3ec5829ce0de4f4e1cfd440be7142.tar.bz2
chat-d72547433af3ec5829ce0de4f4e1cfd440be7142.zip
Move remaining client functions in components to actions (#5171)
Diffstat (limited to 'webapp/components/login')
-rw-r--r--webapp/components/login/login_controller.jsx31
1 files changed, 14 insertions, 17 deletions
diff --git a/webapp/components/login/login_controller.jsx b/webapp/components/login/login_controller.jsx
index 3064371c3..535cdfd12 100644
--- a/webapp/components/login/login_controller.jsx
+++ b/webapp/components/login/login_controller.jsx
@@ -7,6 +7,7 @@ import FormError from 'components/form_error.jsx';
import * as GlobalActions from 'actions/global_actions.jsx';
import {addUserToTeamFromInvite} from 'actions/team_actions.jsx';
+import {checkMfa, webLogin} from 'actions/user_actions.jsx';
import BrowserStore from 'stores/browser_store.jsx';
import UserStore from 'stores/user_store.jsx';
@@ -119,29 +120,25 @@ export default class LoginController extends React.Component {
return;
}
- if (global.window.mm_config.EnableMultifactorAuthentication === 'true') {
- Client.checkMfa(
- loginId,
- (data) => {
- if (data.mfa_required === 'true') {
- this.setState({showMfa: true});
- } else {
- this.submit(loginId, password, '');
- }
- },
- (err) => {
- this.setState({serverError: err.message});
+ checkMfa(
+ loginId,
+ (data) => {
+ if (data && data.mfa_required === 'true') {
+ this.setState({showMfa: true});
+ } else {
+ this.submit(loginId, password, '');
}
- );
- } else {
- this.submit(loginId, password, '');
- }
+ },
+ (err) => {
+ this.setState({serverError: err.message});
+ }
+ );
}
submit(loginId, password, token) {
this.setState({serverError: null, loading: true});
- Client.webLogin(
+ webLogin(
loginId,
password,
token,