-
Notifications
You must be signed in to change notification settings - Fork 0
/
derniere_etape_pass.php
94 lines (72 loc) · 3.35 KB
/
derniere_etape_pass.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php
session_start();
include('./includes/connect.php');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Electro Shop - Recuperer votre mot de passe</title>
<!-- google font -->
<link href='https://fonts.googleapis.com/css?family=Alice' rel='stylesheet'>
<!-- bootstrap-css -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<!-- font awesome -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css" integrity="sha512-KfkfwYDsLkIlwQp6LFnl8zNdLGxu9YAA1QvwINks4PhcElQSvqcyVLLD9aMhXd13uQjoXtEKNosOWaZqXgel0g==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<!-- sweetalert2 -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/sweetalert2.all.min.js"></script>
<!-- css file -->
<link rel="stylesheet" href="css/style.css?v=<?php echo time(); ?>">
</head>
<body>
<!-- bootstrap-JS -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-pprn3073KE6tl6bjs2QrFaJGz5/SUsLqktiwsUTF55Jfv3qYSDhgCecCxMW52nD2" crossorigin="anonymous"></script>
</body>
</html>
<?php
if(isset($_POST['enregistrer_mot_passe'])){
$password_utilisateur = htmlspecialchars($_POST['passwd']);
$password_utilisateur_hash = password_hash($password_utilisateur,PASSWORD_DEFAULT);
$password_utilisateur_verification = htmlspecialchars($_POST['confPass']);
// echo $password_utilisateur ;
// echo $password_utilisateur_hash ;
// exit;
if($password_utilisateur != $password_utilisateur_verification){
$_SESSION['pass_inco'] = 'pass_inco';
echo "<script>Swal.fire({position: 'center',
icon: 'error',
title: 'Verifier mot de passe',
showConfirmButton: true}).then((result) => {
if (result.isConfirmed) {
Swal.fire(
window.open('./mot_passe_oublier_verification.php','_self')
)
}else{
window.open('./mot_passe_oublier_verification.php','_self')
}
});
</script>";
}else{
$modifier_utilisateur = "UPDATE utilisateurs SET mot_passe_utilisateur=:mot_passe_utilisateur WHERE email_utilisateur=:email_utilisateur";
$modifier= $con->prepare($modifier_utilisateur);
$modifier->execute(array('mot_passe_utilisateur' => $password_utilisateur_hash,'email_utilisateur' => $_SESSION['mail']));
echo "<script>Swal.fire({position: 'center',
icon: 'success',
title: 'Le mot de passe à été enregistré',
showConfirmButton: true}).then((result) => {
if (result.isConfirmed) {
Swal.fire(
window.open('./login.php','_self')
)
}else{
window.open('./login.php','_self')
}
});</script>";
if(isset($_SESSION['otp_code'])){
unset($_SESSION['otp_code']);
}
}
}
?>