From b224a323fbe74b6ba1893a16a540bcdfe68c840d Mon Sep 17 00:00:00 2001 From: Carlos Date: Thu, 9 Jan 2025 16:37:36 +0100 Subject: [PATCH] fix updateUser condition to handle email undefined case --- src/resolvers/userResolver.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/resolvers/userResolver.ts b/src/resolvers/userResolver.ts index 4629bd937..c5e4b6860 100644 --- a/src/resolvers/userResolver.ts +++ b/src/resolvers/userResolver.ts @@ -189,7 +189,11 @@ export class UserResolver { throw new Error(i18n.__(translationErrorMessagesKeys.EMAIL_NOT_VERIFIED)); } // Check if old email is verified and user entered new one - if (dbUser.isEmailVerified && email !== dbUser.email) { + if ( + dbUser.isEmailVerified && + email !== undefined && + email !== dbUser.email + ) { throw new Error(i18n.__(translationErrorMessagesKeys.EMAIL_NOT_VERIFIED)); } if (email !== undefined) {