From 88d3e276d1384752273a9c88d2a7832342a19391 Mon Sep 17 00:00:00 2001 From: Dippy <52082595+Dippys@users.noreply.github.com> Date: Sat, 13 Nov 2021 07:50:04 +0400 Subject: [PATCH] Fixed Pincode Missing --- gui/index.html | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/gui/index.html b/gui/index.html index a2c2ae6..2b7aebd 100644 --- a/gui/index.html +++ b/gui/index.html @@ -55,7 +55,7 @@ - +
@@ -80,6 +80,13 @@
+
+ + + + + +
@@ -168,10 +175,12 @@ Snackbar.show({ text: "Powered by PedroHB#9569 - https://phb.services", pos: 'bottom-center', showAction: false, duration: 3000, customClass: "snackborderradius" }); $(".require_username").prop("data-validate", config.lang.validate_username); $(".require_password").prop("data-validate", config.lang.validade_password); + $(".require_pincode").prop("data-validate", config.lang.validate_pincode); $(".recoverypassword").html(config.lang.forgot_password); $(".createaccount").html(`${config.lang.create_account} `); $(".inputusername").prop("placeholder", config.lang.placeholder_username); $(".inputpassword").prop("placeholder", config.lang.placeholder_password); + $(".inputpincode").prop("placeholder", config.lang.placeholder_pincode); $(".loginbutton").html(config.lang.login); $("#screen .tooltip_app").html(`
${config.lang.buttons.fullscreen}`); $("#cache .tooltip_app").html(`
${config.lang.buttons.clearcache}`); @@ -195,7 +204,7 @@ $(".loginbutton").prop("disabled", true); var serializedForm = $(".loginform").serializeObject(); ipcRenderer.send("saveLoginData", serializedForm); - ipcRenderer.send("login", serializedForm.username, serializedForm.password); + ipcRenderer.send("login", serializedForm.username, serializedForm.password, serializedForm.pincode); }); ipcRenderer.on("loginCallback", (e, cookie, data, status) => { @@ -216,7 +225,20 @@ if (data.status == "error" && data.message) { showValidate($(".inputusername")); showValidate($(".inputpassword")); + showValidate($(".inputpincode")); Snackbar.show({ text: data.message, actionText: configuration.lang.snackbar.dimiss, pos: 'bottom-center', duration: 3000, customClass: "snackborderradius" }); + } else if (data.status == "pincode_required") { + webview.executeJavaScript(` + $.ajax({ + type: "POST", + url: "${configuration.url.hotelUrl}/auth/login/request", + data: ${JSON.stringify($(".loginform").serializeObject())}, + dataType: "json" + }).done(function (result) { + console.log(JSON.stringify(result)); + location.href="${configuration.url.clientUrl}"; + }) + `); } else if (status > 201 || status < 200) { Snackbar.show({ text: `${configuration.lang.snackbar.api_error} - ERROR ${status}`, actionText: configuration.lang.snackbar.dimiss, pos: 'bottom-center', duration: 3000, customClass: "snackborderradius" }); } else { @@ -247,6 +269,7 @@ if (data.username && data.password) { $(".inputusername").val(data.username); $(".inputpassword").val(data.password); + $(".inputpincode").val(data.pincode); $(".loginform").submit(); } }); @@ -306,4 +329,4 @@ - \ No newline at end of file +