-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcreateNewPassword.php
More file actions
70 lines (59 loc) · 2.45 KB
/
createNewPassword.php
File metadata and controls
70 lines (59 loc) · 2.45 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
<?php
include_once 'header.php';
?>
<link rel="stylesheet" href="assets/css/createNewPassword.css">
</head>
<body>
<!-- navigation section -->
<div class="nav-bar">
<a href="index.php">
<img src="assets/images/logo.png" alt="Fund Raiser logo">
</a>
<div class="nav-links">
<a href="campaigns.php">CAMPAIGNS</a>
<a href="donors.php">DONORS</a>
</div>
</div>
<!-- body part -->
<div class="message">
<!-- if both the passwords do not match-->
<?php
if(isset($_GET['password'])) {
if($_GET['password'] == "notsame") {
echo "The passwords you entered must be same";
}
}
?>
<!-- if user already reset password or the click the expired link from email -->
<?php
if(isset($_GET['reset'])) {
if($_GET['reset'] == "alreadyReset") {
echo "you need to resubmit your reset request! or you have already change your password with this link";
}
}
?>
</div>
<div class="resetPasswordBoxContainer">
<?php
$selector = $_GET["selector"];
$validator = $_GET["validator"];
if(empty($selector) || empty($validator)) {
echo 'Could not validate your request!';
} else {
if(ctype_xdigit($selector) !== false && ctype_xdigit($validator) !== false) { //to check the tokens are in hexadecimal in email message url that user get
?>
<form action="includes/resetPassword.inc.php" method="POST">
<input type="hidden" name="selector" value="<?php echo $selector; ?>">
<input type="hidden" name="validator" value="<?php echo $validator; ?>">
<input type="password" name="password" placeholder="Enter a new password" required>
<input type="password" name="repeatPassword" placeholder="Repeat new password" required><br>
<button type="submit" name="resetPasswordSubmit">Reset Password</button>
</form>
<?php
}
}
?>
</div>
<?php
include_once 'footer.php';
?>