Switch back to using form-based login/logout

I've decided I want this application to be a progressive enhancement
application. That means that I'm not going to keep dealing with the
insanity that is Javascript bundling and transpiling and building the
entire UI in JS. I want to believe I can treat the web the way that it's
been designed for decades - as a document platform with enhancement
capabilities rather than as an emerging VM
This commit is contained in:
Eli Ribble 2016-06-02 20:51:08 -06:00
parent 08814d6d9e
commit ff9829d4d2
4 changed files with 45 additions and 25 deletions

View file

@ -1,19 +1,7 @@
<html>
<body>
<div id="container"/>
{% if current_user and current_user.is_authenticated %}
<h1>Hello {{ current_user.name }} from Vanth</h1>
<form action="/logout/" method="POST">
<input type="submit">Log out</input>
</form>
{% else %}
<h1>Please log in</h1>
<form action="/login/" method="POST">
<label>username</label><input type="text" name="username"></input>
<label>password</label><input type="password" name="password"></input>
<input type="submit">Log in</input>
</form>
{% endif %}
<script src="build/bundle.js"></script>
</body>
</html>
{% extends 'layout.html' %}
{% block body %}
<h1>Hello {{ current_user.name }} from Vanth</h1>
<form action="/logout/" method="POST">
<input type="submit">Log out</input>
</form>
{% endblock %}

9
templates/layout.html Normal file
View file

@ -0,0 +1,9 @@
<html>
<body>
<div id="container">
{% block body %}
default stuff
{% endblock %}
</div>
</body>
</html>

9
templates/login.html Normal file
View file

@ -0,0 +1,9 @@
{% extends 'layout.html' %}
{% block body %}
<h1>Please log in</h1>
<form action="/login/" method="POST">
<label>username</label><input type="text" name="username"></input>
<label>password</label><input type="password" name="password"></input>
<input type="submit">Log in</input>
</form>
{% endblock %}