9e3935b3b2
Apologies in advance for the insanely huge commit. This commit is primarily based on Anton Linevych's amazing work found here [1]. While he had gone through the pains of making small, atomic changes to each file, I had put off reviewing the PR for a long time. By the time I finally got around to it, the project had changed so much that it didn't make sense to keep the commits the same way. So I've cherry-picked most of his commits, with some changes here and there, and I've squashed them into one commit. [1] https://gitlab.com/linevych/commento-ce/tree/feature/frontend_building_improvements
37 lines
959 B
JavaScript
37 lines
959 B
JavaScript
(function (global, document) {
|
|
"use strict";
|
|
|
|
(document);
|
|
|
|
// Talks to the API and sends an reset email.
|
|
global.sendResetHex = function() {
|
|
var allOk = global.unfilledMark(["#email"], function(el) {
|
|
el.css("border-bottom", "1px solid red");
|
|
});
|
|
|
|
if (!allOk) {
|
|
global.textSet("#err", "Please make sure all fields are filled.");
|
|
return;
|
|
}
|
|
|
|
var json = {
|
|
"email": $("#email").val(),
|
|
};
|
|
|
|
global.buttonDisable("#reset-button");
|
|
global.post(global.origin + "/api/owner/send-reset-hex", json, function(resp) {
|
|
global.buttonEnable("#reset-button");
|
|
|
|
global.textSet("#err", "");
|
|
if (!resp.success) {
|
|
global.textSet("#err", resp.message);
|
|
return
|
|
}
|
|
|
|
$("#msg").html("If that email is a registered account, you will receive an email with instructions on how to reset your password.");
|
|
$("#reset-button").hide();
|
|
});
|
|
}
|
|
|
|
} (window.commento, document));
|