From 0f8c30897318b3b460e556ce6560e444c7b14864 Mon Sep 17 00:00:00 2001 From: Cervinko Cera Date: Mon, 8 Aug 2016 21:01:38 +0200 Subject: [PATCH] Fix for deleting kindle mail adresee #54 --- cps/templates/user_edit.html | 2 +- cps/web.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cps/templates/user_edit.html b/cps/templates/user_edit.html index 4775af1a..c08d8437 100644 --- a/cps/templates/user_edit.html +++ b/cps/templates/user_edit.html @@ -21,7 +21,7 @@ {% endif %}
- +
{% if g.user and g.user.role_admin() and not profile %}
diff --git a/cps/web.py b/cps/web.py index 618b3e68..0096b1a5 100755 --- a/cps/web.py +++ b/cps/web.py @@ -749,7 +749,7 @@ def profile(): if current_user.role_passwd() or current_user.role_admin(): if to_save["password"]: content.password = generate_password_hash(to_save["password"]) - if to_save["kindle_mail"] and to_save["kindle_mail"] != content.kindle_mail: + if "kindle_mail" in to_save and to_save["kindle_mail"] != content.kindle_mail: content.kindle_mail = to_save["kindle_mail"] if to_save["email"] and to_save["email"] != content.email: content.email = to_save["email"] @@ -870,10 +870,13 @@ def edit_user(user_id): elif not "passwd_role" in to_save and content.role_passwd(): content.role = content.role - ub.ROLE_PASSWD + print content.role + if to_save["email"] and to_save["email"] != content.email: content.email = to_save["email"] - if to_save["kindle_mail"] and to_save["kindle_mail"] != content.kindle_mail: + if "kindle_mail" in to_save and to_save["kindle_mail"] != content.kindle_mail: content.kindle_mail = to_save["kindle_mail"] + try: ub.session.commit() flash("User '%s' updated" % content.nickname, category="success")