urlTemplate

This commit is contained in:
peintnermax
2024-10-18 15:45:40 +02:00
parent 94e2d31f5b
commit 18a1262cb5
3 changed files with 6 additions and 3 deletions

View File

@@ -141,7 +141,7 @@
"info": "The user will receive an email with further instructions.",
"submit": "Continue",
"success": {
"title": "Invite User",
"title": "User invited",
"description": "The email has successfully been sent.",
"verified": "The user has been invited and has already verified his email.",
"notVerifiedYet": "The user has been invited. They will receive an email with further instructions.",

View File

@@ -2,6 +2,7 @@
import { addHumanUser, createInviteCode } from "@/lib/zitadel";
import { Factors } from "@zitadel/proto/zitadel/session/v2/session_pb";
import { headers } from "next/headers";
type InviteUserCommand = {
email: string;
@@ -19,6 +20,8 @@ export type RegisterUserResponse = {
};
export async function inviteUser(command: InviteUserCommand) {
const host = headers().get("host");
const human = await addHumanUser({
email: command.email,
firstName: command.firstName,
@@ -31,7 +34,7 @@ export async function inviteUser(command: InviteUserCommand) {
return { error: "Could not create user" };
}
const codeResponse = await createInviteCode(human.userId);
const codeResponse = await createInviteCode(human.userId, host);
if (!codeResponse || !human) {
return { error: "Could not create invite code" };

View File

@@ -312,7 +312,7 @@ export async function resendInviteCode(userId: string) {
return userService.resendInviteCode({ userId }, {});
}
export async function createInviteCode(userId: string, host?: string) {
export async function createInviteCode(userId: string, host: string | null) {
let medium = create(SendInviteCodeSchema, {
applicationName: "Typescript Login",
});