Create user login view

This commit is contained in:
Santiago L 2021-12-27 09:15:06 +01:00
parent bf5c76cd04
commit a0509a23a4
2 changed files with 85 additions and 0 deletions

View file

@ -0,0 +1,77 @@
{% extends "ereuse_devicehub/base.html" %}
{% block body %}
<main>
<div class="container">
<section class="section register min-vh-100 d-flex flex-column align-items-center justify-content-center py-4">
<div class="container">
<div class="row justify-content-center">
<div class="col-lg-4 col-md-6 d-flex flex-column align-items-center justify-content-center">
<div class="d-flex justify-content-center py-4">
<a href="index.html" class="logo d-flex align-items-center w-auto">
<img src="{{ url_for('static', filename='img/logo.png') }}" alt="">
<span class="d-none d-lg-block">NiceAdmin</span>
</a>
</div><!-- End Logo -->
<div class="card mb-3">
<div class="card-body">
<div class="pt-4 pb-2">
<h5 class="card-title text-center pb-0 fs-4">Login to Your Account</h5>
<p class="text-center small">Enter your username & password to login</p>
</div>
<form class="row g-3 needs-validation" novalidate>
<div class="col-12">
<label for="yourUsername" class="form-label">Username</label>
<div class="input-group has-validation">
<span class="input-group-text" id="inputGroupPrepend">@</span>
<input type="text" name="username" class="form-control" id="yourUsername" required>
<div class="invalid-feedback">Please enter your username.</div>
</div>
</div>
<div class="col-12">
<label for="yourPassword" class="form-label">Password</label>
<input type="password" name="passwword" class="form-control" id="yourPassword" required>
<div class="invalid-feedback">Please enter your password!</div>
</div>
<div class="col-12">
<div class="form-check">
<input class="form-check-input" type="checkbox" name="remember" value="true" id="rememberMe">
<label class="form-check-label" for="rememberMe">Remember me</label>
</div>
</div>
<div class="col-12">
<button class="btn btn-primary w-100" type="submit">Login</button>
</div>
<div class="col-12">
<p class="small mb-0">Don't have account? <a href="#TODO">Create an account</a></p>
</div>
</form>
</div>
</div>
<div class="credits">
<!-- All the links in the footer should remain intact. -->
<!-- You can delete the links only if you purchased the pro version. -->
<!-- Licensing information: https://bootstrapmade.com/license/ -->
<!-- Purchase the pro version with working PHP/AJAX contact form: https://bootstrapmade.com/nice-admin-bootstrap-admin-html-template/ -->
Designed by <a href="https://bootstrapmade.com/">BootstrapMade</a>
</div>
</div>
</div>
</div>
</section>
</div>
</main><!-- End #main -->
{% endblock body %}

View file

@ -5,6 +5,13 @@ from flask.views import View
core = Blueprint('core', __name__)
class LoginView(View):
template_name = 'ereuse_devicehub/user_login.html'
def dispatch_request(self):
return render_template(self.template_name)
class UserProfileView(View):
template_name = 'ereuse_devicehub/user_profile.html'
@ -12,4 +19,5 @@ class UserProfileView(View):
return render_template(self.template_name)
core.add_url_rule('/login/', view_func=LoginView.as_view('login'))
core.add_url_rule('/profile/', view_func=UserProfileView.as_view('user-profile'))