Skip to content
Permalink
Browse files

Merge pull request #256 from lusbenjamin/login-bugfix

Login bugfix
  • Loading branch information...
Manuel-777 committed Apr 13, 2019
2 parents 3d8559d + bb0bf7d commit c9cf0dcff11c9ee4769a6067a0e88d0585bdd302
Showing with 21 additions and 11 deletions.
  1. +9 −8 window_background/http-api.js
  2. +3 −2 window_main/index.html
  3. +9 −1 window_main/renderer.js
@@ -342,14 +342,15 @@ function httpBasic() {
});
}
if (_headers.method == "auth") {
if (parsedResult.error == "Invalid credentials.") {
tokenAuth = undefined;
rstore.set("email", "");
rstore.set("token", "");
ipc_send("auth", {});
ipc_send("clear_pwd", 1);
ipc_send("set_remember", false);
}
tokenAuth = undefined;
rstore.set("email", "");
rstore.set("token", "");
ipc_send("auth", {});
ipc_send("clear_pwd", 1);
ipc_send("popup", {
text: `Error: ${parsedResult.error}`,
time: 3000
});
}
// errors here
} else if (!parsedResult && _headers.method == "auth") {
@@ -96,7 +96,7 @@
<div class="message_sub white">Just a moment..</div>
</div>

<div class="authenticate">
<form id="authenticate_form" class="authenticate">
<div class="message_big green">Welcome!</div>
<label style="display: table">Email</label>
<div class="input_login_container">
@@ -107,6 +107,7 @@
<input type="password" id="signin_pass" autocomplete="off" />
</div>
<div class="button_simple_disabled centered login_link">Login</div>
<input type="submit" style="display:none" />

<label class="check_container check_container_centered hover_label">Remember me?
<input type="checkbox" id="rememberme" onclick="rememberMe()" />
@@ -116,7 +117,7 @@
<div class="message_small">Dont have an account? <a class="signup_link">Sign up!</a></div>
<div class="message_small">You can also <a class="offline_link">continue offline</a></div>
--<div class="message_small">Did you <a class="forgot_link">forget your password?</a></div>
</div>
</form>
</div>
</div>
</body>
@@ -237,6 +237,7 @@ ipc.on("set_db", function(event, arg) {
canLogin = true;
cardsDb.set(arg);
$(".button_simple_disabled").addClass("button_simple");
$("#signin_user").focus();
} catch (e) {
pop("Error parsing metadata", null);
console.log("Error parsing metadata", e);
@@ -855,7 +856,7 @@ $(document).ready(function() {
shell.openExternal("https://mtgatool.com/resetpassword/");
});

$(".login_link").click(function() {
function submitAuthenticateForm() {
if (canLogin) {
var user = document.getElementById("signin_user").value;
var pass = document.getElementById("signin_pass").value;
@@ -865,8 +866,15 @@ $(document).ready(function() {
ipc_send("login", { username: user, password: pass });
canLogin = false;
}
}

$("#authenticate_form").on("submit", e => {
e.preventDefault();
submitAuthenticateForm();
});

$(".login_link").click(submitAuthenticateForm);

//
$(".close").click(function() {
ipc_send("renderer_window_close", 1);

0 comments on commit c9cf0dc

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