You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.7 KiB
Smarty
49 lines
1.7 KiB
Smarty
<h1>Reset Password</h1>
|
|
<div class="well">
|
|
<div class="alert alert-success" id="success" style="display:none">
|
|
<button type="button" class="close" data-dismiss="alert">×</button>
|
|
<strong>Password Changed</strong>
|
|
<p></p>
|
|
</div>
|
|
<div class="alert alert-error" id="error" style="display:none">
|
|
<strong>Incrrect Reset Code</strong>
|
|
<p>The reset code received was incorrect. Please try again, or <a href="/reset">request a new reset code</a></p>
|
|
</div>
|
|
<div id="reset-form">
|
|
<label for="password">New Password</label><input type="password" placeholder="A new password" id="password" /><br />
|
|
<label for="repeat">... and again</label><input type="password" placeholder="The same password" id="repeat" /><br />
|
|
<input type="hidden" value="{reset_code}" />
|
|
<button class="btn btn-primary" id="reset" type="submit" disabled>Reset Password</button>
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
(function() {
|
|
var resetEl = document.getElementById('reset'),
|
|
password = document.getElementById('password'),
|
|
repeat = document.getElementById('repeat');
|
|
|
|
resetEl.addEventListener('click', function() {
|
|
if (password.value === repeat.value) {
|
|
alert("match");
|
|
}
|
|
}, false);
|
|
|
|
// Enable the form if the code is valid
|
|
socket.emit('user:reset.valid', { code: '{reset_code}' });
|
|
socket.on('user:reset.valid', function(data) {
|
|
if (!!data.valid) resetEl.disabled = false;
|
|
else {
|
|
var formEl = document.getElementById('reset-form');
|
|
// Show error message
|
|
$('#error').show();
|
|
formEl.parentNode.removeChild(formEl);
|
|
}
|
|
})
|
|
|
|
// socket.on('user.password.reset', function(data) {
|
|
// if (data.success === 'ok') {
|
|
// ajaxify.go('/');
|
|
// }
|
|
// });
|
|
}());
|
|
</script> |