forked from Talishar/Talishar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCreateNewPassword.php
43 lines (35 loc) · 1.47 KB
/
CreateNewPassword.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
<?php
require 'MenuBar.php';
?>
<main>
<div class="wrapper">
<section class="section-default" style='position:absolute; top:200px;'>
<?php
// First we grab the tokens from the URL.
$selector = $_GET['selector'];
$validator = $_GET['validator'];
// Then we check if the tokens are here.
if (empty($selector) || empty($validator)) {
echo "Could not validate your request!";
} else {
// Here we check if all characters in our tokens are hexadecimal 'digits'. This is a boolean. Again another error check to make sure the URL wasn't changed by the user.
// If this check returns "true", we show the form that the user uses to reset their password.
if (ctype_xdigit($selector) !== false && ctype_xdigit($validator) !== false) {
?>
<form class="form-resetpwd" action="includes/reset-password.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="pwd" placeholder="Enter new password...">
<input type="password" name="pwd-repeat" placeholder="Repeat new password...">
<button type="submit" name="reset-password-submit">Reset password</button>
</form>
<?php
}
}
?>
</section>
</div>
</main>
<?php
require 'Disclaimer.php';
?>