v1.2.0 - Merge branch 'dev'

This commit is contained in:
2021-03-31 16:02:40 +02:00
93 changed files with 75651 additions and 15139 deletions

View File

@@ -1,5 +1,9 @@
$(document).ready(function () {
function isRecaptchaEnabled() {
return (typeof grecaptcha !== 'undefined');
}
function showAlert(type, msg) {
let alert = $("#alertMessage");
alert.text(msg);
@@ -27,6 +31,8 @@ $(document).ready(function () {
}
// Login
$("#username").keypress(function (e) { if(e.which === 13) $("#password").focus(); });
$("#password").keypress(function (e) { if(e.which === 13) $("#btnLogin").click(); });
$("#btnLogin").click(function() {
const username = $("#username").val();
const password = $("#password").val();
@@ -45,7 +51,7 @@ $(document).ready(function () {
btn.prop("disabled", false);
$("#password").val("");
createdDiv.hide();
showAlert(res.msg);
showAlert("danger", res.msg);
}
});
});
@@ -59,7 +65,6 @@ $(document).ready(function () {
let email = $("#email").val().trim();
let password = $("#password").val();
let confirmPassword = $("#confirmPassword").val();
let siteKey = $("#siteKey").val().trim();
if (username === '' || email === '' || password === '' || confirmPassword === '') {
showAlert("danger", "Please fill out every field.");
@@ -67,7 +72,8 @@ $(document).ready(function () {
showAlert("danger", "Your passwords did not match.");
} else {
let params = { username: username, email: email, password: password, confirmPassword: confirmPassword };
if (typeof grecaptcha !== 'undefined') {
if (isRecaptchaEnabled()) {
let siteKey = $("#siteKey").val().trim();
grecaptcha.ready(function() {
grecaptcha.execute(siteKey, {action: 'register'}).then(function(captcha) {
params["captcha"] = captcha;
@@ -122,10 +128,10 @@ $(document).ready(function () {
let btn = $(this);
let email = $("#email").val();
let siteKey = $("#siteKey").val().trim();
let params = { email: email };
if (typeof grecaptcha !== 'undefined') {
if (isRecaptchaEnabled()) {
let siteKey = $("#siteKey").val().trim();
grecaptcha.ready(function() {
grecaptcha.execute(siteKey, {action: 'resetPassword'}).then(function(captcha) {
params["captcha"] = captcha;
@@ -172,4 +178,4 @@ $(document).ready(function () {
});
}
});
});
});

26
js/admin.min.js vendored
View File

File diff suppressed because one or more lines are too long

302
js/files.min.js vendored Normal file
View File

File diff suppressed because one or more lines are too long

View File

@@ -4,8 +4,8 @@ const SUCCESFULL = 2;
const ERROR = 3;
function setState(state) {
var li = $("#currentStep");
var icon, color, text;
let li = $("#currentStep");
let icon, color, text;
switch (state) {
case PENDING:
@@ -44,23 +44,25 @@ function getCurrentStep() {
function sendRequest(params, done) {
setState(PENDING);
var success = false;
$("#status").hide();
let success = false;
let statusBox = $("#status");
statusBox.hide();
$.post("/index.php", params, function(data) {
if(data.success || data.step != getCurrentStep()) {
if(data.success || data.step !== getCurrentStep()) {
success = true;
window.location.reload();
} else {
setState(ERROR);
$("#status").addClass("alert-danger");
$("#status").html("An error occurred during intallation: " + data.msg);
$("#status").show();
statusBox.addClass("alert-danger");
statusBox.html("An error occurred during intallation: " + data.msg);
statusBox.show();
}
}, "json").fail(function() {
setState(ERROR);
$("#status").addClass("alert-danger");
$("#status").html("An error occurred during intallation. Try <a href=\"/index.php\">restarting the process</a>.");
$("#status").show();
statusBox.addClass("alert-danger");
statusBox.html("An error occurred during intallation. Try <a href=\"/index.php\">restarting the process</a>.");
statusBox.show();
}).always(function() {
if(done) done(success);
});
@@ -79,12 +81,13 @@ $(document).ready(function() {
$("#btnSubmit").click(function() {
params = { };
var textBefore = $("#btnSubmit").text();
$("#btnSubmit").prop("disabled", true);
$("#btnSubmit").html("Submitting… <i class=\"fas fa-spinner fa-spin\">");
let submitButton = $("#btnSubmit");
let textBefore = submitButton.text();
submitButton.prop("disabled", true);
submitButton.html("Submitting… <i class=\"fas fa-spinner fa-spin\">");
$("#installForm .form-control").each(function() {
var type = $(this).attr("type") ?? $(this).prop("tagName").toLowerCase();
var name = $(this).attr("name");
let type = $(this).attr("type") ?? $(this).prop("tagName").toLowerCase();
let name = $(this).attr("name");
if(type === "text") {
params[name] = $(this).val().trim();
} else if(type === "password" || type === "number") {
@@ -95,8 +98,8 @@ $(document).ready(function() {
}).promise().done(function() {
sendRequest(params, function(success) {
if(!success) {
$("#btnSubmit").prop("disabled",false);
$("#btnSubmit").text(textBefore);
submitButton.prop("disabled",false);
submitButton.text(textBefore);
} else {
setState(SUCCESFULL);
}
@@ -135,17 +138,16 @@ $(document).ready(function() {
});
// DATABASE PORT
var prevPort = $("#port").val();
var prevDbms = $("#type option:selected").val();
let prevPort = $("#port").val();
let prevDbms = $("#type option:selected").val();
function updateDefaultPort() {
var defaultPorts = {
let defaultPorts = {
"mysql": 3306,
"postgres": 5432,
"oracle": 1521
"postgres": 5432
};
var curDbms = $("#type option:selected").val();
if(defaultPorts[prevDbms] == prevPort) {
let curDbms = $("#type option:selected").val();
if(defaultPorts[prevDbms] === prevPort) {
$("#port").val(defaultPorts[curDbms]);
}
}