This repository was archived by the owner on Jan 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathforgot_password.php
80 lines (79 loc) · 2.4 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
71
72
73
74
75
76
77
78
79
80
<?php
define('TITLE', 'S!zzle - Password Reset');
require __DIR__.'/header.php';
?>
<style>
#forgot-password-container {
margin:200px auto 0 auto;
text-align:center;
color: white;
margin-bottom: 200px;
}
#send-password-button {
margin-top: 30px;
}
#email {
margin: auto;
}
</style>
</head>
<body onload="document.forms[0].email.focus()">
<?php require __DIR__.'/navbar.php';?>
<div id="forgot-password-container">
<h5 id="reset-message">
Please enter the email address used to register your account.
<br /><br />
We'll email you a link to reset your password.
</h5>
<br />
<form id="lost-password-form">
<input class="dialog-input" id="email" name="email" type="text" placeholder="Email address" size="25">
<a class="btn btn-default standard-button" id="send-password-button">Reset Password</a>
</form>
</div>
<?php require __DIR__.'/footer.php';?>
<script>
$(document).ready(function(){
$('#lost-password-form').submit(function(e) {
e.preventDefault();
$('#send-password-button').click();
});
$('#send-password-button').on('click', function () {
url = '/ajax/reset_password/';
var eventTarget = event.target;
$(eventTarget).addClass("disable-clicks");
$.post(
url,
{
email: $('#email').val()
},
function (data) {
var request = '<br /><br />Please enter the email address used to register your account.';
if (data.success !== undefined && data.data !== undefined) {
if (data.success == 'true') {
// Yay!
$('#lost-password-form').hide();
$('#reset-message').html('Please check your email for a reset link.');
} else {
if (data.data == 'Too many tries. Come back mañana.') {
$('#lost-password-form').hide();
$('#reset-message').html(data.data);
} else {
var message = (data.data !== '' ? data.data : 'Unable to reset password.')+request;
$('#reset-message').html(message);
}
}
} else {
// boo :(
$('#reset-message').html('Unable to reset password.'+request);
}
},
'json')
.always(function() {
$(eventTarget).removeClass("disable-clicks");
});
});
});
</script>
</body>
</html>