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 pathpassword_set.php
86 lines (84 loc) · 2.76 KB
/
password_set.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
<?php
use \Sizzle\Bacon\Database\User;
define('TITLE', 'S!zzle - Set Password');
require __DIR__.'/header.php';
?>
<style>
#new-password-container {
margin:150px auto 0 auto;
text-align:center;
color: white;
margin-bottom: 200px;
}
#send-password-button {
margin-top: 30px;
}
.dialog-input {
margin-left: auto;
margin-right: auto;
}
</style>
</head>
<body onload="document.forms[0].password1.focus()">
<?php require __DIR__.'/navbar.php';?>
<div id="new-password-container">
<h5 id="reset-message">
<?php echo $message;?>
</h5>
<br />
<form id="new-password-form">
<input class="dialog-input" id="password1" name="password1" type="password" placeholder="Password" size="25">
<input class="dialog-input" id="password2" name="password2" type="password" placeholder="Retype Password" size="25">
<a class="btn btn-default standard-button" id="new-password-button">Create Password</a>
</form>
</div>
<?php require __DIR__.'/footer.php';?>
<script>
$(document).ready(function(){
$('#new-password-form').submit(function(e) {
e.preventDefault();
$('#new-password-button').click();
});
$('#new-password-button').on('click', function () {
// check passwords match
var password1 = $('#password1').val();
var password2 = $('#password2').val();
if (password1 === password2 && password1 !== '' && password1.length >= 8) {
var eventTarget = event.target;
$(eventTarget).addClass("disable-clicks");
$.post(
'/ajax/nopassword/',
{
activation_key: '<?php echo $_SESSION['activation_key'] ?? '';?>',
password: password1
},
function (data) {
var failMessage = 'Error setting up account. Please contact ';
failMessage += '<a href="mailto:support@GoSizzle.io">support@GoSizzle.io</a>';
failMessage += ' for assistance.';
if (data.success !== undefined && data.data !== undefined) {
if (data.success == 'true' && data.data.url !== undefined) {
window.location = data.data.url;
} else {
$('#new-password-form').hide();
$('#reset-message').html(failMessage);
}
} else {
// boo :(
$('#reset-message').html(failMessage);
}
},
'json'
);
} else if (password1 === '') {
$('#reset-message').html('Password cannont be left blank.');
} else if (password1.length < 8) {
$('#reset-message').html('Password must be at least 8 characters.');
} else if (password1 !== password2) {
$('#reset-message').html('Passwords entered below must match.');
}
});
});
</script>
</body>
</html>