Add more logging

This commit is contained in:
Tim Van Baak 2021-02-18 19:17:43 -08:00
parent 6a92249ca2
commit 6b72bc499a
2 changed files with 13 additions and 5 deletions

View File

@ -105,9 +105,17 @@ def document(document_id):
@app.route('/login/', methods=['GET', 'POST'])
def login():
form = LoginForm()
if form.validate_on_submit() and check_password(current_app, form.password.data):
login_user(Admin())
return redirect(url_for('index'))
s = form.is_submitted()
logger.debug(f's={s}')
if s:
logger.debug(form.password.data)
v = form.validate()
logger.debug(f'v={v}')
if v:
valid = check_password(current_app, form.password.data)
if valid:
login_user(Admin())
return redirect(url_for('index'))
return render_template('login.jinja', form=form)
@ -233,5 +241,5 @@ def wsgi():
config_path = os.environ.get(CONFIG_ENVVAR) or '/etc/redstring.conf'
config = read_config(app, config_path)
logger.setLevel(logging.DEBUG)
logger.debug(f'Loaded config from {config_path}: {config}')
logger.debug(f'Lloaded config from {config_path}: {config}')
return app

View File

@ -8,7 +8,7 @@
<div id="index" class="tab tab-right"><a href="/index/">index</a></div>
</div>
<div class="tab-page tab-page-selected">
<form action="" method="post" novalidate>
<form method="post" novalidate>
{{ form.hidden_tag() }}
<p>{{ form.password.label }}<br>{{ form.password(size=32) }}
{% for error in form.password.errors %}