-
Notifications
You must be signed in to change notification settings - Fork 0
/
create-new-pwd.php
83 lines (82 loc) · 3.12 KB
/
create-new-pwd.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
<?php include_once 'helpers/helper.php'; ?>
<?php subview('header.php'); ?>
<link rel="stylesheet" href="assets/css/login.css">
<style>
@font-face {
font-family: 'product sans';
src: url('assets/css/Product Sans Bold.ttf');
}
h1{
font-family :'product sans' !important;
font-size:48px !important;
margin-top:20px;
text-align:center;
}
body {
background: -webkit-linear-gradient(left, #3931af, #00c6ff);
}
.login-form {
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
border-radius: 0px;
}
</style>
<?php
if(isset($_GET['err']) || isset($_GET['pwd'])) {
if($_GET['err'] === 'pwdnotmatch') {
echo '<script>alert("Passwords do not match");</script>';
} else if($_GET['err'] === 'sqlerr') {
echo '<script>alert("An error occured");</script>';
} else if($_GET['pwd'] === 'updated') {
echo '<script>alert("Your password has been updated");</script>';
}
exit();
}
?>
<div class="flex-container">
<div class="login-form mt-4" style="height: 300px;">
<h1 class="text-primary mb-3 text-center">Reset Password</h1>
<?php
$selector = $_GET['selector'];
$validator = $_GET['validator'];
if(empty($selector) || empty($validator)){
// echo $_GET;
echo '<script>alert("Could not validate your request")</script>';
} else {
if(ctype_xdigit($selector) !== false && ctype_xdigit($validator) !== false){
?>
<form method="POST" action="includes/reset-password.inc.php">
<input type="hidden" name="selector" value="<?php echo $selector ?>">
<input type="hidden" name="validator" value="<?php echo $validator ?>">
<div class="flex-container">
<div>
<i class="fa fa-lock text-primary"></i>
</div>
<div>
<input type="password" name="password" class="form-input"
placeholder="Enter password"
required pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}"
title="Must contain at least one number and one uppercase and lowercase letter,
and at least 8 or more characters">
</div>
</div>
<div class="flex-container">
<div>
<i class="fa fa-lock text-primary"></i>
</div>
<div>
<input type="password" name="password_repeat" class="form-input"
placeholder="Confirm password" required>
</div>
</div>
<div class="submit">
<button name="new-pwd-submit" type="submit" class="button">
Submit</button>
</div>
</form>
<?php
}
}
?>
</div>
</div>
<?php subview('footer.php'); ?>