From 6555d5869faa6581f54a5cc4f90833c036c4eaee Mon Sep 17 00:00:00 2001 From: ground7 Date: Fri, 27 Dec 2019 23:45:42 -0700 Subject: [PATCH] attempt regular login if ldap login fails as fallback --- cps/web.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cps/web.py b/cps/web.py index e55cfc7d..f1351a55 100644 --- a/cps/web.py +++ b/cps/web.py @@ -1155,7 +1155,11 @@ def login(): flash(_(u"you are now logged in as: '%(nickname)s'", nickname=user.nickname), category="success") 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") else: ipAdress = request.headers.get('X-Forwarded-For', request.remote_addr)