Migrate app to use WTForms for auth form validation

- Not finished yet, major styling breakage in this commit
- Also encapsulated GET & POST requests of /login and /signup routes into one route.
This commit is contained in:
Xevion
2022-03-29 02:30:19 -05:00
parent 2e8688f59b
commit 3b5307ab47
11 changed files with 148 additions and 159 deletions

View File

@@ -1,4 +1,6 @@
{% extends 'layouts/index.html' %}
{% from 'macros.html' import render_field %}
{% block content %}
{% with messages = get_flashed_messages() %}
{% if messages %}
@@ -7,29 +9,14 @@
</span>
{% endif %}
{% endwith %}
<form method="POST" action="{{ url_for('auth.login_post') }}" class="login-form">
<div class="field">
<div class="control">
Username
<input class="input is-large" type="text" name="username" placeholder="Username" autofocus="true">
</div>
</div>
<form method="POST" action="{{ url_for('auth.login') }}" class="login-form">
{{ render_field(form.username) }}
{{ render_field(form.password) }}
{{ render_field(form.remember_me) }}
<p><input type=submit value=Login>
<div class="field">
<div class="control">
Password
<input class="input is-large" type="password" name="password" placeholder="Password">
</div>
</div>
<div class="field">
<label class="checkbox">
<input type="checkbox">
Remember me
</label>
</div>
<button class="button">Login</button>
</form>
<p class="form-subtext">
Don't have a login? <a href="{{ url_for('main.signup') }}">Sign-up</a> instead!
Don't have a login? <a href="{{ url_for('auth.signup') }}">Sign-up</a> instead!
</p>
{% endblock content %}