Skip to content
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

Change Email Address in Profile Page #947

Open
StanevPrime opened this issue Jan 3, 2025 · 0 comments
Open

Change Email Address in Profile Page #947

StanevPrime opened this issue Jan 3, 2025 · 0 comments
Assignees

Comments

@StanevPrime
Copy link
Member

StanevPrime commented Jan 3, 2025

User Story: Change Email Address in Profile Page

As a logged-in user,
I want to update my email address from my profile page,
So that I can ensure my account is linked to the correct email address.

Initiate Email Change Verify New Email Confirmation Emails
Initiate Email Change Verify New Email Confirmation Emails

Acceptance Criteria (AC)

1. Initiate Email Change

  • Given I am on the profile page,
    When I enter a new email address in the email field and submit the change through a bottom sheet,
    Then I should see a confirmation page indicating that a verification link has been sent to the new email address.
    Note: Use the same deep-link approach/designs/pages as in the onboarding flow

  • Given I have entered an email that is already associated with another account,
    When I try to submit the change,
    Then I should see an error message, "This email is already in use."
    Note: The validation related messages should be controlled by the API

2. Verify New Email

  • Given I have received an email verification link,
    When I click the link,
    Then my email should be successfully updated, and I should receive a confirmation notification on both the old and new email addresses.
    Note: Use the same deep-link approach/designs/pages as in the onboarding flow

  • Given I click the email verification link after it has expired,
    When I am redirected,
    Then I should see an error message indicating the link is invalid or expired, with an option to resend the verification email.
    Note: Use the same deep-link approach/designs/pages as in the onboarding flow

3. Email Change Notification

  • Given I have successfully updated my email address,
    When I check my inbox,
    Then I should receive a confirmation that my email address has been changed
    Note: Use the same deep-link approach/designs/pages as in the onboarding flow

DevNotes

  • Build this functionality as part of the onboarding brick

API Contract

1. Initiate Email Change

Endpoint: PATCH /api/users/me
Headers: Authorization: Bearer <token>
Request Body:

{
  "email": "[email protected]"
}

Response:

  • 200 OK
{
    "id": "12345",
    "email": "[email protected]",
    "phoneNumber": null,
    "role": "User",
    "confirmedCredentials": {
        "email": true,
        "phone": true
    }
}
  • 409 Conflict
{
  "error": "This email is already in use."
}
  • 422 Unprocessable Entity
{
  "error": "Invalid email format."
}

2. Verify New Email

Endpoint: POST /api/users/me/email/confirm
Headers: Authorization: Bearer <token>
Request

{
  "token": "uniqueToken123" 
}

Response:

  • 200 OK
{
    "id": "12345",
    "email": "[email protected]",
    "phoneNumber": null,
    "role": "TempUser",
    "confirmedCredentials": {
        "email": true,
        "phone": true
    }
}
  • 400 Bad Request
{
  "error": "Invalid or expired token."
}

3. Resend Verification Email

Endpoint: POST /api/users/me/email/resend-confirmation
Headers: Authorization: Bearer <token>
Description: Resends the confirmation link to the user.

Response

Success (200): UserModel

{
    "id": "12345",
    "email": "[email protected]",
    "phoneNumber": null,
    "role": "User",
    "confirmedCredentials": {
        "email": true,
        "phone": true
    }
}

Error (400):

{
  "error": "Invalid or expired user."
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: To Do
Development

No branches or pull requests

2 participants