Implement login form in template and add support for flash messages via a toast.

This commit is contained in:
Patrick Jentsch 2019-07-08 09:05:59 +02:00
parent b6a67fcd4d
commit 3b04addc17
2 changed files with 10 additions and 7 deletions

View File

@ -21,19 +21,20 @@
<div class="card medium"> <div class="card medium">
<div class="card-content"> <div class="card-content">
<span class="card-title">Log In</span> <span class="card-title">Log In</span>
<form> <form method="POST">
{{ form.hidden_tag() }}
<div class="input-field"> <div class="input-field">
<input id="username" type="text" class="validate"> {{ form.email(class='validate', type='email') }}
<label for="username">Username</label> {{ form.email.label }}
</div> </div>
<div class="input-field"> <div class="input-field">
<input id="password" type="password" class="validate"> {{ form.password(class='validate') }}
<label for="password">Password</label> {{ form.password.label }}
</div> </div>
<a href="#!">Forgot Password?</a> <a href="#!">Forgot Password?</a>
<br><br> <br><br>
<div class="card-action"> <div class="card-action">
<input class="btn right" type="submit" value="Log In" data-_extension-text-contrast=""> {{ form.submit(class='btn right') }}
</div> </div>
</form> </form>
</div> </div>

View File

@ -93,7 +93,6 @@
</div> </div>
</footer> </footer>
<!--JavaScript at end of body for optimized loading-->
<script type="text/javascript" src="{{ url_for('static', filename='js/materialize.min.js') }}"></script> <script type="text/javascript" src="{{ url_for('static', filename='js/materialize.min.js') }}"></script>
<script> <script>
M.AutoInit(); M.AutoInit();
@ -105,6 +104,9 @@
document.getElementById("nav-settings"), document.getElementById("nav-settings"),
{"alignment": "right", "constrainWidth": false, "coverTrigger": false} {"alignment": "right", "constrainWidth": false, "coverTrigger": false}
); );
{% for message in get_flashed_messages() %}
M.toast({html: '{{ message }}'})
{% endfor %}
</script> </script>
</body> </body>
</html> </html>