summaryrefslogtreecommitdiff
path: root/pkg/backend
diff options
context:
space:
mode:
authorkali <kali@leap.se>2020-09-29 20:41:55 +0200
committerRuben Pollan <meskio@sindominio.net>2020-10-13 19:08:42 +0200
commit47ac0543b9ed2d4afb8814a19e2f4dc3c30030e1 (patch)
tree1634c42bebe7d8f59c7b56cb9800aba6ea4466f6 /pkg/backend
parent2cf32806dcce2d41920be28bd0e7d12e5d049357 (diff)
[feat] improve error handling during login
Diffstat (limited to 'pkg/backend')
-rw-r--r--pkg/backend/api.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/pkg/backend/api.go b/pkg/backend/api.go
index 1d44f8a..4390fef 100644
--- a/pkg/backend/api.go
+++ b/pkg/backend/api.go
@@ -18,10 +18,12 @@ import (
func Login(username, password string) {
success, err := ctx.bm.DoLogin(username, password)
if err != nil {
- log.Printf("Error on login: %v", err)
- if err.Error() == "Cannot get token: Error 502" {
+ if err.Error() == "TokenErrTimeout" {
+ ctx.Errors = "bad_auth_timeout"
+ } else if err.Error() == "TokenErrBadStatus 502" {
ctx.Errors = "bad_auth_502"
} else {
+ log.Println("ERROR: bad login", err)
ctx.Errors = "bad_auth"
}
} else if success {
@@ -29,7 +31,6 @@ func Login(username, password string) {
ctx.LoginOk = true
ctx.LoginDialog = false
} else {
- // TODO: display login again with an err
log.Printf("Failed to login as %s", username)
ctx.LoginDialog = true
ctx.Errors = "bad_auth"