1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-12-25 17:40:31 +00:00

Fix show edit user after exception

This commit is contained in:
Ozzie Isaacs 2021-07-23 20:12:37 +02:00
parent 9a8c342e61
commit 56cd62ed90

View File

@ -1580,7 +1580,7 @@ def logout():
# ################################### Users own configuration ######################################################### # ################################### Users own configuration #########################################################
def change_profile(kobo_support, local_oauth_check, oauth_status): def change_profile(kobo_support, local_oauth_check, oauth_status, translations, languages):
to_save = request.form.to_dict() to_save = request.form.to_dict()
current_user.random_books = 0 current_user.random_books = 0
if current_user.role_passwd() or current_user.role_admin(): if current_user.role_passwd() or current_user.role_admin():
@ -1592,8 +1592,6 @@ def change_profile(kobo_support, local_oauth_check, oauth_status):
if to_save.get("email", current_user.email) != current_user.email: if to_save.get("email", current_user.email) != current_user.email:
current_user.email = check_email(to_save["email"]) current_user.email = check_email(to_save["email"])
if current_user.role_admin(): if current_user.role_admin():
if to_save.get("allowed_tags", current_user.allowed_tags) != current_user.allowed_tags:
current_user.allowed_tags = to_save["allowed_tags"].strip()
if to_save.get("name", current_user.name) != current_user.name: if to_save.get("name", current_user.name) != current_user.name:
# Query User name, if not existing, change # Query User name, if not existing, change
current_user.name = check_username(to_save["name"]) current_user.name = check_username(to_save["name"])
@ -1606,10 +1604,16 @@ def change_profile(kobo_support, local_oauth_check, oauth_status):
except Exception as ex: except Exception as ex:
flash(str(ex), category="error") flash(str(ex), category="error")
return render_title_template("user_edit.html", content=current_user, return render_title_template("user_edit.html",
title=_(u"%(name)s's profile", name=current_user.name), page="me", content=current_user,
translations=translations,
profile=1,
languages=languages,
title=_(u"%(name)s's profile", name=current_user.name),
page="me",
kobo_support=kobo_support, kobo_support=kobo_support,
registered_oauth=local_oauth_check, oauth_status=oauth_status) registered_oauth=local_oauth_check,
oauth_status=oauth_status)
val = 0 val = 0
for key, __ in to_save.items(): for key, __ in to_save.items():
@ -1647,7 +1651,7 @@ def profile():
local_oauth_check = {} local_oauth_check = {}
if request.method == "POST": if request.method == "POST":
change_profile(kobo_support, local_oauth_check, oauth_status) change_profile(kobo_support, local_oauth_check, oauth_status, translations, languages)
return render_title_template("user_edit.html", return render_title_template("user_edit.html",
translations=translations, translations=translations,
profile=1, profile=1,