Skip to content

Commit

Permalink
fix updateUser condition to handle email undefined case
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosQ96 committed Jan 9, 2025
1 parent b558266 commit b224a32
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/resolvers/userResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit b224a32

Please sign in to comment.