summaryrefslogtreecommitdiff
path: root/pkg/backend
diff options
context:
space:
mode:
authorkali kaneko (leap communications) <kali@leap.se>2020-08-17 19:42:15 +0200
committerkali kaneko (leap communications) <kali@leap.se>2020-08-20 20:27:45 +0200
commita10c5ecd2b4bba6814fd66f0ec1997938d95bf92 (patch)
tree5002b8d9e6709d3c277682039bac3411ffc8f643 /pkg/backend
parent60a35bdde41e8648594dc6a501a11000081ff878 (diff)
[feat] login feedback
- Resolves: #334
Diffstat (limited to 'pkg/backend')
-rw-r--r--pkg/backend/api.go9
-rw-r--r--pkg/backend/status.go1
2 files changed, 7 insertions, 3 deletions
diff --git a/pkg/backend/api.go b/pkg/backend/api.go
index 7b48906..6609b1b 100644
--- a/pkg/backend/api.go
+++ b/pkg/backend/api.go
@@ -16,16 +16,19 @@ import (
func Login(username, password string) {
success, err := ctx.bm.DoLogin(username, password)
if err != nil {
- // TODO
- log.Printf("Error login: %v", err)
+ log.Printf("Error on login: %v", err)
+ ctx.Errors = "bad_auth_unknown"
} else if success {
- // TODO: Notify success
log.Printf("Logged in as %s", username)
+ 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"
}
+ go ctx.updateStatus()
}
func SwitchOn() {
diff --git a/pkg/backend/status.go b/pkg/backend/status.go
index 5e9a0f8..f06d26d 100644
--- a/pkg/backend/status.go
+++ b/pkg/backend/status.go
@@ -38,6 +38,7 @@ type connectionCtx struct {
DonateDialog bool `json:"donateDialog"`
DonateURL string `json:"donateURL"`
LoginDialog bool `json:"loginDialog"`
+ LoginOk bool `json:"loginOk"`
Version string `json:"version"`
Errors string `json:"errors"`
Status status `json:"status"`