From ea6bdbf311a4ddb99a74f23d349e15022c139220 Mon Sep 17 00:00:00 2001 From: Sam Peters Date: Fri, 16 Feb 2024 11:28:03 -0600 Subject: [PATCH] chore: update email after verified --- core/api/src/app/authentication/email.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/api/src/app/authentication/email.ts b/core/api/src/app/authentication/email.ts index c1030aa8268..31e6f148a30 100644 --- a/core/api/src/app/authentication/email.ts +++ b/core/api/src/app/authentication/email.ts @@ -26,8 +26,6 @@ export const addEmailToIdentity = async ({ const emailRegistrationId = await authServiceEmail.sendEmailWithCode({ email }) if (emailRegistrationId instanceof Error) return emailRegistrationId - await NotificationsService().updateEmailAddress({ userId, email }) - const user = await UsersRepository().findById(userId) if (user instanceof Error) return user @@ -50,6 +48,11 @@ export const verifyEmail = async ({ }) if (res instanceof Error) return res + await NotificationsService().updateEmailAddress({ + userId: res.kratosUserId, + email: res.email, + }) + const user = await UsersRepository().findById(res.kratosUserId) if (user instanceof Error) return user