-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathforgot_password.php
70 lines (66 loc) · 2.09 KB
/
forgot_password.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
<?php
session_start();
//If we are logged in, then jump to the logout page.
require_once 'common_auth.php';
confirm_not_logged_in('status.php');
#Reset the error variable
$error='';
#Attempt to reset this account's password by name
if(isset($_POST['FORGOT_NAME']))
{
require_once 'common_auth.php';
$auth=get_auth();
$result=$auth->reset_account_by_name($_POST['username']);
if(!is_auth_error($result))
{
//Yay! The reset is ready.
header("Location: reset_ready.php");
}
$error='There was an error processing your request. Please try again later. '.$result->get_msg();
}
#Attempt to reset this account's password by email
if(isset($_POST['FORGOT_EMAIL']))
{
require_once 'common_auth.php';
$auth=get_auth();
$result=$auth->reset_account_by_email($_POST['email']);
if(!is_auth_error($result))
{
//Yay! The reset is ready.
header("Location: reset_ready.php");
}
if($result->get_error()==AERR_FAILURE)
$error='The username or password given was incorrect. Please try again.'.$result->get_msg();
else
$error='There was an error processing your request. Please try again later. '.$result->get_msg();
}
?>
<html>
<head>
<title>Forgotten username or password</title>
</head>
<body onload="document.form_data.username.focus();">
<h1><?=$error?></h1>
<form method="post">
<table>
<tr>
<td colspan="2">If you cannot remember your password but can remember your account name, then please enter it here:</td>
</tr>
<tr>
<td><input name="username"></td>
<td><input type="submit" name="FORGOT_NAME" value="Reset the account with this name."</td>
</tr>
<tr><td> </td></tr>
<tr>
<td colspan="2">If you cannot remember your account name, please enter the email address you used when you created your account:</td>
</tr>
<tr>
<td><input name="email"></td>
<td><input type="submit" name="FORGOT_EMAIL" value="Reset the account with this email."</td>
</tr>
<tr><td> </td></tr>
<tr><td><a href="status.php">Return to the login status page.</a></td></tr>
</table>
</form>
</body>
</html>