Skip to content

Pull Request for [BACKEND] Implement Backend Endpoint to Update User Email#22

Merged
jaykayudo merged 5 commits intoTrajectfi:mainfrom
clintjeff2:main
Jun 7, 2025
Merged

Pull Request for [BACKEND] Implement Backend Endpoint to Update User Email#22
jaykayudo merged 5 commits intoTrajectfi:mainfrom
clintjeff2:main

Conversation

@clintjeff2
Copy link
Contributor

Description

Implements a secure backend endpoint that allows authenticated users to update their email address as part of the user profile management system. This includes input validation, user identity resolution via Knox token authentication, and safe update handling.

Related Issue

Fixes #21

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Performance improvement
  • Code refactoring
  • Documentation update
  • Test coverage improvement
  • CI/CD related changes

How Has This Been Tested?

  • Unit tests
  • Integration tests
  • Manual testing

Test cases included:

  • Successful email update
  • Invalid email format
  • Unauthorized access
  • Missing required field
  • Multiple attempts and edge cases
  • Authenticated user scope check

- Add email validation and normalization
- Implement authenticated user email update logic
- Include proper error handling for invalid formats
- Add POST /account/update-email endpoint
- Enforce authentication with IsAuthenticated permission
- Return appropriate HTTP status codes (200/400/401)
- Include success response with updated email
- Add /account/update-email/ route mapping
- Wire UpdateEmailAPIView to URL configuration
- Test successful email update workflow
- Test email format validation with invalid inputs
- Test unauthorized access protection
- Test missing field validation
- Test email normalization to lowercase
- Test invalid token handling
- Achieve 100% code coverage for UpdateEmailAPIView
@jaykayudo
Copy link
Contributor

Hello @clintjeff2
Good job. The PR looks good.
Please format the code.

@clintjeff2
Copy link
Contributor Author

Hello @clintjeff2 Good job. The PR looks good. Please format the code.

Could you please clarify what you mean by “format the code”? Are you referring to code style or a specific section of the code that needs formatting?

@jaykayudo
Copy link
Contributor

Run ruff format . or make format if you have make installed on your system. It formats the codebase and improves the readability.

@clintjeff2
Copy link
Contributor Author

clintjeff2 commented Jun 7, 2025

Oh, I see. Will be done in an instant

@clintjeff2
Copy link
Contributor Author

Formated!!

@jaykayudo jaykayudo self-requested a review June 7, 2025 11:16
Copy link
Contributor

@jaykayudo jaykayudo left a comment

Choose a reason for hiding this comment

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

LGTM!
Great work

@jaykayudo jaykayudo merged commit 0f77d9d into Trajectfi:main Jun 7, 2025
1 check passed
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.

[BACKEND] Implement Backend Endpoint to Update User Email

2 participants