Improve login
This commit is contained in:
parent
41560fa87c
commit
784bf35c6a
@ -39,15 +39,16 @@
|
||||
return
|
||||
}
|
||||
performLoginPlayerRequest(username, password)
|
||||
.then(function(token) {
|
||||
storePlayerNameAndToken(username, token)
|
||||
window.location.href = "schafkopf.html";
|
||||
}).catch(function(error) {
|
||||
.catch(function(error) {
|
||||
console.log("Failed to log in")
|
||||
console.log(error)
|
||||
// TODO: Create better error message for user
|
||||
setTextHint(error);
|
||||
})
|
||||
.then(function(token) {
|
||||
storePlayerNameAndToken(username, token);
|
||||
showTableList();
|
||||
})
|
||||
}
|
||||
|
||||
function showDebugLogins() {
|
||||
|
@ -55,10 +55,15 @@ function loadExistingSession() {
|
||||
resumeSessionRequest(token)
|
||||
.then(function(name) {
|
||||
storePlayerNameAndToken(name, token);
|
||||
window.location.href = "list.html";
|
||||
showTableList();
|
||||
}).catch(function(error) {
|
||||
// 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.
|
||||
console.log(error);
|
||||
deleteSessionToken();
|
||||
})
|
||||
}
|
||||
|
||||
function showTableList() {
|
||||
window.location.href = "list.html";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user