1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-11-28 04:19:59 +00:00

For failed logins the source ip-adress is logged now ( #201)

This commit is contained in:
OzzieIsaacs 2017-06-07 18:08:15 +02:00
parent e6c6c26fd1
commit 4ea9df753e

View File

@ -1806,10 +1806,10 @@ def login():
if user and check_password_hash(user.password, form['password']): if user and check_password_hash(user.password, form['password']):
login_user(user, remember=True) login_user(user, remember=True)
flash(_(u"you are now logged in as: '%(nickname)s'", nickname=user.nickname), category="success") flash(_(u"you are now logged in as: '%(nickname)s'", nickname=user.nickname), category="success")
# test=
return redirect(url_for("index")) return redirect(url_for("index"))
else: else:
app.logger.info('Login failed for user "'+form['username']+'"') ipAdress=request.headers.get('X-Forwarded-For', request.remote_addr)
app.logger.info('Login failed for user "' + form['username'] + '" IP-adress: ' + ipAdress)
flash(_(u"Wrong Username or Password"), category="error") flash(_(u"Wrong Username or Password"), category="error")
return render_title_template('login.html', title=_(u"login")) return render_title_template('login.html', title=_(u"login"))