feat(admin): allow admins to confirm users and set passwords#834
feat(admin): allow admins to confirm users and set passwords#834markets merged 4 commits intocoopdevs:developfrom
Conversation
Admins can now create users that are already confirmed (bypassing email confirmation) and optionally set a password at creation time. Existing unconfirmed users can be confirmed via a dedicated action button on their show page. Confirmed-at timestamp is also shown in the user index. Closes coopdevs#821 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds admin-side controls to confirm users and optionally set passwords at creation time, reducing reliance on SMTP for provisioning accounts (Issue #821).
Changes:
- Adds an admin βConfirm userβ action and shows
confirmed_atin the admin users index. - Extends the ActiveAdmin user form to optionally set password/password confirmation and βConfirm immediatelyβ on create.
- Updates all locales with new i18n keys for the added admin UI.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| config/locales/pt-BR.yml | Adds i18n keys for confirm actions and βconfirm immediatelyβ. |
| config/locales/ja.yml | Adds i18n keys for confirm actions and βconfirm immediatelyβ. |
| config/locales/gl.yml | Adds i18n keys for confirm actions and βconfirm immediatelyβ. |
| config/locales/fr.yml | Adds i18n keys for confirm actions and βconfirm immediatelyβ. |
| config/locales/eu.yml | Adds i18n keys for confirm actions and βconfirm immediatelyβ. |
| config/locales/es.yml | Adds i18n keys for confirm actions and βconfirm immediatelyβ. |
| config/locales/en.yml | Adds i18n keys for confirm actions and βconfirm immediatelyβ. |
| config/locales/ca.yml | Adds i18n keys for confirm actions and βconfirm immediatelyβ. |
| app/models/user.rb | Introduces confirm_immediately virtual attribute used during admin create. |
| app/admin/user.rb | Adds confirm member action, confirmed_at column, password fields, and create/update overrides for confirmation/password handling. |
π‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| member_action :confirm, method: :put do | ||
| resource.confirm! | ||
| redirect_to admin_user_path(resource), notice: I18n.t("active_admin.users.confirmed_notice") | ||
| end |
There was a problem hiding this comment.
New admin behaviors are introduced here (manual confirmation endpoint and the ability to set/retain passwords via the ActiveAdmin form/controller overrides) but there are no specs covering them. Adding request/controller specs around PUT /admin/users/:id/confirm, create with/without confirm_immediately, and update with blank vs non-blank password would help prevent regressions (especially around Devise confirmable).
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Thanks for much for undertaking this work π When this is merged, we will put it to good use basically immediately and begin testing it. We can deploy these changes for our testing phase coming up soon in April here in Rotterdam π |
|
Hey @rewritten, do you have a ETA for merging this change? And in general, when the list of fixes in #830 #831 #832 #833 will be merged? Thanks in advance. |
|
Testing at https://staging.timeoverflow.org Change user password works fine βοΈ But when I tried to confirm user I got an Error 500 response and the user doesn't seem to be confirmed |
Hey @decentral1se I do not have merge authorization on this repository, likey @sseerrggii or @markets can merge when it passes QA (which it does not at the momet...) |
|
Really happy to merge it after QA approves β π |
Replace Devise's `confirm` (which requires a pending token and triggers email callbacks) with `skip_confirmation!` + `save`, so the admin action directly sets confirmed_at without any email side-effects. Also updates specs to reflect the correct behaviour. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Now it works fine! Thanks @rewritten βοΈ |
|
@rewritten @sseerrggii Sorry ππΌ I already merged this one, but I just realized we missed to add the new translation keys in WTI. Could you please add these 3 new keys? |
|
I ran on the
|
|
@decentral1se I just fixed it (474b012), the problem was: you pushed only the target locale... Fortunately I have the most recent copy of each file in my local machine: I think the best (less dangerous) workflow is to update stuff always in the web UI and just use the |
|
Thanks @markets! I will only use the web UI / |
Summary
Closes #821
Password/Password confirmationfields and aConfirm immediatelycheckbox β when checked, the user is created already confirmed without needing a working SMTP setupPUT /admin/users/:id/confirmactionconfirmed_atcolumn so confirmation status is visible at a glanceTest plan
confirmed_atshould be set, no confirmation email requiredconfirmed_atshould be set and the button should disappearπ€ Generated with Claude Code