Added some log
This commit is contained in:
parent
8c57d0e334
commit
006145dbf6
1 changed files with 10 additions and 2 deletions
|
@ -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):
|
||||||
|
|
Reference in a new issue