mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-12 14:54:33 +00:00
verify commands
This commit is contained in:
@@ -12,6 +12,8 @@ import { RequestChallenges } from "@zitadel/proto/zitadel/session/v2/challenge_p
|
||||
import { Checks } from "@zitadel/proto/zitadel/session/v2/session_service_pb";
|
||||
import {
|
||||
AddHumanUserRequest,
|
||||
ResendEmailCodeRequest,
|
||||
ResendEmailCodeRequestSchema,
|
||||
RetrieveIdentityProviderIntentRequest,
|
||||
SetPasswordRequest,
|
||||
SetPasswordRequestSchema,
|
||||
@@ -23,6 +25,7 @@ import { create, Duration } from "@zitadel/client";
|
||||
import { TextQueryMethod } from "@zitadel/proto/zitadel/object/v2/object_pb";
|
||||
import { CreateCallbackRequest } from "@zitadel/proto/zitadel/oidc/v2/oidc_service_pb";
|
||||
import { Organization } from "@zitadel/proto/zitadel/org/v2/org_pb";
|
||||
import { SendEmailVerificationCodeSchema } from "@zitadel/proto/zitadel/user/v2/email_pb";
|
||||
import type { RedirectURLsJson } from "@zitadel/proto/zitadel/user/v2/idp_pb";
|
||||
import {
|
||||
NotificationType,
|
||||
@@ -448,13 +451,28 @@ export async function verifyEmail(userId: string, verificationCode: string) {
|
||||
);
|
||||
}
|
||||
|
||||
export async function resendEmailCode(userId: string) {
|
||||
return userService.resendEmailCode(
|
||||
{
|
||||
userId,
|
||||
},
|
||||
{},
|
||||
);
|
||||
export async function resendEmailCode(
|
||||
userId: string,
|
||||
host: string | null,
|
||||
authRequestId?: string,
|
||||
) {
|
||||
let request: ResendEmailCodeRequest = create(ResendEmailCodeRequestSchema, {
|
||||
userId,
|
||||
});
|
||||
|
||||
if (host) {
|
||||
const medium = create(SendEmailVerificationCodeSchema, {
|
||||
urlTemplate:
|
||||
`${host.includes("localhost") ? "http://" : "https://"}${host}/password/set?code={{.Code}}&userId={{.UserID}}&organization={{.OrgID}}` +
|
||||
(authRequestId ? `&authRequestId=${authRequestId}` : ""),
|
||||
});
|
||||
|
||||
request = { ...request, verification: { case: "sendCode", value: medium } };
|
||||
}
|
||||
|
||||
console.log(request);
|
||||
|
||||
return userService.resendEmailCode(request, {});
|
||||
}
|
||||
|
||||
export function retrieveIDPIntent(id: string, token: string) {
|
||||
|
||||
Reference in New Issue
Block a user