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 + +
+ ERROR +
+ + + + - + -
TestEbookConvertCalibre - test_convert_deactivate
+
TestEbookConvertCalibre - test_calibre_log
+ + +
+ ERROR +
+ + + - PASS - + -
TestEbookConvertCalibre - test_convert_email
+
TestEbookConvertCalibre - test_convert_deactivate
- FAIL + ERROR
- @@ -559,37 +867,88 @@ selenium.common.exceptions.NoSuchElementException: Message: Could not locate ele - - -
TestEbookConvertCalibre - test_convert_only
- - PASS - - - - - + -
TestEbookConvertCalibre - test_convert_options
+
TestEbookConvertCalibre - test_convert_email
- FAIL + ERROR
-