diff options
author | Joram Wilander <jwawilander@gmail.com> | 2017-01-06 09:00:21 -0500 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2017-01-06 09:00:21 -0500 |
commit | 38f89cb1441376da77b35b08158db9405aad738b (patch) | |
tree | a7958225dfd50bc5ac9eb7edeeb4ba3ecb427ca0 /webapp/routes/route_root.jsx | |
parent | ff127bbaa343026a55429acf37f2c95186d07ac5 (diff) | |
download | chat-38f89cb1441376da77b35b08158db9405aad738b.tar.gz chat-38f89cb1441376da77b35b08158db9405aad738b.tar.bz2 chat-38f89cb1441376da77b35b08158db9405aad738b.zip |
Fix MFA enforcement redirect loop (#4991)
Diffstat (limited to 'webapp/routes/route_root.jsx')
-rw-r--r-- | webapp/routes/route_root.jsx | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/webapp/routes/route_root.jsx b/webapp/routes/route_root.jsx index f72e35302..cd0cb9a5d 100644 --- a/webapp/routes/route_root.jsx +++ b/webapp/routes/route_root.jsx @@ -13,7 +13,6 @@ import helpRoute from 'routes/route_help.jsx'; import BrowserStore from 'stores/browser_store.jsx'; import ErrorStore from 'stores/error_store.jsx'; -import UserStore from 'stores/user_store.jsx'; import * as UserAgent from 'utils/user_agent.jsx'; import {browserHistory} from 'react-router/es6'; @@ -31,28 +30,10 @@ function preLogin(nextState, replace, callback) { callback(); } -const mfaPaths = [ - '/mfa/setup', - '/mfa/confirm' -]; - -const mfaAuthServices = [ - '', - 'email', - 'ldap' -]; - function preLoggedIn(nextState, replace, callback) { - if (window.mm_license.MFA === 'true' && - window.mm_config.EnableMultifactorAuthentication === 'true' && - window.mm_config.EnforceMultifactorAuthentication === 'true' && - mfaPaths.indexOf(nextState.location.pathname) === -1) { - const user = UserStore.getCurrentUser(); - if (user && !user.mfa_active && - mfaAuthServices.indexOf(user.auth_service) !== -1) { - browserHistory.push('/mfa/setup'); - return; - } + if (RouteUtils.checkIfMFARequired(nextState)) { + browserHistory.push('/mfa/setup'); + return; } ErrorStore.clearLastError(); |