|
|
@ -1098,19 +1098,15 @@ 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"))
|
|
|
|
except ldap.ldap.INVALID_CREDENTIALS as e:
|
|
|
|
except Exception as exception:
|
|
|
|
log.error('Login Error: ' + str(e))
|
|
|
|
app.logger.info('Login Error: ' + str(exception))
|
|
|
|
ipAdress = request.headers.get('X-Forwarded-For', request.remote_addr)
|
|
|
|
if str(exception) == 'Invalid credentials':
|
|
|
|
log.info('LDAP Login failed for user "%s" IP-adress: %s', form['username'], ipAdress)
|
|
|
|
ipAdress = request.headers.get('X-Forwarded-For', request.remote_addr)
|
|
|
|
flash(_(u"Wrong Username or Password"), category="error")
|
|
|
|
app.logger.info('LDAP Login failed for user "' + form['username'] + ', IP-address :' + ipAdress)
|
|
|
|
except ldap.ldap.SERVER_DOWN:
|
|
|
|
flash(_(u"Wrong Username or Password"), category="error")
|
|
|
|
log.info('LDAP Login failed, LDAP Server down')
|
|
|
|
if str(exception) == 'Server down':
|
|
|
|
flash(_(u"Could not login. LDAP server down, please contact your administrator"), category="error")
|
|
|
|
log.info('LDAP Login failed, LDAP Server down')
|
|
|
|
'''except LDAPException as exception:
|
|
|
|
flash(_(u"Could not login. LDAP server down, please contact your administrator"), category="error")
|
|
|
|
app.logger.error('Login Error: ' + str(exception))
|
|
|
|
|
|
|
|
ipAdress = request.headers.get('X-Forwarded-For', request.remote_addr)
|
|
|
|
|
|
|
|
app.logger.info('LDAP Login failed for user "' + form['username'] + ', IP-address :' + ipAdress)
|
|
|
|
|
|
|
|
flash(_(u"Wrong Username or Password"), category="error")'''
|
|
|
|
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
if user and check_password_hash(user.password, form['password']) and user.nickname is not "Guest":
|
|
|
|
if user and check_password_hash(user.password, form['password']) and user.nickname is not "Guest":
|
|
|
|
login_user(user, remember=True)
|
|
|
|
login_user(user, remember=True)
|
|
|
|