-
Notifications
You must be signed in to change notification settings - Fork 0
/
resetpassword.php
98 lines (90 loc) · 3.29 KB
/
resetpassword.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
95
96
97
98
<?php
/**
* Created by PhpStorm.
* User: Kabeer.Vohra
* Date: 9/3/2015
* Time: 2:40 PM
*/
include_once $_SERVER['DOCUMENT_ROOT'] . '/headers/header.php';
?>
<title>Reset Password</title>
</head>
<body>
<div class="container mainbody" style="text-align: center;">
<?php
if (isset($_SESSION["resetpasswordsuccess"]))
{
echo
"<div class='alert alert-success' role='alert'>
<span class='glyphicon glyphicon-ok-sign' aria-hidden='true'></span>
<span class='sr-only'>Success:</span>
" . $_SESSION["resetpasswordsuccess"] . "
</div>";
unset($_SESSION["resetpasswordsuccess"]);
}
elseif (isset($_SESSION["resetpassworderror"]))
{
echo
"<div class='alert alert-danger' role='alert'>
<span class='glyphicon glyphicon-exclamation-sign' aria-hidden='true'></span>
<span class='sr-only'>Error:</span>
" . $_SESSION["resetpassworderror"] . "
</div>";
unset($_SESSION["resetpassworderror"]);
}
if (isset($_GET["email"]) && isset($_GET["hash"]))
{
if($db->checkResetPassword($_GET["email"], $_GET["hash"]))
{
?>
<div class="col-sm-6 col-sm-offset-3">
<form class="form-horizontal" role="form" id="form" method="post" action="action/resetpassword.php">
<div class="form-group">
<label class="control-label col-sm-12" for="password" style="text-align: center; padding-top: 30px; padding-bottom: 10px;">New Password</label>
<div class="col-sm-12">
<input type="password" name="password" class="form-control" id="password" autocomplete="off" style="text-align: center;">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-12" for="confirmpassword" style="text-align: center; padding-top: 30px; padding-bottom: 10px;">Confirm Password</label>
<div class="col-sm-12">
<input type="password" name="confirmpassword" class="form-control" id="confirmpassword" autocomplete="off" style="text-align: center;">
</div>
</div>
<input type="hidden" name="hash" value="<?= $_GET["hash"] ?>" />
<input type="hidden" name="email" value="<?= $_GET["email"] ?>" />
<div class="form-group">
<div class="col-sm-12" style="text-align: center; padding-top: 20px;">
<button type="submit" class="btn btn-default">Submit</button>
</div>
</div>
</form>
</div>
<?php
}
else
{
echo "Invalid email reset link, please try and request another <a href='forgottenpassword.php'>here</a>";
}
}
elseif (isset($_GET["email"]) && isset($_GET["cancelreset"]))
{
if ($_GET["cancelreset"])
{
if ($db->cancelResetPassword($_GET["email"]))
{
echo "Reset password link successfully cancelled";
}
else
{
echo "Unable to cancel password reset link, please contact customer service";
}
}
else
{
echo "Unable to cancel password reset link, please contact customer service";
}
}
?>
</div>
</body>