Added some log

This commit is contained in:
Edgar P. Burkhart 2022-01-28 13:20:08 +01:00
parent 8c57d0e334
commit 006145dbf6
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227

View file

@ -1,9 +1,12 @@
import logging
import flask import flask
from datetime import date, datetime
from ..calendar import get_events from ..calendar import get_events
log = logging.getLogger('saturn-server')
def create_app( def create_app(
secret_key, secret_key,
password, password,
@ -17,7 +20,12 @@ def create_app(
if flask.request.method == 'POST': if flask.request.method == 'POST':
if flask.request.form.get('password') == password: if flask.request.form.get('password') == password:
flask.session['logged'] = True flask.session['logged'] = True
else: flask.session['failed'] = True log.info(f'Successful login from '
f'({flask.request.remote_addr})')
else:
flask.session['failed'] = True
log.warn(f'Failed login from '
f'({flask.request.remote_addr})')
return flask.redirect(flask.url_for('home')) return flask.redirect(flask.url_for('home'))
if flask.session.get('logged', False): if flask.session.get('logged', False):