From 29fd4ae4a276e154f4f934934899d3dc3274d9a1 Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Fri, 17 Jun 2022 10:14:33 +0200 Subject: [PATCH] Bugfixes create users Update Teststatus --- cps/admin.py | 6 +- cps/web.py | 4 +- setup.cfg | 2 +- test/Calibre-Web TestSummary_Linux.html | 11458 +++++++++++++++++----- 4 files changed, 9170 insertions(+), 2300 deletions(-) diff --git a/cps/admin.py b/cps/admin.py index 85ea112f..27d17a1d 100755 --- a/cps/admin.py +++ b/cps/admin.py @@ -1849,10 +1849,10 @@ def _handle_new_user(to_save, content, languages, translations, kobo_support): content.role = constants.selected_roles(to_save) try: - content.password = generate_password_hash(helper.valid_password(to_save["password"])) if not to_save["name"] or not to_save["email"] or not to_save["password"]: log.info("Missing entries on new user") raise Exception(_(u"Please fill out all fields!")) + content.password = generate_password_hash(helper.valid_password(to_save.get("password", ""))) content.email = check_email(to_save["email"]) # Query username, if not existing, change content.name = check_username(to_save["name"]) @@ -1936,8 +1936,6 @@ def _handle_edit_user(to_save, content, languages, translations, kobo_support): log.warning("No admin user remaining, can't remove admin role from {}".format(content.name)) flash(_("No admin user remaining, can't remove admin role"), category="error") return redirect(url_for('admin.admin')) - if 'password' in to_save: - content.password = generate_password_hash(helper.valid_password(to_save('password'))) anonymous = content.is_anonymous content.role = constants.selected_roles(to_save) if anonymous: @@ -1971,6 +1969,8 @@ def _handle_edit_user(to_save, content, languages, translations, kobo_support): if to_save.get("locale"): content.locale = to_save["locale"] try: + if to_save.get('password', "") != "": + content.password = generate_password_hash(helper.valid_password(to_save['password'])) if to_save.get("email", content.email) != content.email: content.email = check_email(to_save["email"]) # Query username, if not existing, change diff --git a/cps/web.py b/cps/web.py index 58921bfe..a623a652 100755 --- a/cps/web.py +++ b/cps/web.py @@ -1358,8 +1358,8 @@ def change_profile(kobo_support, local_oauth_check, oauth_status, translations, current_user.random_books = 0 try: if current_user.role_passwd() or current_user.role_admin(): - if 'password' in to_save: - current_user.password = generate_password_hash(valid_password(to_save('password'))) + if to_save.get('password', "") != "": + current_user.password = generate_password_hash(valid_password(to_save['password'])) if to_save.get("kindle_mail", current_user.kindle_mail) != current_user.kindle_mail: current_user.kindle_mail = valid_email(to_save.get("kindle_mail")) if to_save.get("email", current_user.email) != current_user.email: diff --git a/setup.cfg b/setup.cfg index 92e64f6a..c24dfc97 100644 --- a/setup.cfg +++ b/setup.cfg @@ -97,5 +97,5 @@ comics = natsort>=2.2.0,<8.2.0 comicapi>=2.2.0,<2.3.0 kobo = - jsonschema>=3.2.0,<4.6.0 + jsonschema>=3.2.0,<4.7.0 diff --git a/test/Calibre-Web TestSummary_Linux.html b/test/Calibre-Web TestSummary_Linux.html index 8953c08c..f12ab46f 100644 --- a/test/Calibre-Web TestSummary_Linux.html +++ b/test/Calibre-Web TestSummary_Linux.html @@ -37,20 +37,20 @@
-

Start Time: 2022-06-05 22:14:00

+

Start Time: 2022-06-16 20:34:19

-

Stop Time: 2022-06-06 04:06:43

+

Stop Time: 2022-06-17 01:15:22

-

Duration: 4h 57 min

+

Duration: 3h 51 min

@@ -467,58 +467,300 @@ TestEbookConvertCalibre - 15 - 11 - 3 - 1 + 30 + 0 + 0 + 30 0 - Detail + Detail - +
TestEbookConvertCalibre - test_calibre_log
- PASS - - - - - - -
TestEbookConvertCalibre - test_convert_deactivate
- - PASS - - - - - - -
TestEbookConvertCalibre - test_convert_email
-
- FAIL + ERROR
- @@ -559,37 +867,652 @@ selenium.common.exceptions.NoSuchElementException: Message: Could not locate ele - + -
TestEbookConvertCalibre - test_convert_only
+
TestEbookConvertCalibre - test_convert_email
+ + +
+ ERROR +
+ + + - PASS - + + +
TestEbookConvertCalibre - test_convert_email
+ + +
+ ERROR +
+ + + + + + + + + + +
TestEbookConvertCalibre - test_convert_failed_and_email
+ + +
+ ERROR +
+ + + + + + + + + + +
TestEbookConvertCalibre - test_convert_failed_and_email
+ + +
+ ERROR +
+ + + + + + + + + + +
TestEbookConvertCalibre - test_convert_only
+ + +
+ ERROR +
+ + + + + + + + + + +
TestEbookConvertCalibre - test_convert_only
+ + +
+ ERROR +
+ + + + + + + + +
TestEbookConvertCalibre - test_convert_options
- FAIL + ERROR
-