Mrudhulraj opened a new pull request, #6402:
URL: https://github.com/apache/texera/pull/6402

    <!--
      Thanks for sending a pull request (PR)! Here are some tips for you:
        1. If this is your first time, please read our contributor guidelines:
           [Contributing to 
Texera](https://github.com/apache/texera/blob/main/CONTRIBUTING.md)
        2. Ensure you have added or run the appropriate tests for your PR
        3. If the PR is work in progress, mark it a draft on GitHub.
        4. Please write your PR title to summarize what this PR proposes, we
          are following Conventional Commits style for PR titles as well.
        5. Be sure to keep the PR description updated to reflect all changes.
      -->
   
      ### 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?
   
      <!-- TODO: replace or remove if there is no tracking issue.
           Branch is `fix/user-mail-fix`. If an issue exists, use:
           `Fixes #NNNN`, `Resolves #NNNN`, or `Closes #NNNN`. If only related,
           just mention the issue number. -->
   
   
      ### 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):
   
      ```bash
      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?
   
    <!--
    Choose one and delete the other. Per ASF guidance, if generative AI tooling
    helped author this PR, include `Generated-by: <tool> <version>`.
   
    TODO: replace with one of the two lines below.
    -->
    Yes for frontend forms and testing. Backend was fixed manually.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to