mirror of
https://github.com/janeczku/calibre-web
synced 2024-11-28 12:30:00 +00:00
attempt regular login if ldap login fails as fallback
This commit is contained in:
parent
54c4f40188
commit
6555d5869f
@ -1155,7 +1155,11 @@ def login():
|
|||||||
flash(_(u"you are now logged in as: '%(nickname)s'", nickname=user.nickname),
|
flash(_(u"you are now logged in as: '%(nickname)s'", nickname=user.nickname),
|
||||||
category="success")
|
category="success")
|
||||||
return redirect_back(url_for("web.index"))
|
return redirect_back(url_for("web.index"))
|
||||||
if login_result is None:
|
elif user and check_password_hash(str(user.password), form['password']) and user.nickname != "Guest":
|
||||||
|
login_user(user, remember=True)
|
||||||
|
flash(_(u"You are now logged in as: '%(nickname)s'", nickname=user.nickname), category="success")
|
||||||
|
return redirect_back(url_for("web.index"))
|
||||||
|
elif login_result is None:
|
||||||
flash(_(u"Could not login. LDAP server down, please contact your administrator"), category="error")
|
flash(_(u"Could not login. LDAP server down, please contact your administrator"), category="error")
|
||||||
else:
|
else:
|
||||||
ipAdress = request.headers.get('X-Forwarded-For', request.remote_addr)
|
ipAdress = request.headers.get('X-Forwarded-For', request.remote_addr)
|
||||||
|
Loading…
Reference in New Issue
Block a user