1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-09 05:00:10 +00:00

handle both unauthed and authed flows

This commit is contained in:
rr-bw
2025-08-20 16:40:16 -07:00
parent 17ccb2063e
commit 9814e0e579
4 changed files with 29 additions and 12 deletions

View File

@@ -3657,6 +3657,9 @@
"thisRequestIsNoLongerValid": {
"message": "This request is no longer valid."
},
"thatRequestIsNoLongerValidStartingNewRequest": {
"message": "That request is no longer valid. Starting a new request."
},
"loginRequestHasAlreadyExpired": {
"message": "Login request has already expired."
},

View File

@@ -3113,6 +3113,9 @@
"thisRequestIsNoLongerValid": {
"message": "This request is no longer valid."
},
"thatRequestIsNoLongerValidStartingNewRequest": {
"message": "That request is no longer valid. Starting a new request."
},
"confirmAccessAttempt": {
"message": "Confirm access attempt for $EMAIL$",
"placeholders": {

View File

@@ -3978,6 +3978,9 @@
"thisRequestIsNoLongerValid": {
"message": "This request is no longer valid."
},
"thatRequestIsNoLongerValidStartingNewRequest": {
"message": "That request is no longer valid. Starting a new request."
},
"loginRequestApprovedForEmailOnDevice": {
"message": "Login request approved for $EMAIL$ on $DEVICE$",
"placeholders": {

View File

@@ -562,13 +562,7 @@ export class LoginViaAuthRequestComponent implements OnInit, OnDestroy {
);
}
} catch (error) {
// If the request no longer exists, we treat it as if it's been answered (and denied).
if (error instanceof ErrorResponse && error.statusCode === HttpStatusCode.NotFound) {
authRequestResponse = undefined;
this.logService.error("Auth request response not generated");
} else {
this.logService.error(error);
}
this.logService.error(error);
this.loading = false;
}
@@ -589,6 +583,10 @@ export class LoginViaAuthRequestComponent implements OnInit, OnDestroy {
// Request doesn't exist anymore, so we'll clear the cache and start a new request.
if (!authRequestResponse) {
this.toastService.showToast({
variant: "info",
message: this.i18nService.t("thatRequestIsNoLongerValidStartingNewRequest"),
});
return await this.clearExistingStandardAuthRequestAndStartNewRequest();
}
@@ -639,11 +637,21 @@ export class LoginViaAuthRequestComponent implements OnInit, OnDestroy {
return;
}
await this.decryptViaApprovedAuthRequest(
authRequestResponse,
this.authRequestKeyPair.privateKey,
userId,
);
try {
await this.decryptViaApprovedAuthRequest(
authRequestResponse,
this.authRequestKeyPair.privateKey,
userId,
);
} catch (error) {
this.logService.error(error);
this.toastService.showToast({
variant: "info",
message: this.i18nService.t("thatRequestIsNoLongerValidStartingNewRequest"),
});
await this.clearExistingStandardAuthRequestAndStartNewRequest();
this.loading = false;
}
}
private async handleUnauthenticatedFlows(