mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
chore: move clearCookie to finally
This commit is contained in:
@@ -75,8 +75,6 @@ export class OAuthController {
|
|||||||
): Promise<LoginResponseDto> {
|
): Promise<LoginResponseDto> {
|
||||||
try {
|
try {
|
||||||
const body = await this.service.callback(dto, request.headers, loginDetails);
|
const body = await this.service.callback(dto, request.headers, loginDetails);
|
||||||
res.clearCookie(ImmichCookie.OAuthState);
|
|
||||||
res.clearCookie(ImmichCookie.OAuthCodeVerifier);
|
|
||||||
return respondWithCookie(res, body, {
|
return respondWithCookie(res, body, {
|
||||||
isSecure: loginDetails.isSecure,
|
isSecure: loginDetails.isSecure,
|
||||||
values: [
|
values: [
|
||||||
@@ -87,14 +85,15 @@ export class OAuthController {
|
|||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof OAuthLinkRequiredException) {
|
if (error instanceof OAuthLinkRequiredException) {
|
||||||
res.clearCookie(ImmichCookie.OAuthState);
|
|
||||||
res.clearCookie(ImmichCookie.OAuthCodeVerifier);
|
|
||||||
respondWithCookie(res, null, {
|
respondWithCookie(res, null, {
|
||||||
isSecure: loginDetails.isSecure,
|
isSecure: loginDetails.isSecure,
|
||||||
values: [{ key: ImmichCookie.OAuthLinkToken, value: error.oauthLinkToken }],
|
values: [{ key: ImmichCookie.OAuthLinkToken, value: error.oauthLinkToken }],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
|
} finally {
|
||||||
|
res.clearCookie(ImmichCookie.OAuthState);
|
||||||
|
res.clearCookie(ImmichCookie.OAuthCodeVerifier);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user