feat(auth): allow local account users to change their password#6609
Open
shahargl wants to merge 1 commit into
Open
feat(auth): allow local account users to change their password#6609shahargl wants to merge 1 commit into
shahargl wants to merge 1 commit into
Conversation
Local (DB) accounts previously had no way to change a password after
creation. This adds:
- Self-service `PUT /auth/users/me/password` endpoint that verifies the
current password before updating (works for any authenticated local
user, admin or noc).
- `DbIdentityManager.update_user` now supports password/role updates so
admins can reset a local user's password via `PUT /auth/users/{user}`.
- `update_user_password` DB helper.
- "Change Password" item in the user dropdown (DB auth only) with a modal.
- Optional password reset field for existing users in the admin sidebar.
Closes keephq#6608
Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #6608
Local (DB) accounts had no way to change their password after an admin created them. This PR adds self-service password changes for local users, plus an admin-side password reset.
PUT /auth/users/me/password— verifies the current password before updating, so any authenticated local user (admin or noc) can change their own password.DbIdentityManager.update_usernow supports password/role updates (previously raisedNotImplementedError), enabling admins to reset a local user's password viaPUT /auth/users/{username}.update_user_passwordDB helper added inkeep/api/core/db.py.AUTH_TYPE=DB) that opens a modal with current/new/confirm fields and client-side validation.For non-DB auth types the self-service endpoint returns
501(password is managed by the external IdP).Test plan
Backend (
tests/test_change_password.py):403422401PUT /auth/users/{username}Frontend (
keep-ui/components/navbar/__tests__/ChangePasswordModal.test.tsx):Run:
python -m pytest tests/test_change_password.pycd keep-ui && npm run test -- components/navbar/__tests__/ChangePasswordModal.test.tsxMade with Cursor