<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>Delsart</title>
<!-- App favicon -->
<link rel="shortcut icon" href="assets/images/delsart_logo.jpg">
<!-- Bootstrap Css -->
<link href="assets/css/bootstrap.min.css" id="bootstrap-style" rel="stylesheet" type="text/css"/>
<!-- Icons Css -->
<link href="assets/css/icons.min.css" rel="stylesheet" type="text/css"/>
<!-- App Css-->
<link href="assets/css/app.min.css" id="app-style" rel="stylesheet" type="text/css"/>
</head>
<body>
<div class="account-pages my-5 pt-sm-5">
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8 col-lg-6 col-xl-5">
<div class="card overflow-hidden">
<div class="bg-dark ">
<div class="row">
<div class="col">
<div class="p-4">
<h4 class="text-light"> Réinitialisation du mot de passe</h4>
</div>
</div>
</div>
</div>
<div class="card-body pt-0">
<div>
<div class="mb-4">
<span class="">
<img src="assets/images/delsart_logo.jpg" alt=""
class="align-self-sm-start">
</span>
</div>
</div>
<div class="p-2">
<div class="alert alert-info text-center mb-4">
Entrez votre Email et les instructions vous seront envoyées!
</div>
<form class="form-horizontal">
<div class="mb-3">
<label for="useremail" class="form-label">Email</label>
<input type="email" class="form-control" id="userEmail"
placeholder="Entrez votre adresse mail" >
</div>
<div class="alert alert-success" id="emailSend" style="display:none">
L'email à bien été envoyé
</div>
<div class="alert alert-danger" id="emailError" style="display:none">
L'adresse email n'existe pas
</div>
</form>
<div class="text-end">
<button class="btn btn-dark w-md waves-effect waves-light" onclick="password()">
Réinitialiser
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- JAVASCRIPT -->
<script src="assets/libs/jquery/jquery.min.js"></script>
<script src="assets/libs/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="assets/libs/metismenu/metisMenu.min.js"></script>
<script src="assets/libs/simplebar/simplebar.min.js"></script>
<script src="assets/libs/node-waves/waves.min.js"></script>
<!-- App js -->
<script src="assets/js/app.js"></script>
</body>
</html>
<script>
function password(){
let email = $("#userEmail").val();
$.ajax({
type: "POST",
url: '/password-generate-code',
data: {
email
},
success: (response) => {
if(response['data']['text'] == 'success'){
document.getElementById( 'emailError' ).style.display = 'none';
document.getElementById( 'emailSend' ).style.display = 'block';
window.location.href = "/recover-pw-confirm/"+response['data']['token'];
}
else{
document.getElementById( 'emailSend' ).style.display = 'none';
document.getElementById( 'emailError' ).style.display = 'block';
}
},
error: function(error){
}
});
}
</script>