summaryrefslogtreecommitdiff
path: root/pkg/backend
diff options
context:
space:
mode:
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"`