use urlTemplate for emails, fix error i18n

This commit is contained in:
peintnermax
2024-10-17 16:35:30 +02:00
parent b1ad3ab374
commit e10a54d4ae
15 changed files with 47 additions and 32 deletions

View File

@@ -492,16 +492,24 @@ export function createUser(
* @param userId the id of the user where the email should be set
* @returns the newly set email
*/
export async function passwordReset(userId: string) {
export async function passwordReset(userId: string, host: string | null) {
return userService.passwordReset(
{
userId,
medium: {
case: "sendLink",
value: {
notificationType: NotificationType.Email,
},
},
medium: host
? {
case: "sendLink",
value: {
notificationType: NotificationType.Email,
urlTemplate: `https://${host}/password/set?code={{.Code}}&userId={{.UserID}}&organization={{.OrgID}}`,
},
}
: {
case: "sendLink",
value: {
notificationType: NotificationType.Email,
},
},
},
{},
);