Skip to content
Snippets Groups Projects
Commit b1ce2197 authored by Valentin Rigal's avatar Valentin Rigal Committed by Erwan Rouchet
Browse files

Update session data when updating the password with UpdateUser

parent 01292766
No related branches found
No related tags found
1 merge request!2326Update session data when updating the password with UpdateUser
This commit is part of merge request !2326. Comments created here will be created in the context of that merge request.
from django.conf import settings
from django.contrib.auth import update_session_auth_hash
from django.contrib.auth.password_validation import validate_password
from django.contrib.auth.tokens import default_token_generator
from django.core.exceptions import ValidationError
......@@ -66,6 +67,7 @@ class UserSerializer(SimpleUserSerializer):
def update(self, instance, validated_data):
if "password" in validated_data:
instance.set_password(validated_data.pop("password"))
update_session_auth_hash(self.context["request"], instance)
return super().update(instance, validated_data)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment