Skip to content

Commit

Permalink
Plus de déconnexion après modification du mot de passe (#6424)
Browse files Browse the repository at this point in the history
  • Loading branch information
Situphen authored Dec 5, 2022
1 parent e2633f1 commit a40bc42
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions zds/member/views/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from django.conf import settings
from django.contrib import messages
from django.contrib.auth import update_session_auth_hash
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.core.exceptions import PermissionDenied
Expand Down Expand Up @@ -385,6 +386,8 @@ def get_form(self, form_class=ChangePasswordForm):

def update_profile(self, profile, form):
profile.user.set_password(form.data["password_new"])
# to avoid being disconnected after changing the password:
update_session_auth_hash(self.request, profile.user)

def get_success_message(self):
return _("Le mot de passe a correctement été mis à jour.")
Expand Down

0 comments on commit a40bc42

Please sign in to comment.