diff options
-rw-r--r-- | fietsboek/views/user_data.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/fietsboek/views/user_data.py b/fietsboek/views/user_data.py index a7680e4..45c499c 100644 --- a/fietsboek/views/user_data.py +++ b/fietsboek/views/user_data.py @@ -48,16 +48,19 @@ def do_change_profile(request): :rtype: pyramid.response.Response """ password = request.params["password"] + # Save the identity as request.identity will be None after changing the + # password. + identity = request.identity if password: try: util.check_password_constraints(password, request.params["repeat-password"]) except ValueError as exc: request.session.flash(request.localizer.translate(exc.args[0])) return HTTPFound(request.route_url("user-data")) - request.identity.set_password(request.params["password"]) + identity.set_password(request.params["password"]) name = request.params["name"] - if request.identity.name != name: - request.identity.name = name + if identity.name != name: + identity.name = name request.session.flash(request.localizer.translate(_("flash.personal_data_updated"))) return HTTPFound(request.route_url("user-data")) |