mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-22 13:17:41 +00:00
cleanup fcn
This commit is contained in:
@@ -48,7 +48,6 @@ const passwordAttemptsHandler = (error: ConnectError) => {
|
||||
|
||||
export async function createSessionAndUpdateCookie(
|
||||
checks: Checks,
|
||||
challenges: RequestChallenges | undefined,
|
||||
requestId: string | undefined,
|
||||
lifetime?: Duration,
|
||||
): Promise<Session> {
|
||||
@@ -57,9 +56,7 @@ export async function createSessionAndUpdateCookie(
|
||||
|
||||
const createdSession = await createSessionFromChecks({
|
||||
serviceUrl,
|
||||
|
||||
checks,
|
||||
challenges,
|
||||
lifetime,
|
||||
});
|
||||
|
||||
|
@@ -241,7 +241,6 @@ export async function sendLoginname(command: SendLoginnameCommand) {
|
||||
|
||||
const session = await createSessionAndUpdateCookie(
|
||||
checks,
|
||||
undefined,
|
||||
command.requestId,
|
||||
);
|
||||
|
||||
|
@@ -127,7 +127,6 @@ export async function sendPassword(command: UpdateSessionCommand) {
|
||||
try {
|
||||
session = await createSessionAndUpdateCookie(
|
||||
checks,
|
||||
undefined,
|
||||
command.requestId,
|
||||
loginSettings?.passwordCheckLifetime,
|
||||
);
|
||||
|
@@ -71,7 +71,6 @@ export async function registerUser(command: RegisterUserCommand) {
|
||||
|
||||
const session = await createSessionAndUpdateCookie(
|
||||
checks,
|
||||
undefined,
|
||||
command.requestId,
|
||||
command.password ? loginSettings?.passwordCheckLifetime : undefined,
|
||||
);
|
||||
|
@@ -155,11 +155,7 @@ export async function sendVerification(command: VerifyUserByEmailCommand) {
|
||||
},
|
||||
});
|
||||
|
||||
session = await createSessionAndUpdateCookie(
|
||||
checks,
|
||||
undefined,
|
||||
command.requestId,
|
||||
);
|
||||
session = await createSessionAndUpdateCookie(checks, command.requestId);
|
||||
}
|
||||
|
||||
if (!session?.factors?.user?.id) {
|
||||
@@ -368,11 +364,7 @@ export async function sendVerificationRedirectWithoutCheck(
|
||||
},
|
||||
});
|
||||
|
||||
session = await createSessionAndUpdateCookie(
|
||||
checks,
|
||||
undefined,
|
||||
command.requestId,
|
||||
);
|
||||
session = await createSessionAndUpdateCookie(checks, command.requestId);
|
||||
}
|
||||
|
||||
if (!session?.factors?.user?.id) {
|
||||
|
@@ -237,18 +237,16 @@ export async function getPasswordComplexitySettings({
|
||||
export async function createSessionFromChecks({
|
||||
serviceUrl,
|
||||
checks,
|
||||
challenges,
|
||||
lifetime,
|
||||
}: {
|
||||
serviceUrl: string;
|
||||
checks: Checks;
|
||||
challenges: RequestChallenges | undefined;
|
||||
lifetime?: Duration;
|
||||
}) {
|
||||
const sessionService: Client<typeof SessionService> =
|
||||
await createServiceForHost(SessionService, serviceUrl);
|
||||
|
||||
return sessionService.createSession({ checks, challenges, lifetime }, {});
|
||||
return sessionService.createSession({ checks, lifetime }, {});
|
||||
}
|
||||
|
||||
export async function createSessionForUserIdAndIdpIntent({
|
||||
|
Reference in New Issue
Block a user