Skip to content

Commit

Permalink
Add missing user email verification handler test cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
PasinduYeshan committed Sep 18, 2024
1 parent 05dc2de commit a81c82e
Show file tree
Hide file tree
Showing 2 changed files with 254 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,6 @@ private void preSetUserClaimsOnEmailUpdate(Map<String, String> claims, UserStore
return;
}

// TODO: Check why this was moved to the bottom before? This was not triggered due to that.
/*
Within the Email OTP flow, the email address is updated in the user profile after successfully verifying the
OTP. Therefore, the email is already verified & no need to verify it again.
Expand All @@ -575,13 +574,6 @@ private void preSetUserClaimsOnEmailUpdate(Map<String, String> claims, UserStore
Utils.unsetThreadLocalToSkipSendingEmailVerificationOnUpdate();
}

if (MapUtils.isEmpty(claims)) {
// Not required to handle in this handler.
Utils.setThreadLocalToSkipSendingEmailVerificationOnUpdate(IdentityRecoveryConstants.
SkipEmailVerificationOnUpdateStates.SKIP_ON_INAPPLICABLE_CLAIMS.toString());
return;
}

boolean supportMultipleEmails = Utils.isMultiEmailsAndMobileNumbersPerUserEnabled();
String multiAttributeSeparator = FrameworkUtils.getMultiAttributeSeparator();

Expand Down Expand Up @@ -610,11 +602,6 @@ private void preSetUserClaimsOnEmailUpdate(Map<String, String> claims, UserStore
updatedVerifiedEmailAddresses.remove(emailAddress);
}

/*
TODO: Check if this can be removed, this is not triggered. But if we can skip throwing an error when
the primary mobile number is not in the existing verified list, instead go with verification process,
then, this can be useful.
*/
if (existingVerifiedEmailAddresses.contains(emailAddress)) {
if (log.isDebugEnabled()) {
log.debug(String.format("The email address to be updated: %s is same as the existing email " +
Expand Down
Loading

0 comments on commit a81c82e

Please sign in to comment.