Skip to content

Allow admins to change user passwords #3766#19434

Open
sujanyd wants to merge 1 commit intoopenSUSE:masterfrom
sujanyd:master
Open

Allow admins to change user passwords #3766#19434
sujanyd wants to merge 1 commit intoopenSUSE:masterfrom
sujanyd:master

Conversation

@sujanyd
Copy link
Copy Markdown

@sujanyd sujanyd commented Mar 14, 2026

PR Description
Summary
This PR implements the ability for administrators to change the passwords of other users via the WebUI. Administrators can now see a "Change Password" button on any user's profile which allows them to update the password without needing the user's current password.

Key Changes
-> Route: Added PATCH /users/:login/change_password to allow admin-level password updates separate from the self-service POST route.
-> Controller: Updated Webui::UsersController#change_password to:
-> Skip current password authentication when the request is a PATCH (admin-only).
-> Enforce require_admin for the PATCH path.
-> Added change_password to the check_displayed_user filter group.
View:
-> Updated show.html.haml to render the password dialog for admins on other users' profiles.
-> Updated
_password_dialog.html.haml
to detect admin-changes, hide the "Current Password" field, and use the PATCH method.
-> Updated
_info.html.haml and _index_actions.html.haml to display the "Change Password" action for admins.
Specs: Added new test cases in users_controller_spec.rb to verify:
-> Admins can successfully change another user's password.
->Non-admins are denied access to the admin password change route.

Verification
Automated Tests: Ran bundle exec rspec spec/controllers/webui/users_controller_spec.rb (Syntax and logic verified).
Manual Verification: Verified the UI logic and conditional rendering of the password update form.

Relates to: #3766

@github-actions github-actions bot added the Frontend Things related to the OBS RoR app label Mar 14, 2026
@sujanyd sujanyd marked this pull request as ready for review March 15, 2026 03:29
@sujanyd sujanyd force-pushed the master branch 6 times, most recently from cf0b1c6 to 075162e Compare March 15, 2026 10:18
@sujanyd sujanyd marked this pull request as draft March 15, 2026 10:57
@sujanyd sujanyd marked this pull request as ready for review March 15, 2026 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Frontend Things related to the OBS RoR app

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant