Refactor Site-Wide Data

This commit is contained in:
Chris Mann 2023-07-27 16:04:58 +02:00
parent 66e3615310
commit 76cc3fb3d5

View file

@ -4,21 +4,22 @@
{{end}} {{end}}
{{define "body"}} {{define "body"}}
<div class="d-flex">
<h2>Modifier mon mot de passe</h2>
</div>
{{if .Common.ErrorMessage}} <div class="d-flex">
<div class="alert alert-danger mt-4">Impossible d'effectuer la modification. <h2>Modifier mon mot de passe</h2>
</div>
{{if .Common.ErrorMessage}}
<div class="alert alert-danger mt-4">Impossible d'effectuer la modification.
<div style="font-size: 0.8em">{{ .Common.ErrorMessage }}</div> <div style="font-size: 0.8em">{{ .Common.ErrorMessage }}</div>
</div> </div>
{{end}} {{end}}
{{if .Common.Success}} {{if .Common.Success}}
<div class="alert alert-success mt-4"> <div class="alert alert-success mt-4">
Nouveau mot de passe enregistré. Nouveau mot de passe enregistré.
</div> </div>
{{else}} {{else}}
<form method="POST" class="mt-4" <form method="POST" class="mt-4"
onsubmit="javascript:var password = document.getElementById('password');var password2 = document.getElementById('password2'); if (password.value != password2.value) {alert('Les maux de passe ne sont pas identiques entre l\'initial et la confirmation.');return false;}; message = checkPasswordStrength(password.value); if (message) {alert(message);return false}else{return true;}"> onsubmit="javascript:var password = document.getElementById('password');var password2 = document.getElementById('password2'); if (password.value != password2.value) {alert('Les maux de passe ne sont pas identiques entre l\'initial et la confirmation.');return false;}; message = checkPasswordStrength(password.value); if (message) {alert(message);return false}else{return true;}">
<div class="form-group"> <div class="form-group">
<label for="password">Nouveau mot de passe :</label> <label for="password">Nouveau mot de passe :</label>
@ -39,9 +40,8 @@
</div> </div>
{{end}} {{end}}
<button type="submit" class="btn btn-primary">Changer de mot de passe</button> <button type="submit" class="btn btn-primary">Changer de mot de passe</button>
</form> </form>
{{end}} <script>
<script>
function checkPasswordStrength(password) { function checkPasswordStrength(password) {
// Initialize variables // Initialize variables
var strength = 0; var strength = 0;
@ -87,6 +87,6 @@
} }
} }
</script> </script>
{{end}} {{end}}
{{end}} {{end}}