Skip to content

feat(admin): allow admins to confirm users and set passwords#834

Merged
markets merged 4 commits intocoopdevs:developfrom
rewritten:feature/admin-confirm-users
Apr 7, 2026
Merged

feat(admin): allow admins to confirm users and set passwords#834
markets merged 4 commits intocoopdevs:developfrom
rewritten:feature/admin-confirm-users

Conversation

@rewritten
Copy link
Copy Markdown
Contributor

Summary

Closes #821

  • New user form: adds optional Password / Password confirmation fields and a Confirm immediately checkbox β€” when checked, the user is created already confirmed without needing a working SMTP setup
  • Show page: adds a "Confirm user" action button that appears only for unconfirmed users, allowing admins to confirm them at any time via a PUT /admin/users/:id/confirm action
  • User index: shows confirmed_at column so confirmation status is visible at a glance
  • All 8 locales updated with the new keys

Test plan

  • Create a new user via admin without checking "Confirm immediately" β€” user should be unconfirmed, "Confirm user" button should appear on their show page
  • Create a new user with "Confirm immediately" checked β€” confirmed_at should be set, no confirmation email required
  • Create a new user with a password set β€” user should be able to log in with that password
  • Click "Confirm user" on an unconfirmed user's show page β€” confirmed_at should be set and the button should disappear
  • Edit an existing user leaving password blank β€” password should not be changed
  • Edit an existing user with a new password β€” password should be updated

πŸ€– Generated with Claude Code

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>
Copilot AI review requested due to automatic review settings March 26, 2026 13:24
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_at in 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.

Comment on lines +27 to +30
member_action :confirm, method: :put do
resource.confirm!
redirect_to admin_user_path(resource), notice: I18n.t("active_admin.users.confirmed_notice")
end
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@decentral1se
Copy link
Copy Markdown
Collaborator

decentral1se commented Mar 30, 2026

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 πŸŽ‰

@decentral1se
Copy link
Copy Markdown
Collaborator

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.

@sseerrggii
Copy link
Copy Markdown
Contributor

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

https://staging.timeoverflow.org/admin/users/22/confirm

@rewritten
Copy link
Copy Markdown
Contributor Author

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.

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

@markets
Copy link
Copy Markdown
Collaborator

markets commented Apr 6, 2026

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>
@sseerrggii
Copy link
Copy Markdown
Contributor

Now it works fine! Thanks @rewritten

βœ”οΈ

@markets markets merged commit eea06a5 into coopdevs:develop Apr 7, 2026
2 checks passed
@markets
Copy link
Copy Markdown
Collaborator

markets commented Apr 7, 2026

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

@decentral1se
Copy link
Copy Markdown
Collaborator

I ran on the develop branch:

➜ timeoverflow develop βœ“ wti push
# Pushing files on TimeOverflow
 config/locales/en.yml                              | b36db3a..3793ea9  Accepted

wti diff did report 3 missing keys. I hope that was what you intended!

@markets
Copy link
Copy Markdown
Collaborator

markets commented Apr 7, 2026

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

 wti push -l "es ca eu gl en pt-BR fr ja nl-NL"

I think the best (less dangerous) workflow is to update stuff always in the web UI and just use the wti pull to sync.

@decentral1se
Copy link
Copy Markdown
Collaborator

Thanks @markets! I will only use the web UI / wti pull from now on.

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.

Creation of new user via admin panel

5 participants