[FIX] 2FA and LDAP (#488)

This commit is contained in:
Diego Mello 2018-10-16 17:27:37 -03:00 committed by GitHub
parent 2607c64437
commit 7dfd57b20c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 20 deletions

View File

@ -168,7 +168,7 @@ const RocketChat = {
} }
this.ddp = ddp; this.ddp = ddp;
if (login) { if (login) {
SDK.driver.ddp.login({ resume: login.resume }); SDK.driver.login({ resume: login.resume });
} }
}); });
@ -443,39 +443,30 @@ const RocketChat = {
}, },
async loginWithPassword({ username, password, code }) { async loginWithPassword({ username, password, code }) {
let params = {}; let params = { username, password };
const state = reduxStore.getState(); const state = reduxStore.getState();
if (state.settings.LDAP_Enable) { if (state.settings.LDAP_Enable) {
params = { params = {
...params,
ldap: true, ldap: true,
username,
ldapPass: password,
ldapOptions: {} ldapOptions: {}
}; };
} else if (state.settings.CROWD_Enable) { } else if (state.settings.CROWD_Enable) {
params = { params = {
crowd: true, ...params,
username, crowd: true
crowdPassword: password
}; };
} else { } else if (typeof username === 'string' && username.indexOf('@') !== -1) {
params = {
username, password
};
if (typeof username === 'string' && username.indexOf('@') !== -1) {
params.email = username; params.email = username;
delete params.username; delete params.username;
} }
}
if (code) { if (code) {
params = { params = {
totp: { ...params,
login: params, code,
code totp: true
}
}; };
} }