mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-13 10:17:33 +00:00
use createinvite
This commit is contained in:
@@ -6,7 +6,6 @@ import {
|
|||||||
getSession,
|
getSession,
|
||||||
getUserByID,
|
getUserByID,
|
||||||
listAuthenticationMethodTypes,
|
listAuthenticationMethodTypes,
|
||||||
resendInviteCode,
|
|
||||||
verifyEmail,
|
verifyEmail,
|
||||||
verifyInviteCode,
|
verifyInviteCode,
|
||||||
verifyTOTPRegistration,
|
verifyTOTPRegistration,
|
||||||
@@ -282,9 +281,12 @@ export async function resendVerification(command: resendVerifyEmailCommand) {
|
|||||||
const basePath = process.env.NEXT_PUBLIC_BASE_PATH ?? "";
|
const basePath = process.env.NEXT_PUBLIC_BASE_PATH ?? "";
|
||||||
|
|
||||||
return command.isInvite
|
return command.isInvite
|
||||||
? resendInviteCode({
|
? createInviteCode({
|
||||||
serviceUrl,
|
serviceUrl,
|
||||||
userId: command.userId,
|
userId: command.userId,
|
||||||
|
urlTemplate:
|
||||||
|
`${host.includes("localhost") ? "http://" : "https://"}${host}${basePath}/verify?code={{.Code}}&userId={{.UserID}}&organization={{.OrgID}}&invite=true` +
|
||||||
|
(command.requestId ? `&requestId=${command.requestId}` : ""),
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
if (error.code === 9) {
|
if (error.code === 9) {
|
||||||
return { error: "User is already verified!" };
|
return { error: "User is already verified!" };
|
||||||
@@ -315,7 +317,6 @@ export async function sendEmailCode(command: sendEmailCommand) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function sendInviteEmailCode(command: sendEmailCommand) {
|
export async function sendInviteEmailCode(command: sendEmailCommand) {
|
||||||
// TODO: change this to sendInvite
|
|
||||||
return createInviteCode({
|
return createInviteCode({
|
||||||
serviceUrl: command.serviceUrl,
|
serviceUrl: command.serviceUrl,
|
||||||
userId: command.userId,
|
userId: command.userId,
|
||||||
|
@@ -502,21 +502,6 @@ export async function verifyInviteCode({
|
|||||||
return userService.verifyInviteCode({ userId, verificationCode }, {});
|
return userService.verifyInviteCode({ userId, verificationCode }, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function resendInviteCode({
|
|
||||||
serviceUrl,
|
|
||||||
userId,
|
|
||||||
}: {
|
|
||||||
serviceUrl: string;
|
|
||||||
userId: string;
|
|
||||||
}) {
|
|
||||||
const userService: Client<typeof UserService> = await createServiceForHost(
|
|
||||||
UserService,
|
|
||||||
serviceUrl,
|
|
||||||
);
|
|
||||||
|
|
||||||
return userService.resendInviteCode({ userId }, {});
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function sendEmailCode({
|
export async function sendEmailCode({
|
||||||
serviceUrl,
|
serviceUrl,
|
||||||
userId,
|
userId,
|
||||||
|
Reference in New Issue
Block a user