mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 00:33:44 +00:00
fix(recovery-code-login): [PM-15534] Fix for Recovery Code Login - Fixed the recovery code login flow. (#13488)
This commit is contained in:
committed by
GitHub
parent
1fdb88da63
commit
4a344582a9
@@ -89,29 +89,16 @@ export class RecoverTwoFactorComponent implements OnInit {
|
|||||||
const key = await this.loginStrategyService.makePreloginKey(this.masterPassword, request.email);
|
const key = await this.loginStrategyService.makePreloginKey(this.masterPassword, request.email);
|
||||||
request.masterPasswordHash = await this.keyService.hashMasterKey(this.masterPassword, key);
|
request.masterPasswordHash = await this.keyService.hashMasterKey(this.masterPassword, key);
|
||||||
|
|
||||||
try {
|
if (this.recoveryCodeLoginFeatureFlagEnabled) {
|
||||||
|
await this.handleRecoveryLogin(request);
|
||||||
|
} else {
|
||||||
await this.apiService.postTwoFactorRecover(request);
|
await this.apiService.postTwoFactorRecover(request);
|
||||||
|
|
||||||
this.toastService.showToast({
|
this.toastService.showToast({
|
||||||
variant: "success",
|
variant: "success",
|
||||||
title: "",
|
title: "",
|
||||||
message: this.i18nService.t("twoStepRecoverDisabled"),
|
message: this.i18nService.t("twoStepRecoverDisabled"),
|
||||||
});
|
});
|
||||||
|
await this.router.navigate(["/"]);
|
||||||
if (!this.recoveryCodeLoginFeatureFlagEnabled) {
|
|
||||||
await this.router.navigate(["/"]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle login after recovery if the feature flag is enabled
|
|
||||||
await this.handleRecoveryLogin(request);
|
|
||||||
} catch (e) {
|
|
||||||
const errorMessage = this.extractErrorMessage(e);
|
|
||||||
this.toastService.showToast({
|
|
||||||
variant: "error",
|
|
||||||
title: this.i18nService.t("error"),
|
|
||||||
message: errorMessage,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -140,6 +127,12 @@ export class RecoverTwoFactorComponent implements OnInit {
|
|||||||
title: "",
|
title: "",
|
||||||
message: this.i18nService.t("youHaveBeenLoggedIn"),
|
message: this.i18nService.t("youHaveBeenLoggedIn"),
|
||||||
});
|
});
|
||||||
|
this.toastService.showToast({
|
||||||
|
variant: "success",
|
||||||
|
title: "",
|
||||||
|
message: this.i18nService.t("twoStepRecoverDisabled"),
|
||||||
|
});
|
||||||
|
|
||||||
await this.loginSuccessHandlerService.run(authResult.userId);
|
await this.loginSuccessHandlerService.run(authResult.userId);
|
||||||
await this.router.navigate(["/settings/security/two-factor"]);
|
await this.router.navigate(["/settings/security/two-factor"]);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user