Skip to content

fix(user): Add user email as part of registration in authentication #6402

Open
Mrudhulraj wants to merge 1 commit into
apache:mainfrom
Mrudhulraj:fix/user-mail-fix
Open

fix(user): Add user email as part of registration in authentication #6402
Mrudhulraj wants to merge 1 commit into
apache:mainfrom
Mrudhulraj:fix/user-mail-fix

Conversation

@Mrudhulraj

Copy link
Copy Markdown

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:

Layer Before After
Frontend Sign Up form No email input New required email input with format validation
auth.service.ts → POST /auth/register Sent { username, password } Sends { username, email, password }
UserRegistrationRequest (Scala case class) (username, password) (username, email, password)
AuthResource.register user.setEmail(username) user.setEmail(request.email)

Before, every locally-registered user had email = username in the database,
because the request DTO had no email field and the resource fell back to
setEmail(username). After this PR, the user-entered email is what lands in
the user.email column.

Frontend-side, the new registerEmail form control uses
[Validators.required, Validators.email]. A new UserService.validateEmail
does a defensive non-empty + regex check before the request is sent. A new
#emailErrorTip template renders "Please input your email." / "Please input
a 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 now
    includes registerEmail alongside the existing controls.
  • requires registerEmail and enforces email format — covers the
    Validators.required and Validators.email behavior on registerEmail.
  • register › sets registerErrorMessage when the email is empty — short
    circuits before hitting userService.register when validateEmail fails
    on empty input.
  • register › sets registerErrorMessage when the email is malformed
    covers an invalid email format path.
  • register › checks email validity before username validity — confirms the
    validation 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 forwarded
    through userService.register(..., email, ...).
  • register › surfaces the error's message via NotificationService.error on failure and register › falls back to 'Registration failed' when the error has no message — error-path coverage on the new flow.

Run command (copy/paste-able):

cd frontend
yarn test --watch=false --testPathPattern=local-login

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.

@github-actions github-actions Bot added engine fix frontend Changes related to the frontend GUI labels Jul 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

👋 Thanks for opening this pull request, @Mrudhulraj!

It looks like the pull request description doesn't quite follow our template yet:

  • The What changes were proposed in this PR? section is missing; please keep the template's headings.
  • The How was this PR tested? section is missing; please keep the template's headings.
  • The Was this PR authored or co-authored using generative AI tooling? section is missing; please keep the template's headings.

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.

@github-actions

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Contributors with relevant context: @aglinxinyuan, @Ma77Ball, @jaeyun0503
    You can notify them by mentioning @aglinxinyuan, @Ma77Ball, @jaeyun0503 in a comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

engine fix frontend Changes related to the frontend GUI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant