2018-06-09 18:07:53 +08:00
|
|
|
(function (global, document) {
|
|
|
|
|
|
|
|
global.resetPassword = function() {
|
|
|
|
var all_ok = global.unfilledMark(["#password", "#password2"], function(el) {
|
|
|
|
el.css("border-bottom", "1px solid red");
|
|
|
|
});
|
|
|
|
|
|
|
|
if (!all_ok) {
|
|
|
|
global.textSet("#err", "Please make sure all fields are filled.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($("#password").val() != $("#password2").val()) {
|
|
|
|
global.textSet("#err", "The two passwords do not match.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var json = {
|
|
|
|
"resetHex": paramGet("hex"),
|
|
|
|
"password": $("#password").val(),
|
|
|
|
};
|
|
|
|
|
|
|
|
global.buttonDisable("#reset-button");
|
2018-06-16 21:25:27 +08:00
|
|
|
global.post(global.commentoOrigin + "/api/owner/reset-password", json, function(resp) {
|
2018-06-09 18:07:53 +08:00
|
|
|
global.buttonEnable("#reset-button");
|
|
|
|
|
|
|
|
global.textSet("#err", "");
|
|
|
|
if (!resp.success) {
|
|
|
|
global.textSet("#err", resp.message);
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
document.location = "/login?changed=true";
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
} (window, document));
|