diff options
Diffstat (limited to 'webapp/actions')
-rw-r--r-- | webapp/actions/user_actions.jsx | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/webapp/actions/user_actions.jsx b/webapp/actions/user_actions.jsx index 6f19e9ace..812bc2716 100644 --- a/webapp/actions/user_actions.jsx +++ b/webapp/actions/user_actions.jsx @@ -16,10 +16,11 @@ import Client from 'client/web_client.jsx'; import {ActionTypes, Preferences} from 'utils/constants.jsx'; -export function switchFromLdapToEmail(email, password, ldapPassword, onSuccess, onError) { +export function switchFromLdapToEmail(email, password, token, ldapPassword, onSuccess, onError) { Client.ldapToEmail( email, password, + token, ldapPassword, (data) => { if (data.follow_link) { @@ -391,3 +392,43 @@ export function updateUserRoles(userId, newRoles, success, error) { } ); } + +export function activateMfa(code, success, error) { + Client.updateMfa( + code, + true, + () => { + AsyncClient.getMe(); + + if (success) { + success(); + } + }, + (err) => { + if (error) { + error(err); + } + } + ); +} + +export function checkMfa(loginId, success, error) { + if (global.window.mm_config.EnableMultifactorAuthentication !== 'true') { + success(false); + return; + } + + Client.checkMfa( + loginId, + (data) => { + if (success) { + success(data.mfa_required === 'true'); + } + }, + (err) => { + if (error) { + error(err); + } + } + ); +} |