X-Git-Url: https://git.mdrn.pl/cas.git/blobdiff_plain/7e61a123a0b4b5f6641cb791f76cda92369dca4b..e01cec52e391ee93340d8b0884f9c046e6ad4144:/src/accounts/views.py diff --git a/src/accounts/views.py b/src/accounts/views.py index a501b97..9a95608 100644 --- a/src/accounts/views.py +++ b/src/accounts/views.py @@ -1,9 +1,10 @@ # Create your views here. from django import http from django.contrib.auth.decorators import login_required +from django.contrib.auth import update_session_auth_hash from django.contrib import messages from django.shortcuts import render -from django.utils.translation import ugettext as __ +from django.utils.translation import ugettext as _ from django.views.decorators.http import require_POST from accounts.forms import UserBasicForm, UserPasswordForm from .models import Service @@ -24,7 +25,7 @@ def account_change_basic_profile(request): if form.is_valid(): form.save() - messages.add_message(request, messages.INFO, __("Profile has been changed.")) + messages.add_message(request, messages.INFO, _("Profile has been changed.")) return http.HttpResponseRedirect('/accounts/') return account_profile(request, basic_form=form) @@ -37,8 +38,9 @@ def account_change_password(request): if form.is_valid(): request.user.set_password(form.cleaned_data['new_password']) request.user.save() + update_session_auth_hash(request, request.user) - messages.add_message(request, messages.INFO, __("Password has been changed.")) + messages.add_message(request, messages.INFO, _("Password has been changed.")) return http.HttpResponseRedirect('/accounts/') return account_profile(request, pass_form=form)