Improved errorhandling for resending password

Improved errorhandling for editing user
pull/1346/head
Ozzieisaacs 5 years ago
parent 000b85ff81
commit 832b34fc54

@ -817,6 +817,9 @@ def update_mailsettings():
@admin_required
def edit_user(user_id):
content = ub.session.query(ub.User).filter(ub.User.id == int(user_id)).first() # type: ub.User
if not content:
flash(_(u"User not found"), category="error")
return redirect(url_for('admin.admin'))
downloads = list()
languages = speaking_language()
translations = babel.list_translations() + [LC('en')]

@ -447,6 +447,8 @@ def delete_book_gdrive(book, book_format):
def reset_password(user_id):
existing_user = ub.session.query(ub.User).filter(ub.User.id == user_id).first()
if not existing_user:
return 0, None
password = generate_random_password()
existing_user.password = generate_password_hash(password)
if not config.get_mail_server_configured():

Loading…
Cancel
Save