Add login and register templates and routes

This commit is contained in:
Stephan Porada 2019-07-04 15:17:51 +02:00
parent e127e1e5c4
commit fed711d23b
5 changed files with 96 additions and 0 deletions

View File

@ -11,4 +11,7 @@ def create_app(config_name):
def index(): def index():
return render_template('base.html.j2') return render_template('base.html.j2')
from .auth import auth as auth_blueprint
app.register_blueprint(auth_blueprint, url_prefix='/auth')
return app return app

View File

@ -0,0 +1,5 @@
from flask import Blueprint
auth = Blueprint('auth', __name__)
from . import views

View File

@ -0,0 +1,12 @@
from flask import render_template
from . import auth
@auth.route('/login', methods=['GET', 'POST'])
def login():
return render_template('auth/login.html.j2')
@auth.route('/register', methods=['GET', 'POST'])
def register():
return render_template('auth/register.html.j2')

View File

@ -0,0 +1,41 @@
{% extends "base.html.j2" %}
{% block page_content %}
<div class="col s12 m6">
<div class="card medium">
<div class="card-image">
<img src="{{ url_for('static', filename='images/favicon.png') }}" alt="">
<span class="card-title grey-text text-darken-4">Welcome to Opaque!</span>
</div>
<div class="card-content">
<p>Sign in into an exisiting account or register a new one!</p>
<br/>
<div class="card-action">
<a class="btn" href="{{url_for('auth.register')}}">Register</a>
</div>
</div>
</div>
</div>
<div class="col s12 m6">
<div class="card medium">
<div class="card-content">
<span class="card-title">Log In</span>
<form>
<div class="input-field">
<input id="username" type="text" class="validate">
<label for="username">Username</label>
</div>
<div class="input-field">
<input id="password" type="password" class="validate">
<label for="password">Password</label>
</div>
<a href="#!">Forgot Password?</a>
<br><br>
<div class="card-action">
<input class="btn right" type="submit" value="Log In" data-_extension-text-contrast="">
</div>
</form>
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,35 @@
{% extends "base.html.j2" %}
{% block page_content %}
<div class="col s12">
<div class="row">
<div class="card medium">
<div class="card-content">
<span class="card-title">Register</span>
<form>
<div class="input-field col s6">
<input id="first-name" type="text" class="validate">
<label for="first-name">First Name</label>
</div>
<div class="input-field col s6">
<input id="last-name" type="text" class="validate">
<label for="last-name">Last Name</label>
</div>
<div class="row">
<div class="input-field col s12">
<input id="password" type="password" class="validate">
<label for="password">Password</label>
</div>
</div>
<div class="row">
<div class="input-field col s12">
<input id="email" type="email" class="validate">
<label for="email">Email</label>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
{% endblock %}