fix(user): Add user email as part of registration in authentication #6402
Open
Mrudhulraj wants to merge 1 commit into
Open
fix(user): Add user email as part of registration in authentication #6402Mrudhulraj wants to merge 1 commit into
Mrudhulraj wants to merge 1 commit into
Conversation
Contributor
|
👋 Thanks for opening this pull request, @Mrudhulraj! It looks like the pull request description doesn't quite follow our template yet:
Filling out the template helps reviewers understand and triage your contribution faster. Please edit the description to complete it. This message will disappear automatically once the template is followed. You can find the template prompts by editing the description, or see CONTRIBUTING.md for the full contribution flow. |
Contributor
Automated Reviewer SuggestionsBased on the
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this PR?
This PR fixes a bug in local-account registration where the user's email was
not captured or stored. Two layers were silently dropping the email:
auth.service.ts → POST /auth/register{ username, password }{ username, email, password }UserRegistrationRequest(Scala case class)(username, password)(username, email, password)AuthResource.registeruser.setEmail(username)user.setEmail(request.email)Before, every locally-registered user had
email = usernamein the database,because the request DTO had no
emailfield and the resource fell back tosetEmail(username). After this PR, the user-entered email is what lands inthe
user.emailcolumn.Frontend-side, the new
registerEmailform control uses[Validators.required, Validators.email]. A newUserService.validateEmaildoes a defensive non-empty + regex check before the request is sent. A new
#emailErrorTiptemplate renders "Please input your email." / "Please inputa valid email." messages on the Sign Up tab.
Any related issues, documentation, discussions?
How was this PR tested?
Unit tests (frontend,
local-login.component.spec.ts):builds allForms with the expected controls— asserts the form group nowincludes
registerEmailalongside the existing controls.requires registerEmail and enforces email format— covers theValidators.requiredandValidators.emailbehavior onregisterEmail.register › sets registerErrorMessage when the email is empty— shortcircuits before hitting
userService.registerwhenvalidateEmailfailson empty input.
register › sets registerErrorMessage when the email is malformed—covers an invalid email format path.
register › checks email validity before username validity— confirms thevalidation order: email runs before username when both are bad.
register › calls UserService.register with the trimmed username and surfaces a success notification— verifies the email value is forwardedthrough
userService.register(..., email, ...).register › surfaces the error's message via NotificationService.error on failureandregister › falls back to 'Registration failed' when the error has no message— error-path coverage on the new flow.Run command (copy/paste-able):
Backend was verified manually end-to-end: Sign Up tab → submit → row in
user table has the user-entered email rather than the username.
Was this PR authored or co-authored using generative AI tooling?
Yes for frontend forms and testing. Backend was fixed manually.