diff options
author | Daniel Schadt <kingdread@gmx.de> | 2023-09-14 19:51:00 +0200 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2023-09-14 19:51:00 +0200 |
commit | 8b270902c1444a1faa9efc0866b6c84a510578f2 (patch) | |
tree | 4341cc04975b1ef6a13a7258a5a08ce10448e9e7 | |
parent | dd6dbca51d46200073a9c6e16dcd0052795b80b8 (diff) | |
download | fietsboek-8b270902c1444a1faa9efc0866b6c84a510578f2.tar.gz fietsboek-8b270902c1444a1faa9efc0866b6c84a510578f2.tar.bz2 fietsboek-8b270902c1444a1faa9efc0866b6c84a510578f2.zip |
fix password changing form
-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")) |