mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-12 14:54:33 +00:00
send code on verify page visit, generate from branch
This commit is contained in:
@@ -15,6 +15,7 @@ import {
|
||||
ResendEmailCodeRequest,
|
||||
ResendEmailCodeRequestSchema,
|
||||
RetrieveIdentityProviderIntentRequest,
|
||||
SendEmailCodeRequestSchema,
|
||||
SetPasswordRequest,
|
||||
SetPasswordRequestSchema,
|
||||
VerifyPasskeyRegistrationRequest,
|
||||
@@ -273,6 +274,32 @@ export async function resendInviteCode(userId: string) {
|
||||
return userService.resendInviteCode({ userId }, {});
|
||||
}
|
||||
|
||||
export async function sendEmailCode(
|
||||
userId: string,
|
||||
host: string | null,
|
||||
authRequestId?: string,
|
||||
) {
|
||||
let medium = create(SendEmailCodeRequestSchema, {
|
||||
userId,
|
||||
});
|
||||
|
||||
if (host) {
|
||||
medium = create(SendEmailCodeRequestSchema, {
|
||||
...medium,
|
||||
verification: {
|
||||
case: "sendCode",
|
||||
value: create(SendEmailVerificationCodeSchema, {
|
||||
urlTemplate:
|
||||
`${host.includes("localhost") ? "http://" : "https://"}${host}/verify?code={{.Code}}&userId={{.UserID}}&organization={{.OrgID}}&invite=true` +
|
||||
(authRequestId ? `&authRequestId=${authRequestId}` : ""),
|
||||
}),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
return userService.sendEmailCode(medium, {});
|
||||
}
|
||||
|
||||
export async function createInviteCode(userId: string, host: string | null) {
|
||||
let medium = create(SendInviteCodeSchema, {
|
||||
applicationName: "Typescript Login",
|
||||
|
||||
Reference in New Issue
Block a user