Skip to content
Permalink
Browse files

dont allow double login

  • Loading branch information...
Manuel-777 committed Jul 9, 2019
1 parent eb7d2ea commit 37ec53aaf38f45f8cf3bbabfba03c17a2a385f9d
Showing with 21 additions and 1 deletion.
  1. +1 −0 window_background/background.js
  2. +1 −0 window_background/http-api.js
  3. +19 −1 window_main/renderer.js
@@ -1055,6 +1055,7 @@ async function logLoop() {
ipc_send("show_login", true);

if (auto_login) {
ipc_send("disable_login", true);
if (remember_me && username && tokenAuth) {
ipc_send("popup", {
text: "Logging in automatically...",
@@ -291,6 +291,7 @@ function httpBasic() {
rstore.set("email", "");
rstore.set("token", "");
ipc_send("auth", {});
ipc_send("enable_login", true);
ipc_send("clear_pwd", 1);
ipc_send("popup", {
text: `Error: ${parsedResult.error}`,
@@ -582,6 +582,24 @@ function ready(fn) {
}
}

ipc.on("enable_login", () => {
loginEnable();
});

ipc.on("disable_login", () => {
loginDisable();
});

function loginDisable() {
canLogin = false;
$$(".login_link")[0].classList.add("disabled");
}

function loginEnable() {
canLogin = true;
$$(".login_link")[0].classList.remove("disabled");
}

ready(function() {
$$(".signup_link")[0].addEventListener("click", function() {
shell.openExternal("https://mtgatool.com/signup/");
@@ -603,7 +621,7 @@ ready(function() {
pass = sha1(pass);
}
ipcSend("login", { username: user, password: pass });
canLogin = false;
loginDisable();
}
}

0 comments on commit 37ec53a

Please sign in to comment.
You can’t perform that action at this time.