Skip to content

Email update and user login log#885

Open
mo-zag wants to merge 6 commits intodevelopfrom
feature/nrmi-289-user-management-edit-own-email-address
Open

Email update and user login log#885
mo-zag wants to merge 6 commits intodevelopfrom
feature/nrmi-289-user-management-edit-own-email-address

Conversation

@mo-zag
Copy link
Copy Markdown
Contributor

@mo-zag mo-zag commented Apr 15, 2026

Description

[Link to the JIRA ticket and a summary of the change.](https://crowncommercialservice.atlassian.net/browse/NRMI-289)
[Link to the JIRA ticket and a summary of the change.](https://crowncommercialservice.atlassian.net/browse/NRMI-321)
[Link to the JIRA ticket and a summary of the change.](https://crowncommercialservice.atlassian.net/browse/NRMI-171)

Why was the change made?

This PR enables users to update their email address and view a history of their last five login sessions. The update flow focuses on a direct email change with built-in validation, while the security dashboard provides visibility into recent account activity by displaying the timestamp and device info for the five most recent sessions.

Are there any dependencies required for this change?

RMI API

What type of change is it?

[ ] New feature

How was the change tested?

Ran browser test of the functionality plus rspec test.

mo-zag added 4 commits March 25, 2026 13:41
Introduce email verification prompt and add an email change flow.

- SessionsController: add verify_email action and email_verified? helper (with previous enforcement commented out); add sessions/verify_email view to prompt users to verify their email.
- UserDetailsController: add edit_email and update_email actions with server-side validation (presence, confirmation match, format), API::User.update_email call, and connection error handling. Returns appropriate flash messages and status codes.
- Views: add user_details/edit_email.haml form and a link in user_details/show to change email.
- API: register update_email custom endpoint on API::User.
- Routes: add routes for edit_email/update_email on user_detail resource and verify_email route for sessions.

Provides UX for unverified emails and a complete edit/update flow with validation and error handling.
Introduce email verification flow and user authentication logs.

- Add EmailVerificationsController with show, resend_email and cancel_pending_email_change actions.
- Add API::EmailVerification model with helper methods (verify_email, email_verification_pending?, delete_pending_email_change) and custom endpoints.
- Add routes for viewing, resending and cancelling email verification.
- Add view for email verification confirmation and show notification banner in user_details when a pending email change exists.
- Surface user auth logs on the profile page and add API::User custom endpoint for user_auth_logs.
- Add internal server error JSON builder.
- Update specs and test helpers to mock the new endpoints.
@ccs-snyk
Copy link
Copy Markdown

ccs-snyk commented Apr 15, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

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.

2 participants