fix-1392-Inconsistency-in-User-Verification-Status
What does this PR do?
Fixes #1392
👍 Expected behavior When the user hits Verify Phone, the alert should confirm that the user is verified. When the user hits Unverify Phone, the alert should confirm that the user is unverified. 👎 Actual Behavior When attempting to verify the phone number, an alert incorrectly states that the user is unverified. However, when attempting to unverify the phone, the system incorrectly indicates that the user is verified.
Followed stnguyen90's guidelines: We want to update the alerts to be specific to say:
XYZ's email has been verified XYZ's email has been unverified XYZ's phone has been verified XYZ's phone has been unverified
Note: The "s" should only be there if the name does not end with s. For example, if the user's name was "Charles", it should be "Charles' email has been verified"
Changed these lines:
message: ${$user.name || $user.email || $user.phone || 'The account'} has been ${ !$user.emailVerification ? 'unverified' : 'verified' },
message: ${$user.name || $user.email || $user.phone || 'The account'} has been ${ $user.phoneVerification ? 'unverified' : 'verified' },
To these lines:
message: ${$user.name || $user.email || $user.phone || 'The account'}${( $user.name || $user.email || $user.phone || 'The account' ).endsWith('s') ? "'" : "'s"} email has been ${!$user.emailVerification ? 'unverified' : 'verified'},
message: `${$user.name || $user.email || $user.phone || 'The account'}${(
$user.name || $user.email || $user.phone || 'The account'
).endsWith('s')
? "'"
: "'s"} phone has been ${!$user.phoneVerification ? 'unverified' : 'verified'}`,
Current behavior:
XYZ's email has been verified XYZ's email has been unverified XYZ's phone has been verified XYZ's phone has been unverified
OR (If the user's name ends in a s)
QRS' email has been verified QRS' email has been unverified QRS' phone has been verified QRS' phone has been unverified
Test Plan
Under a project, select Auth. In Auth, select or create a user that has both an email and a phone number. Select the 'Verify account' option and then verify the phone number and email. The correct alerts will be displayed.
Have you read the Contributing Guidelines on issues?
Yes
Summary by CodeRabbit
-
Refactor
- Improved verification notifications for email and phone. Messages now reference the user’s name when available, otherwise use a generic form.
- Updated phrasing for clarity: “has been verified” when verified and “is no longer verified” when unverified.
- No changes to underlying verification behavior, analytics, or notification types; only the displayed copy is refined for a clearer user experience.