Bugfies password validation from testrun

This commit is contained in:
Ozzieisaacs
2022-06-16 14:16:00 +02:00
parent 04326af2da
commit 4ef8c35fb7
5 changed files with 26 additions and 24 deletions

View File

@@ -1848,8 +1848,8 @@ def _handle_new_user(to_save, content, languages, translations, kobo_support):
content.sidebar_view |= constants.DETAIL_RANDOM
content.role = constants.selected_roles(to_save)
content.password = generate_password_hash(to_save["password"])
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!"))
@@ -1936,8 +1936,8 @@ 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 to_save.get("password"):
content.password = generate_password_hash(to_save["password"])
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: