-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpasswordReset.php
More file actions
88 lines (76 loc) · 3.63 KB
/
passwordReset.php
File metadata and controls
88 lines (76 loc) · 3.63 KB
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
<?php
session_start();
if(!isset($_SESSION['passwordTokens']) && !isset($_SESSION['forgotEmail'])){
header("Location: index.php");
exit();
}
if($_SERVER['REQUEST_METHOD'] == "POST"){
$newPassword = $_POST['newPassword'];
$confirmPassword = $_POST['confirmPassword'];
$email = $_SESSION['forgotEmail'];
$tokens = $_SESSION['passwordTokens'];
include 'classes/Dbh.class.php';
include 'classes/signupmodel.class.php';
include 'classes/forgetPasswordcontr.class.php';
include 'classes/signupview.class.php';
$forgotPasswordcontr = new forgotPasswordcontr($email, $newPassword, $confirmPassword, $tokens);
$reset = $forgotPasswordcontr->passwordReset();
$signupview = new signupview();
$result = $signupview->showAlert($reset);
if($reset == "password_updated" || $reset == "expired_tokens"){
session_unset();
session_destroy();
unset($_POST['newPassword'], $_POST['confirmPassword']);
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
<link rel="stylesheet" href="css/passwordReset.css">
<title>Password Reset</title>
</head>
<body style="background-color:#fffdf2;">
<div class="container-fluid">
<form class="mx-auto" action="#" method="post">
<!-- PHP ALERT BOX -->
<?php
$displayAlert = isset($result)? $result : '';
echo $displayAlert;
?>
<h4 class="text-center">Forgot Password</h4>
<div class="mb-3 mt-5">
<label for="exampleInputEmail1" class="form-label">Email address</label>
<input disabled type="text" value="<?php echo isset($_SESSION['forgotEmail']) ? htmlentities($_SESSION['forgotEmail']) : null?>" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp">
</div>
<div class="mb-3 mt-2">
<label for="exampleInputEmail1" class="form-label">New Password</label>
<input type="password" name="newPassword" id="newPassword" class="form-control" id="exampleInputEmail1" aria-describedby="newPassword">
<div id="password-indicator">
<span id="weak"></span>
<span id="medium"></span>
<span id="strong"></span>
</div>
<small id="password-description"></small>
</div>
<div class="mb-3 mt-2">
<label for="exampleInputEmail1" class="form-label">Confirm Password</label>
<input type="password" name="confirmPassword" id="confirmPassword" class="form-control" id="exampleInputEmail1" aria-describedby="confirmPassword">
<div id="passwordrepeat-indicator">
<small id="passwordrepeat-description"></small>
</div>
</div>
<button type="submit" class="btn btn-primary" id="buttonSubmit">Submit</button>
<div class="row" id="loginLink">
<small id="right-signup">Already have an account? <a href="index.php">Login</a></small>
</div>
</form>
</div>
<script src="javascript/passwordReset.js"></script>
</body>
</html>