[CHORE] Force normalized params for 2FA (#2683)
Co-authored-by: Diego Mello <diegolmello@gmail.com>
This commit is contained in:
parent
7b4be8bddf
commit
3bc8161bc8
|
@ -462,6 +462,15 @@ const RocketChat = {
|
|||
try {
|
||||
reduxStore.dispatch(setUser({ username: params.user || params.username }));
|
||||
const code = await twoFactor({ method: details?.method || 'totp', invalid: e.data.error === 'totp-invalid' });
|
||||
|
||||
// Force normalized params for 2FA starting RC 3.9.0.
|
||||
const serverVersion = reduxStore.getState().server.version;
|
||||
if (serverVersion && semver.gte(semver.coerce(serverVersion), '3.9.0')) {
|
||||
const user = params.user ?? params.username;
|
||||
const password = params.password ?? params.ldapPass ?? params.crowdPassword;
|
||||
params = { user, password };
|
||||
}
|
||||
|
||||
return resolve(this.loginTOTP({ ...params, code: code?.twoFactorCode }, loginEmailPassword));
|
||||
} catch {
|
||||
// twoFactor was canceled
|
||||
|
|
Loading…
Reference in New Issue