1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-12-25 01:20:32 +00:00

Improved errorhandling for resending password

Improved errorhandling for editing user
This commit is contained in:
Ozzieisaacs 2020-05-01 12:00:45 +02:00
parent 000b85ff81
commit 832b34fc54
2 changed files with 5 additions and 0 deletions

View File

@ -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')]

View File

@ -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():