Skip to content

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

Open
rewritten wants to merge 2 commits intocoopdevs:developfrom
rewritten:feature/admin-confirm-users
Open

feat(admin): allow admins to confirm users and set passwords#834
rewritten wants to merge 2 commits intocoopdevs:developfrom
rewritten:feature/admin-confirm-users

Conversation

@rewritten
Copy link
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

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

2 participants