Skip to content

FIX: Inconsistency in User Verification Status between Email and Phone Number & Password Field Not Reset On Email Update #2115

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

Joyal-George-KJ
Copy link
Contributor

@Joyal-George-KJ Joyal-George-KJ commented Jul 13, 2025

What does this PR do?

Changes:

  • Issue Inconsistency in User Verification Status between Email and Phone Number 🐛 Bug Report: Inconsistency in User Verification Status between Email and Phone Number #1392:

    • Alert Status mismatch corrected. Added ! to user verification check condition $user.phoneVerification ? 'unverified' : 'verified' changed to !$user.phoneVerification ? 'unverified' : 'verified'.
    • Formatting the name if we are verifying email and has name for user.
    • Formatting the name and email if we are verifying phone number and has name and email for user.
    • Removed The Account from both phone and email verification because the condition is not valid. Condition says that if account has no username, email and phone user use The account instead of using name, email or phone. Which means its an anonymous account that doesn't need verification.
    • Rule followed for the Formatting:
      • XYZ's email has been verified.
      • XYZ's email has been unverified.
      • XYZ's phone has been verified.
      • XYZ's phone has been unverified.
  • Issue Password Field Not Reset On Email Update 🐛 Bug Report: Password Field Not Reset On Email Update #976:

    • Just set the emailPassword to null after email updated successfully.

Test Plan

  • Checked if the formatting working properly.
  • Email Verification Checks
    • Tested name with and without ending with s.
  • Phone Verification Checks
    • Tested email and name ending with s and without s.
    • Status alert checked and made sure it was showing right verification status.,

Related PRs and Issues

Addressing Issue #976 : There was this PR #1136 but it had conflicts and wasn't resolved till now (1 month has been passed)

  • There was a PR but it didn't follow the Rules and didn't merge, Hence This PR!

Have you read the Contributing Guidelines on issues?

  • I have read and followed the Guidelines showing above.

@Joyal-George-KJ Joyal-George-KJ force-pushed the fix-1392-Condition-Checker-for-updateVerificationPhone-corrected branch 2 times, most recently from 227da36 to 5f461ee Compare July 13, 2025 10:53
@Joyal-George-KJ Joyal-George-KJ changed the title FIX: Inconsistency in User Verification Status between Email and Phone Number FIX: Inconsistency in User Verification Status between Email and Phone Number & Password Field Not Reset On Email Update Jul 13, 2025
@Joyal-George-KJ
Copy link
Contributor Author

@stnguyen90 @ItzNotABug PR review request!

@DH-555 DH-555 requested a review from Copilot July 14, 2025 14:01
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR corrects user verification alert messages for email and phone statuses and ensures the password field is cleared after updating the email.

  • Fixes inverted logic and message formatting for email and phone verification alerts
  • Removes “The account” fallback in notifications and applies consistent phrasing
  • Resets emailPassword to null after a successful email update

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
src/routes/(console)/project-[region]-[project]/auth/user-[user]/updateStatus.svelte Updated notification templates for email and phone verification
src/routes/(console)/account/updateEmail.svelte Set emailPassword to null after successfully updating email

addNotification({
message: `${$user.name || $user.email || $user.phone || 'The account'} has been ${
!$user.emailVerification ? 'unverified' : 'verified'
message: `The email${$user.name && ` for ${$user.name}`} ${
Copy link
Preview

Copilot AI Jul 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using $user.name && inside a template literal can yield undefined if name is falsy. Consider using a ternary: ${$user.name ? for ${$user.name} : ''} to avoid inserting “undefined.”

Suggested change
message: `The email${$user.name && ` for ${$user.name}`} ${
message: `The email${$user.name ? ` for ${$user.name}` : ''} ${

Copilot uses AI. Check for mistakes.

Copy link
Member

@DH-555 DH-555 Jul 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's an empty string by default, so not needed

addNotification({
message: `${$user.name || $user.email || $user.phone || 'The account'} has been ${
$user.phoneVerification ? 'unverified' : 'verified'
message: `The phone ${$user[$user.name ? 'name' : 'email'] && `for ${$user[$user.name ? 'name' : 'email']}`}${
Copy link
Preview

Copilot AI Jul 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dynamic property guard here may insert undefined if both name and email are missing. Use a nested ternary to explicitly handle each case, e.g., ${$user.name ? for ${$user.name}: $user.email ? for ${$user.email} : ''}.

Suggested change
message: `The phone ${$user[$user.name ? 'name' : 'email'] && `for ${$user[$user.name ? 'name' : 'email']}`}${
message: `The phone${$user.name ? ` for ${$user.name}` : $user.email ? ` for ${$user.email}` : ''}${

Copilot uses AI. Check for mistakes.

message: `${$user.name || $user.email || $user.phone || 'The account'} has been ${
!$user.emailVerification ? 'unverified' : 'verified'
message: `The email${$user.name && ` for ${$user.name}`} ${
!$user.emailVerification ? 'is no longer verified' : ' has been verified'
Copy link
Preview

Copilot AI Jul 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The leading space on the 'has been verified' branch combined with the preceding template space can result in double spaces. Move spacing outside the conditional or remove the extra leading space for consistency.

Suggested change
!$user.emailVerification ? 'is no longer verified' : ' has been verified'
!$user.emailVerification ? 'is no longer verified' : 'has been verified'

Copilot uses AI. Check for mistakes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooops, small leading space there. I think this is not intentional, right? @Joyal-George-KJ

Comment on lines 50 to 51
message: `The phone ${$user[$user.name ? 'name' : 'email'] && `for ${$user[$user.name ? 'name' : 'email']}`}${
!$user.phoneVerification ? ' is no longer verified' : ' has been verified'
Copy link
Preview

Copilot AI Jul 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Similarly here, both branches include a leading space—consider unifying whitespace handling outside the conditional to prevent inconsistent spacing in the final message.

Suggested change
message: `The phone ${$user[$user.name ? 'name' : 'email'] && `for ${$user[$user.name ? 'name' : 'email']}`}${
!$user.phoneVerification ? ' is no longer verified' : ' has been verified'
message: `The phone ${$user[$user.name ? 'name' : 'email'] && `for ${$user[$user.name ? 'name' : 'email']}`} ${
!$user.phoneVerification ? 'is no longer verified' : 'has been verified'

Copilot uses AI. Check for mistakes.

Comment on lines 27 to 28
message: `The email${$user.name && ` for ${$user.name}`} ${
!$user.emailVerification ? 'is no longer verified' : ' has been verified'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be simplified for readability.

Comment on lines 49 to 51
addNotification({
message: `${$user.name || $user.email || $user.phone || 'The account'} has been ${
$user.phoneVerification ? 'unverified' : 'verified'
message: `The phone ${$user[$user.name ? 'name' : 'email'] && `for ${$user[$user.name ? 'name' : 'email']}`}${
!$user.phoneVerification ? ' is no longer verified' : ' has been verified'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here.

@coolify-appwrite-org
Copy link

coolify-appwrite-org bot commented Jul 14, 2025

The preview deployment is ready. 🟢

Open Preview | Open Build Logs

Last updated at: 2025-07-14 17:17:18 CET

@coolify-appwrite-org
Copy link

coolify-appwrite-org bot commented Jul 14, 2025

The preview deployment is ready. 🟢

Open Preview | Open Build Logs

Last updated at: 2025-07-14 17:17:17 CET

@Joyal-George-KJ
Copy link
Contributor Author

@ItzNotABug and @DH-555: The changes has been made.

  • Created a condition check for the presence of user name and email.
  • Removed Unwanted space in the notification.

Requesting review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants