1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-11 05:43:41 +00:00

feat(newDeviceVerification) : add handling for requires new device verification auth response (#13568)

This commit is contained in:
Ike
2025-02-25 14:29:25 -05:00
committed by GitHub
parent e0a3a05c49
commit e9f23cd4c3

View File

@@ -311,6 +311,26 @@ export class LoginCommand {
);
}
// Opting for not checking feature flag since the server will not respond with
// requiresDeviceVerification if the feature flag is not enabled.
if (response.requiresDeviceVerification) {
let newDeviceToken: string = null;
if (this.canInteract) {
const answer: inquirer.Answers = await inquirer.createPromptModule({
output: process.stderr,
})({
type: "input",
name: "token",
message: "New device login code:",
});
newDeviceToken = answer.token;
}
if (newDeviceToken == null || newDeviceToken === "") {
return Response.badRequest("Code is required.");
}
response = await this.loginStrategyService.logInNewDeviceVerification(newDeviceToken);
}
if (response.captchaSiteKey) {
const twoFactorRequest = new TokenTwoFactorRequest(selectedProvider.type, twoFactorToken);
const handledResponse = await this.handleCaptchaRequired(twoFactorRequest);