-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Enable updating the password of a user. #107
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
@@ -24,6 +24,11 @@ def create(self, db_session: Session, *, obj_in: UserCreate) -> User: | |||
db_session.refresh(db_obj) | |||
return db_obj | |||
|
|||
def update(self, db_session: Session, *, db_obj: ModelType, obj_in: UpdateSchemaType) -> ModelType: | |||
if obj_in.password: | |||
db_obj.hashed_password = get_password_hash(obj_in.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.
I am not sure if this is the correct place to update the 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.
You probably want to use the reset_password
method in login.py
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.
You probably want to use the
reset_password
method in login.py
Shouldn't it be the other way around, e.g. the endpoint/login.py using CRUDUser?
I was about to open almost the same PR to fix #109. I've put a small diff in there that you might want to add to your PR to fix the test as well :) |
Thanks for your contribution! 🚀 I think this was solved/included in #106 , right? |
Yes, looks like it. 😅 |
Thanks for reporting back and closing it 👍 |
UserUpdate
does not have ahashed_password
.