mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-12 09:54:00 +00:00
let them reauthenticate with a bad session
This commit is contained in:
@@ -170,7 +170,22 @@ export async function GET(request: NextRequest) {
|
||||
|
||||
const isValid = await isSessionValid(selectedSession);
|
||||
|
||||
if (isValid) {
|
||||
if (!isValid && selectedSession.factors?.user) {
|
||||
// if the session is not valid anymore, we need to redirect the user to re-authenticate
|
||||
const command: SendLoginnameCommand = {
|
||||
loginName: selectedSession.factors.user?.loginName,
|
||||
organization: selectedSession.factors?.user?.organizationId,
|
||||
authRequestId: authRequestId,
|
||||
};
|
||||
|
||||
const res = await sendLoginname(command);
|
||||
|
||||
if (res?.redirect) {
|
||||
const absoluteUrl = new URL(res.redirect, request.url);
|
||||
return NextResponse.redirect(absoluteUrl.toString());
|
||||
}
|
||||
}
|
||||
|
||||
const cookie = sessionCookies.find(
|
||||
(cookie) => cookie.id === selectedSession?.id,
|
||||
);
|
||||
@@ -239,7 +254,6 @@ export async function GET(request: NextRequest) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (authRequestId) {
|
||||
const { authRequest } = await getAuthRequest({ authRequestId });
|
||||
|
||||
Reference in New Issue
Block a user