Base pour les mots de passe oubliée

ServeurDeTest
Noé GARNIER 2 years ago
parent b4be2fb22c
commit 378c1490cd

@ -15,6 +15,8 @@ $vues['main'] = 'View/src/pages/Main.php';
$vues['presentation'] = 'View/src/pages/Presentation.html';
$vues['login'] = 'View/src/pages/LogSign/Login.php';
$vues['signUp'] = 'View/src/pages/LogSign/SignUp.php';
$vues['mail'] = 'View/src/pages/LogSign/Mail.php';
$vues['confirm'] = 'View/src/pages/LogSign/Confirm.php';
$vues['test'] = 'View/src/pages/FirstTests/FirstTest1.html';
$vues['next'] = 'View/src/pages/FirstTests/FirstTest';
$vues['admin'] = 'View/src/pages/Admin/Admin.php';

@ -28,9 +28,18 @@ class VisitorController
case "goToSignUp":
$this->goToSignUp();
break;
case "goToMail":
$this->goToMail();
break;
case "goToQueue":
$this->goToLogin();
break;
case "sendMail":
$this->sendMail();
break;
case "goToReset":
$this->goToReset();
break;
default:
$error = "Action non valide";
require($rep . $vues['erreur']);
@ -74,6 +83,16 @@ class VisitorController
require($rep . $vues['erreur']);
}
}
public function goToMail()
{
try {
global $rep, $vues;
require($rep . $vues['mail']);
} catch (Exception $e) {
$error = $e->getMessage();
require($rep . $vues['erreur']);
}
}
public function signUp()
{
try {
@ -102,4 +121,30 @@ class VisitorController
require($rep . $vues['erreur']);
}
}
public function sendMail()
{
$nettoyage = new Nettoyage();
$code = 10;
$to = $nettoyage->cleanEmail($_POST['email']);
$subject = 'Reset your password';
$message = 'Hello, you can reset your password here : http://82.165.180.114/index.php?action=goToConfirm&code='.$code;
$headers = 'From: scripted@gmail.com' . "\r\n" .
// 'Reply-To: sender@example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
$this->goToMail();
}
public function goToConfirm()
{
try {
global $rep, $vues;
require($rep . $vues['confirm']);
} catch (Exception $e) {
$error = $e->getMessage();
require($rep . $vues['erreur']);
}
}
}

@ -24,6 +24,10 @@ body {
background-color: #000;
}
a{
text-decoration: none !important;
}
.login-box {
position: absolute;
top: 50%;
@ -194,4 +198,4 @@ body {
100% {
bottom: 100%;
}
}
}

@ -0,0 +1,64 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Login</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/css/bootstrap.min.css"
integrity="sha384-r4NyP46KrjDleawBgD5tp8Y7UzmLA05oM1iAEQ17CSuDqnUK2+k9luXQOfXJCJ4I" crossorigin="anonymous" />
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"
integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/js/bootstrap.min.js"
integrity="sha384-oesi62hOLfzrys4LxRF63OJCXdXDipiYWBnvTl9Y9/TRlw5xlKIEHpNyvvDShgf/"
crossorigin="anonymous"></script>
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@48,400,0,0" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" />
<link rel="stylesheet" href="./View/src/CSS/Login.css" />
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
</head>
<body>
<div class="container user-select-none">
<div class="login-box col-12" id="form">
<div class="row mb-4 d-flex align-items-center">
<div class="col-2 justify-content-center">
<a class="material-icons p-0 m-0" id="home" href="index.php?action=goToHome"
style="font-size: 30px; color: white; text-decoration:none; width: fit-content;">home</a>
</div>
<div class="col d-flex justify-content-center align-content-center">
<h2 class="text-uppercase font-weight-bold text-center" id="h2" style="width:fit-content;">Password
Reset</h2>
</div>
<div class="col-2"></div>
</div>
<div class="col text-center">
<p> Your password was reset go to your mail and enter the validation code.</p>
</div>
<form class="mb-5" action="index.php?action=goToHome" method="POST">
<div class="user-box mb-5 position-relative">
<input type="text" id="code" name="code" required="" />
<label>Code</label>
</div>
<div class="d-flex justify-content-around mt-5">
<button class="py-2 px-3" type="submit">
<span></span>
<span></span>
<span></span>
<span></span>
Reset Password
</button>
</div>
</form>
<div class="d-flex justify-content-around">
<a href="index.php?action=goToLogin" class="text-center" style="color: #5fc198;">Login</a>
<a href="index.php?action=goToSignUp" class="text-center" style="color: #5fc198;">Sign up</a>
</div>
</div>
</div>
</body>
</html>

@ -31,10 +31,13 @@
<input type="text" id="email" name="email" required="" />
<label>Email</label>
</div>
<div class="user-box mb-5 position-relative">
<div class="user-box position-relative">
<input type="password" id="password" name="password" required="" />
<label>Password</label>
</div>
<div class="user-box position-relative">
<a href="index.php?action=goToMail" style="color : #5fc198">Mots de passe oucliée ?</a>
</div>
<div class="d-flex justify-content-around mt-5">
<button class="py-2 px-3" type="submit">
<span></span>

@ -0,0 +1,64 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Login</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/css/bootstrap.min.css"
integrity="sha384-r4NyP46KrjDleawBgD5tp8Y7UzmLA05oM1iAEQ17CSuDqnUK2+k9luXQOfXJCJ4I" crossorigin="anonymous" />
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"
integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/js/bootstrap.min.js"
integrity="sha384-oesi62hOLfzrys4LxRF63OJCXdXDipiYWBnvTl9Y9/TRlw5xlKIEHpNyvvDShgf/"
crossorigin="anonymous"></script>
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@48,400,0,0" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" />
<link rel="stylesheet" href="./View/src/CSS/Login.css" />
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
</head>
<body>
<div class="container user-select-none">
<div class="login-box col-12" id="form">
<div class="row mb-4 d-flex align-items-center">
<div class="col-2 justify-content-center">
<a class="material-icons p-0 m-0" id="home" href="index.php?action=goToHome"
style="font-size: 30px; color: white; text-decoration:none; width: fit-content;">home</a>
</div>
<div class="col d-flex justify-content-center align-content-center">
<h2 class="text-uppercase font-weight-bold text-center" id="h2" style="width:fit-content;">Password
Reset</h2>
</div>
<div class="col-2"></div>
</div>
<div class="col text-center">
<p> Enter your email address and we'll send you an email with instructions to reset your password.</p>
</div>
<form class="mb-5" action="index.php?action=goToHome" method="POST">
<div class="user-box mb-5 position-relative">
<input type="text" id="email" name="email" required="" />
<label>Email</label>
</div>
<div class="d-flex justify-content-around mt-5">
<button class="py-2 px-3" type="submit">
<span></span>
<span></span>
<span></span>
<span></span>
Reset Password
</button>
</div>
</form>
<div class="d-flex justify-content-around">
<a href="index.php?action=goToLogin" class="text-center" style="color: #5fc198;">Login</a>
<a href="index.php?action=goToSignUp" class="text-center" style="color: #5fc198;">Sign up</a>
</div>
</div>
</div>
</body>
</html>
Loading…
Cancel
Save