-
Notifications
You must be signed in to change notification settings - Fork 21
Allow users to update their own password #320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I'm definitely missing a key part to run e2e tests because mine is continuously getting skipped:
Yet my test is not executed at all |
Patches were squashed and force-pushed because |
I was missing scope definition, sorry for the noise 🦆 |
More fixups will probably come with the review, I'll postpone squashing them until the comment threads are resolved. |
Here's a list of tests this (or next) PR should probably include to cover this feature better:
Please let me know which test cases I missed on the list. |
authenticated = await auth.authenticate_user( | ||
username, current_password.password.get_secret_value()) | ||
if not authenticated: | ||
raise HTTPException( | ||
status_code=status.HTTP_401_UNAUTHORIZED, | ||
detail="Incorrect username or password", | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good atm. Just thinking if we can use dependency injection for the authentication here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add myself a TODO for this. Could that injection be also reused in the /token
endpoint (that's where I first saw this flow)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we can also optimize /token
with that.
The test looks good to me. |
@JenySadadia Thanks for the pointer to the linter annotations! I reformatted new e2e tests file with a
I'll squash all the fixups and force push this branch unless more changes are requested. |
Yes, feel free to use it as it's a powerful tool. However I wouldn't recommend making it a requirement as it can cause a lot of churn, and some text editors and personal taste can induce small variants of style that are perfectly acceptable so I would rather leave the checks with just |
I just confirmed that - |
This patch adds initial implementation of endpoint POST `/password` to allow users to update their own password. The user can update password to any requested string, additional checks will follow. Signed-off-by: Paweł Wieczorek <pawiecz@collabora.com>
Add a test for changing regular user's password from API. The test depends on regular user creation test i.e. 'test_create_regular_user. Signed-off-by: Paweł Wieczorek <pawiecz@collabora.com>
This PR is an initial implementation of a feature requested as #298. It is still missing method in the
kernelci.api
base class, command forkci user
as well as proper unit and e2e tests.Fixes #298