feat(password): added a password reset page (and unused form), corrected the validation of the password changer, modified styles
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-12-06 17:47:05 +01:00
parent d5a8445df3
commit bcf50ff111
7 changed files with 118 additions and 48 deletions

View File

@@ -5,20 +5,20 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#13570F"/>
<meta name="description" content="Alexandre CHAZAL's LDAP interface">
<title>AlxCzl - LDAP Interface</title>
<title>AlxCzl - {% block title %}{% endblock title %}</title>
<link rel="apple-touch-icon" sizes="180x180" href="/static/images/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/static/images/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/static/images/favicon-16x16.png">
<link rel="preload" as="style" onload="this.onload=null;this.rel='stylesheet'" href="https://fonts.googleapis.com/css2?family=Roboto+Mono&display=swap">
<link rel="preload" as="style" onload="this.onload=null;this.rel='stylesheet'" href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<link rel="stylesheet" href="/static/css/main.css" crossorigin="anonymous" integrity="sha384-1mUptOXBpF6Jmz5VBNmsieaTKvJrMrSSLQNb/S1TJ7zYE1QS3fCuO3RZJQDSwBD6">
<link rel="stylesheet" href="/static/css/main.css" crossorigin="anonymous" integrity="sha384-f6kP6af7kWcMRKWq5svKPpNBoVoHZ1bg5xqzKbw8OjNcNUPm3VYQp8p//gjmWBfp">
</head>
<body>
<body class="container">
{% for message in get_flashed_messages() %}
<div class="flash">{{ message }}</div>
{% endfor %}
<main class="container vcenter">
{% block main_block %}{% endblock main_block %}
<main id="main-block" class="row h-100 align-items-center justify-content-center">
{% block main_block %}{% endblock main_block %}
</main>
{% block script_block %}{% endblock script_block %}
<script defer src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>

View File

@@ -1,48 +1,53 @@
{% extends 'base.html' %}
{% block title %}Password change{% endblock %}
{% block main_block %}
<div class="row col-md" id="change-form">
<div class="col-md-8" id="change-form">
<div class="col-md-auto">
<h1>Password change</h1>
<hr>
<form method="post">
{{ form.csrf_token() }}
<div class="form-group">
<div class="form-group mb-3">
{{ form.username.label }}
<div id="username-msg">
The username can contain at most 64 characters and cannot contain one of the following characters : [*?!'^+%&/()=}{$#;,\"
</div>
{{ form.username(class="form-control") }}
<small class="form-text" id="username-msg">
The username can contain at most 64 characters and cannot contain one of the following characters :
[*?!'^+%&/()=}{$#;,\"
</small>
</div>
<div class="form-group">
<div class="form-group mb-3">
{{ form.currentpassword.label }}
{{ form.currentpassword(class="form-control") }}
</div>
<div class="form-group">
<div class="form-group mb-3">
{{ form.newpassword.label }}
<div id="password-msg">
The new password should contain at least :
{{ form.newpassword(class="form-control") }}
<small class="form-text" id="password-msg">
The new password should at least contain the following:
<ul>
<li id="minlen">{{ form.minlength }} characters</li>
<li id="digit">1 numeric digit [0-9]</li>
<li id="lower">1 lowercase character [a-z]</li>
<li id="upper">1 uppercase character [A-Z]</li>
</ul>
</div>
{{ form.newpassword(class="form-control") }}
</small>
</div>
<div class="form-group">
<div class="form-group mb-3">
{{ form.confirm_password.label }}
<div id="confirm-msg">
Passwords must match
</div>
{{ form.confirm_password(class="form-control") }}
<small class="form-text" id="confirm-msg">
Passwords must match
</small>
</div>
<br>
<div class="form-group" style="text-align: center; margin-bottom: 0.40em" disabled=true>
{{ form.submit(class="btn btn-primary")}}
</div>
{{ form.submit(class="btn btn-primary")}}
<a class="btn btn-outline-danger" href="/password/reset">I forgot my password</a>
</form>
</div>
</div>
{% endblock main_block %}
{% block script_block %}
<script defer src="/static/js/validate.js"></script>
{% endblock script_block %}
{% endblock script_block %}

View File

@@ -0,0 +1,20 @@
{% extends 'base.html' %}
{% block title %}Password reset{% endblock %}
{% block main_block %}
<div class="col-md-8">
<div class="row col-md-auto">
<h1>Password reset</h1>
<hr>
<div class="alert alert-danger">Sorry, password self-reset isn't available on my intranet for security reasons.<br>
Just contact me and I'll send you a message containing a new password.
</div>
<a class="btn btn-outline-danger" href="/password/change">I just need to change it</a>
</div>
</div>
{% endblock main_block %}
{% block script_block %}
<script defer src="/static/js/validate.js"></script>
{% endblock script_block %}