Web: Common: added login with tfa code method, fixed url

This commit is contained in:
Viktor Fomin 2021-05-17 16:33:01 +03:00
parent f5998b650a
commit fadd46112c

View File

@ -160,20 +160,29 @@ class AuthStore {
throw "Empty API response";
if (response.tfa && response.confirmUrl) {
document.location.href = response.confirmUrl;
return Promise.resolve(true);
const url = response.confirmUrl.replace(window.location.origin, "");
return Promise.resolve({ url, user, hash });
}
setWithCredentialsStatus(true);
await this.init();
return Promise.resolve(true);
return Promise.resolve({ url: this.settingsStore.defaultPage });
} catch (e) {
return Promise.reject(e);
}
};
loginWithCode = async (userName, passwordHash, code) => {
await this.tfaStore.loginWithCode(userName, passwordHash, code);
setWithCredentialsStatus(true);
await this.init();
return Promise.resolve(this.settingsStore.defaultPage);
};
thirdPartyLogin = async (SerializedProfile) => {
try {
const response = await api.user.thirdPartyLogin(SerializedProfile);