mirror of
https://github.com/donl/gPanel.git
synced 2026-06-30 06:12:06 -06:00
added check to create user form and made update password submission erase all fields
This commit is contained in:
parent
75053ef01a
commit
f15cc5feae
2 changed files with 23 additions and 15 deletions
|
|
@ -9,28 +9,33 @@ jQuery('._js_add-user-form').on('submit', function(e){
|
|||
|
||||
if((usernameInput && usernameInput.val()) && (passwordInput && passwordInput.val()) && (passwordInputRetype && passwordInputRetype.val())) {
|
||||
if(passwordInput.val() == passwordInputRetype.val()) {
|
||||
var requestData = {};
|
||||
requestData["user"] = usernameInput.val();
|
||||
requestData["pass"] = passwordInput.val();
|
||||
if (passwordInput.val().length >= 8) {
|
||||
var requestData = {};
|
||||
requestData["user"] = usernameInput.val();
|
||||
requestData["pass"] = passwordInput.val();
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open(jQuery(this).attr('method'), jQuery(this).attr('action'), true);
|
||||
xhr.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');
|
||||
xhr.send(JSON.stringify(requestData));
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open(jQuery(this).attr('method'), jQuery(this).attr('action'), true);
|
||||
xhr.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');
|
||||
xhr.send(JSON.stringify(requestData));
|
||||
|
||||
xhr.onloadend = function() {
|
||||
if(xhr.status == 204) {
|
||||
listCurrentUsers();
|
||||
}
|
||||
else {
|
||||
if(xhr.response != undefined && xhr.response.length != 0) {
|
||||
alert('Error: ' + xhr.response);
|
||||
xhr.onloadend = function() {
|
||||
if(xhr.status == 204) {
|
||||
listCurrentUsers();
|
||||
}
|
||||
else {
|
||||
alert('An error has occurred, refresh and try again. If problem persists please contact your administrator.');
|
||||
if(xhr.response != undefined && xhr.response.length != 0) {
|
||||
alert('Error: ' + xhr.response);
|
||||
}
|
||||
else {
|
||||
alert('An error has occurred, refresh and try again. If problem persists please contact your administrator.');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
alert('Password must be at least 8 characters');
|
||||
}
|
||||
}
|
||||
else {
|
||||
alert('Password fields do not match.');
|
||||
|
|
|
|||
|
|
@ -50,6 +50,9 @@ jQuery('._js_update-password-form').on('submit', function(e){
|
|||
xhr.onloadend = function() {
|
||||
if(xhr.status == 204) {
|
||||
alert("Password successfully updated.");
|
||||
$('input[type=password]').each(function() {
|
||||
$(this).val('');
|
||||
});
|
||||
newPassModal.modal('hide');
|
||||
userModal.modal('show');
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue