Skip to content

Feature/nrmi 289 update user email#1268

Open
reemi1510 wants to merge 11 commits intodevelopfrom
feature/nrmi-289-update-user-email
Open

Feature/nrmi 289 update user email#1268
reemi1510 wants to merge 11 commits intodevelopfrom
feature/nrmi-289-update-user-email

Conversation

@reemi1510
Copy link
Copy Markdown
Contributor

Description

https://crowncommercialservice.atlassian.net/browse/NRMI-289
https://crowncommercialservice.atlassian.net/browse/NRMI-320
https://crowncommercialservice.atlassian.net/browse/NRMI-302
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 (excluding IP data).

What type of change is it?

[ ] New feature

How was the change tested?

I performed end-to-end testing by using the browser to verify the UI flow for email updates and session displays. I also used Postman to hit the API endpoints directly, ensuring the backend correctly processes email changes and accurately retrieves the last five login sessions.

mo-zag added 11 commits April 13, 2026 20:28
Implements a full email change verification flow for users and admins. Adds EmailChangeRequest model, migrations and schema entries (token, expires_at, used_at, active) and ApiMessage helper. Exposes API endpoints (v1/email_verifications#create, verification, active, cancel_pending_email_change) and v1/users#update_email; adds admin UI/actions to edit/update user email. Introduces background jobs to send verification/confirmation emails via GOV.UK Notify (SendEmailVerificationJob, SendConfirmEmailVerificationJob) and Notify service wrapper. Adds services to update local user email and sync with Auth0 (UpdateUserEmail, UpdateUserEmailInAuth0) and to fetch auth logs (UserLogsInAuth0). Includes JSONAPI serializable resources, controller logic, view, route updates and comprehensive specs for models, controllers and services. Token expiry is 2 days; update operations are wrapped in DB transactions and Auth0 sync errors roll back changes.
Add the notifications-ruby-client gem to the Gemfile so the application can use the Notifications Ruby client library. The gem is added without a version constraint and is placed at top-level of the Gemfile.
test key removed and will populate to live key in env.
Pass user.name through controllers and services into SendEmailVerificationJob and SendConfirmEmailVerificationJob, add person_name to Notify template vars so emails can include the recipient's name, and update SendConfirmEmailVerificationJob signature. Also correct the Notify client initializer to use ENV['GOV_NOTIFY_API_KEY'] (was GOVUK_NOTIFY_API_KEY).
@ccs-snyk
Copy link
Copy Markdown

ccs-snyk commented Apr 16, 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.

3 participants