aicam opened a new issue, #7595:
URL: https://github.com/apache/texera/issues/7595

   ### What happened?
   
   When an unapproved user requests access on an invite-only deployment, the 
notification email sent to admins contains only the requester's **Email**, 
**Affiliation**, and **Reason** — the user's **name is missing**, even though 
we already have it.
   
   Example of an email an admin received:
   
   ```
   A new user has attempted to log in or register, but their account is not yet 
approved.
   Please review the account request for the following user:
   
   Email: <user>@gmail.com
   Affiliation: North Dakota State University
   Reason: I'm a computer science PhD student who would like to use this 
platform ...
   ```
   
   The name is available at every step, it is just never carried into the email:
   
   1. The name comes from the Google login (`googleName`) and is persisted on 
the user record — 
`amber/src/main/scala/org/apache/texera/web/resource/auth/GoogleAuthResource.scala:78-104`.
   2. The registration modal even *displays* it in a disabled "Name" field — 
`frontend/src/app/common/service/user/registration-request-modal/registration-request-modal.component.html:31-35`.
   3. But `getValues()` returns only `affiliation` and `reason` — 
`registration-request-modal.component.ts:49-54`.
   4. So `notifyUnauthorizedLogin()` POSTs only `{ receiver, affiliation, 
reason }` — `frontend/src/app/common/service/gmail/gmail.service.ts:52-54`.
   5. `EmailMessage` has no `name` field and `userRegistrationNotification` 
never renders one — 
`amber/src/main/scala/org/apache/texera/web/resource/GmailResource.scala:39-45` 
and 
`amber/src/main/scala/org/apache/texera/web/resource/EmailTemplate.scala:58-72`.
   
   **Expected:** the admin email includes the requester's name alongside their 
email, so admins can identify who is asking for access without opening the 
admin panel.
   
   ### How to reproduce?
   
   1. Deploy with `inviteOnly` enabled and at least one `ADMIN` user with a 
valid email.
   2. Log in with a Google account that has no approved Texera account (role 
`INACTIVE`).
   3. The "Request access" modal appears, pre-filled with the account's name 
and email; fill in Affiliation and Reason and click **Send request to Admin**.
   4. Check the admin's inbox: the "New Account Request Pending Approval" email 
lists Email / Affiliation / Reason, but no name.
   
   ### Proposed fix
   
   Add the name to the admin email template. Preferably resolve it 
**server-side** in `GmailResource.notifyUnauthorizedUser` by looking the user 
up by email (the record already exists at this point, with the Google name 
stored), rather than accepting a client-supplied name — that avoids trusting a 
value from the browser and keeps the frontend payload unchanged. Then render a 
`Name:` line in `EmailTemplate.userRegistrationNotification`, following the 
existing `Affiliation`/`Reason` pattern with a `"Not provided"` fallback, and 
update `EmailTemplateSpec` accordingly.
   
   ### Version/Branch
   
   1.3.0-incubating-SNAPSHOT (main)
   
   ### What browsers are you seeing the problem on?
   
   Chrome
   
   ### Relevant log output
   
   ```shell
   N/A — the email content itself is the evidence (see above).
   ```
   


-- 
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