Improve login
This commit is contained in:
parent
41560fa87c
commit
784bf35c6a
@ -39,15 +39,16 @@
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
performLoginPlayerRequest(username, password)
|
performLoginPlayerRequest(username, password)
|
||||||
.then(function(token) {
|
.catch(function(error) {
|
||||||
storePlayerNameAndToken(username, token)
|
|
||||||
window.location.href = "schafkopf.html";
|
|
||||||
}).catch(function(error) {
|
|
||||||
console.log("Failed to log in")
|
console.log("Failed to log in")
|
||||||
console.log(error)
|
console.log(error)
|
||||||
// TODO: Create better error message for user
|
// TODO: Create better error message for user
|
||||||
setTextHint(error);
|
setTextHint(error);
|
||||||
})
|
})
|
||||||
|
.then(function(token) {
|
||||||
|
storePlayerNameAndToken(username, token);
|
||||||
|
showTableList();
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function showDebugLogins() {
|
function showDebugLogins() {
|
||||||
|
@ -55,10 +55,15 @@ function loadExistingSession() {
|
|||||||
resumeSessionRequest(token)
|
resumeSessionRequest(token)
|
||||||
.then(function(name) {
|
.then(function(name) {
|
||||||
storePlayerNameAndToken(name, token);
|
storePlayerNameAndToken(name, token);
|
||||||
window.location.href = "list.html";
|
showTableList();
|
||||||
}).catch(function(error) {
|
}).catch(function(error) {
|
||||||
// We don't expect a session to resume if the registration page is shown,
|
// We don't expect a session to resume if the registration page is shown,
|
||||||
// and if the token is expired on the login page we just fail quietly.
|
// and if the token is expired on the login page we just fail quietly.
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
deleteSessionToken();
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showTableList() {
|
||||||
|
window.location.href = "list.html";
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user