Password verification.

This commit is contained in:
RyoshiKayo 2017-03-10 08:26:05 -08:00 committed by GitHub
parent 4830fb6300
commit fda308146b
1 changed files with 15 additions and 2 deletions

View File

@ -559,6 +559,10 @@ panel.changePassword = function(){
<label class="label">New password:</label>
<p class="control has-addons">
<input id="password" class="input is-expanded" type="password" placeholder="Your new password">
</p>
<label class="label">Confirm password:</label>
<p class="control has-addons">
<input id="passwordTwo" class="input is-expanded" type="password" placeholder="Verify your new password">
<a id="sendChangePassword" class="button is-primary">Set new password</a>
</p>
`;
@ -566,9 +570,18 @@ panel.changePassword = function(){
panel.page.appendChild(container);
document.getElementById('sendChangePassword').addEventListener('click', function(){
panel.sendNewPassword(document.getElementById('password').value);
if (document.getElementById('password').value === document.getElementById('passwordTwo').value) {
panel.sendNewPassword(document.getElementById('password').value);
} else {
swal({
title: "Password Mismatch!",
text: 'Your passwords do not match, please try again.',
type: "error"
}, function() {
panel.changePassword();
});
}
});
}
panel.sendNewPassword = function(pass){