mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-13 13:12:15 +00:00
fix register session
This commit is contained in:
@@ -9,7 +9,7 @@ describe("register", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("should redirect a user who selects passwordless on register to /passkeys/add", () => {
|
||||
it("should redirect a user who selects passwordless on register to /passkey/set", () => {
|
||||
cy.visit("/register");
|
||||
cy.get('input[autocomplete="firstname"]').focus().type("John");
|
||||
cy.get('input[autocomplete="lastname"]').focus().type("Doe");
|
||||
|
||||
@@ -69,6 +69,7 @@ export function RegisterFormWithoutPassword({
|
||||
}).catch((error) => {
|
||||
setError("Could not register user");
|
||||
setLoading(false);
|
||||
return;
|
||||
});
|
||||
|
||||
if (response && "error" in response) {
|
||||
|
||||
@@ -4,7 +4,10 @@ import { createSessionAndUpdateCookie } from "@/lib/server/cookie";
|
||||
import { addHumanUser } from "@/lib/zitadel";
|
||||
import { create } from "@zitadel/client";
|
||||
import { Factors } from "@zitadel/proto/zitadel/session/v2/session_pb";
|
||||
import { ChecksSchema } from "@zitadel/proto/zitadel/session/v2/session_service_pb";
|
||||
import {
|
||||
ChecksJson,
|
||||
ChecksSchema,
|
||||
} from "@zitadel/proto/zitadel/session/v2/session_service_pb";
|
||||
|
||||
type RegisterUserCommand = {
|
||||
email: string;
|
||||
@@ -34,10 +37,18 @@ export async function registerUser(command: RegisterUserCommand) {
|
||||
return { error: "Could not create user" };
|
||||
}
|
||||
|
||||
const checks = create(ChecksSchema, {
|
||||
let checkPayload: any = {
|
||||
user: { search: { case: "userId", value: human.userId } },
|
||||
password: { password: command.password },
|
||||
});
|
||||
};
|
||||
|
||||
if (command.password) {
|
||||
checkPayload = {
|
||||
...checkPayload,
|
||||
password: { password: command.password },
|
||||
} as ChecksJson;
|
||||
}
|
||||
|
||||
const checks = create(ChecksSchema, checkPayload);
|
||||
|
||||
return createSessionAndUpdateCookie(
|
||||
checks,
|
||||
|
||||
Reference in New Issue
Block a user