Skip to content

✨ Add admin UI for restoring deleted users#1248

Merged
0x46616c6b merged 1 commit intomainfrom
feature/admin-restore-user
Apr 18, 2026
Merged

✨ Add admin UI for restoring deleted users#1248
0x46616c6b merged 1 commit intomainfrom
feature/admin-restore-user

Conversation

@0x46616c6b
Copy link
Copy Markdown
Member

@0x46616c6b 0x46616c6b commented Apr 18, 2026

Summary

Adds a restore action to the admin user management, allowing admins to restore soft-deleted users directly from the admin interface. Previously, restoring users was only possible via the CLI command app:users:restore.

The restore flow sets a new password, resets two-factor authentication and mailbox encryption, generates a new recovery token, and sends a welcome email. The recovery token is displayed prominently on the user show page after a successful restore, with clear instructions to pass it on to the user.

Bildschirmfoto am 2026-04-18 um 11 04 52 Bildschirmfoto am 2026-04-18 um 11 04 33

Key changes

  • Controller: restore (GET) and restoreSubmit (POST) actions on UserController following the GET/POST split pattern
  • Form: New UserRestoreType with repeated password field (min 12 chars, NotCompromised)
  • Event: New USER_RESTORED event constant, dispatched by UserRestoreService instead of reusing USER_CREATED
  • Listener: WelcomeMailListener now also subscribes to USER_RESTORED
  • Templates: Restore page with warning banner, restore buttons on index/show pages for deleted users, recovery token display block with copy button
  • Translations: Dedicated EN/DE translations including admin-context recovery token wording (instructs admin to pass the token to the user)
  • Tests: 7 new Behat scenarios, updated unit tests for event and listener changes

The changes and the PR were generated by OpenCode.

Adds a restore action to the admin user management that allows admins
to restore soft-deleted users with a new password. The restore flow
regenerates mailbox encryption, recovery token, and sends a welcome
email via a new USER_RESTORED event.

- Add restore/restoreSubmit actions to UserController (GET/POST split)
- Add UserRestoreType form with password validation
- Add restore.html.twig template with warning banner and password strength
- Show restore button on user index and show pages for deleted users
- Display recovery token prominently on show page after restore
- Add USER_RESTORED event constant and dispatch from UserRestoreService
- Subscribe WelcomeMailListener to USER_RESTORED
- Add EN/DE translations with admin-context recovery token wording
- Add 7 Behat scenarios covering restore flow and authorization
- Update unit tests for event and listener changes

Co-Authored-By: OpenCode <noreply@opencode.ai>
@0x46616c6b 0x46616c6b force-pushed the feature/admin-restore-user branch from 2c52911 to 99ca576 Compare April 18, 2026 08:59
@0x46616c6b 0x46616c6b marked this pull request as ready for review April 18, 2026 09:03
@sonarqubecloud
Copy link
Copy Markdown

@0x46616c6b 0x46616c6b merged commit d526c6e into main Apr 18, 2026
10 checks passed
@0x46616c6b 0x46616c6b deleted the feature/admin-restore-user branch April 18, 2026 12:35
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.

1 participant