This commit is contained in:
Max Peintner
2023-07-04 10:37:54 +02:00
parent 39973baddb
commit 22841e56f0
3 changed files with 11 additions and 3 deletions

View File

@@ -11,6 +11,7 @@ export default async function Page({
const loginSettings = await getLoginSettings(server); const loginSettings = await getLoginSettings(server);
console.log("loginSettings", loginSettings);
return ( return (
<div className="flex flex-col items-center space-y-4"> <div className="flex flex-col items-center space-y-4">
<h1>Welcome back!</h1> <h1>Welcome back!</h1>

View File

@@ -24,7 +24,8 @@ describe("/passkey/login", () => {
sequence: 859, sequence: 859,
factors: { factors: {
user: { user: {
loginName: "johndoe@zitadel.com", id: "123",
loginName: "zitadel-admin@zitadel.localhost",
}, },
password: undefined, password: undefined,
passkey: undefined, passkey: undefined,
@@ -47,10 +48,12 @@ describe("/passkey/login", () => {
} }
); );
cy.visit("/loginname?loginName=johndoe%40zitadel.com&submit=true"); cy.visit(
"/loginname?loginName=zitadel-admin%40zitadel.localhost&submit=true"
);
cy.location("pathname", { timeout: 10_000 }).should( cy.location("pathname", { timeout: 10_000 }).should(
"eq", "eq",
"/password?loginName=johndoe%40zitadel.com" "/password?loginName=zitadel-admin%40zitadel.localhost&promptPasswordless=true"
); );
}); });
it("should redirect a user with passwordless authentication to /passkey/login", () => { it("should redirect a user with passwordless authentication to /passkey/login", () => {
@@ -76,6 +79,7 @@ describe("/passkey/login", () => {
sequence: 859, sequence: 859,
factors: { factors: {
user: { user: {
id: "123",
loginName: "johndoe@zitadel.com", loginName: "johndoe@zitadel.com",
}, },
password: undefined, password: undefined,

View File

@@ -21,12 +21,15 @@ export async function createSessionAndUpdateCookie(
challenges challenges
); );
console.log("createSession", createdSession);
if (createdSession) { if (createdSession) {
return getSession( return getSession(
server, server,
createdSession.sessionId, createdSession.sessionId,
createdSession.sessionToken createdSession.sessionToken
).then((response) => { ).then((response) => {
console.log("getSession", response);
if (response?.session && response.session?.factors?.user?.loginName) { if (response?.session && response.session?.factors?.user?.loginName) {
const sessionCookie: SessionCookie = { const sessionCookie: SessionCookie = {
id: createdSession.sessionId, id: createdSession.sessionId,