62 lines
1.5 KiB
JavaScript
62 lines
1.5 KiB
JavaScript
|
|
|
||
|
|
// ===============
|
||
|
|
// Change Password
|
||
|
|
// ===============
|
||
|
|
|
||
|
|
$(document).ready(function () {
|
||
|
|
|
||
|
|
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||
|
|
|
||
|
|
// -----------
|
||
|
|
// Save Button
|
||
|
|
// -----------
|
||
|
|
|
||
|
|
$(".btnSave").on("click", function (e) {
|
||
|
|
e.preventDefault();
|
||
|
|
$("#changePassword").submit();
|
||
|
|
});
|
||
|
|
|
||
|
|
// --------------
|
||
|
|
// Cancel Button.
|
||
|
|
// --------------
|
||
|
|
|
||
|
|
$(".btnCancel").on("click", function () {
|
||
|
|
formSubmit({action: $sessionStorage.addUser});
|
||
|
|
});
|
||
|
|
|
||
|
|
// ---------------
|
||
|
|
// Validate Inputs
|
||
|
|
// ---------------
|
||
|
|
|
||
|
|
$("#changePassword").submit(function (e) {
|
||
|
|
|
||
|
|
var user_new_password = $("#user_new_password"),
|
||
|
|
user_verify_password = $("#user_verify_password");
|
||
|
|
|
||
|
|
clearInputErrors();
|
||
|
|
|
||
|
|
if (isBlank(user_new_password)) {
|
||
|
|
createInputError(user_new_password, "New password is required");
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
if (isBlank(user_verify_password)) {
|
||
|
|
createInputError(user_verify_password, "Type password again");
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
if (user_new_password.val() !== user_verify_password.val()) {
|
||
|
|
createInputError(user_verify_password, "Password do not match.");
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
e.preventDefault();
|
||
|
|
|
||
|
|
$.post("./", $(this).serialize())
|
||
|
|
.done(function () {
|
||
|
|
formSubmit({action: "./"});
|
||
|
|
});
|
||
|
|
|
||
|
|
});
|
||
|
|
|
||
|
|
});
|