mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-12 15:03:52 +00:00
login hint
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import { getAllSessions } from "@/lib/cookies";
|
import { getAllSessions } from "@/lib/cookies";
|
||||||
import { idpTypeToSlug } from "@/lib/idp";
|
import { idpTypeToSlug } from "@/lib/idp";
|
||||||
|
import { sendLoginname } from "@/lib/server/loginname";
|
||||||
import {
|
import {
|
||||||
createCallback,
|
createCallback,
|
||||||
getActiveIdentityProviders,
|
getActiveIdentityProviders,
|
||||||
@@ -241,14 +242,19 @@ export async function GET(request: NextRequest) {
|
|||||||
if (authRequest.prompt.includes(Prompt.SELECT_ACCOUNT)) {
|
if (authRequest.prompt.includes(Prompt.SELECT_ACCOUNT)) {
|
||||||
return gotoAccounts();
|
return gotoAccounts();
|
||||||
} else if (authRequest.prompt.includes(Prompt.LOGIN)) {
|
} else if (authRequest.prompt.includes(Prompt.LOGIN)) {
|
||||||
// if prompt is login
|
// if a hint is provided, skip loginname page and jump to the next page
|
||||||
|
if (authRequest.loginHint) {
|
||||||
|
return sendLoginname({
|
||||||
|
loginName: authRequest.loginHint,
|
||||||
|
organization,
|
||||||
|
authRequestId: authRequest.id,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const loginNameUrl = new URL("/loginname", request.url);
|
const loginNameUrl = new URL("/loginname", request.url);
|
||||||
if (authRequest?.id) {
|
if (authRequest?.id) {
|
||||||
loginNameUrl.searchParams.set("authRequestId", authRequest?.id);
|
loginNameUrl.searchParams.set("authRequestId", authRequest?.id);
|
||||||
}
|
}
|
||||||
if (authRequest.loginHint) {
|
|
||||||
loginNameUrl.searchParams.set("loginName", authRequest.loginHint);
|
|
||||||
}
|
|
||||||
if (organization) {
|
if (organization) {
|
||||||
loginNameUrl.searchParams.set("organization", organization);
|
loginNameUrl.searchParams.set("organization", organization);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user