diff options
author | Ruben Pollan <meskio@sindominio.net> | 2020-08-06 13:01:22 +0200 |
---|---|---|
committer | kali kaneko (leap communications) <kali@leap.se> | 2020-08-20 20:27:44 +0200 |
commit | 60a35bdde41e8648594dc6a501a11000081ff878 (patch) | |
tree | 20336cb66893e265c9125f66dc3e942ff8e1c467 /pkg/backend/api.go | |
parent | 249a8844b1aaf2cd2bf6fddc8da10a4defb656d2 (diff) |
[pkg] add float-deployed demo libpvn for tests
Diffstat (limited to 'pkg/backend/api.go')
-rw-r--r-- | pkg/backend/api.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/pkg/backend/api.go b/pkg/backend/api.go index ff8c1bb..7b48906 100644 --- a/pkg/backend/api.go +++ b/pkg/backend/api.go @@ -13,6 +13,21 @@ import ( "0xacab.org/leap/bitmask-vpn/pkg/pickle" ) +func Login(username, password string) { + success, err := ctx.bm.DoLogin(username, password) + if err != nil { + // TODO + log.Printf("Error login: %v", err) + } else if success { + // TODO: Notify success + log.Printf("Logged in as %s", username) + } else { + // TODO: display login again with an err + log.Printf("Failed to login as %s", username) + ctx.LoginDialog = true + } +} + func SwitchOn() { go setStatus(starting) go startVPN() @@ -57,6 +72,9 @@ func InitializeBitmaskContext(opts *InitOpts) { initOnce.Do(func() { initializeContext(opts) }) runDonationReminder() if ctx.bm != nil { + if ctx.bm.NeedsCredentials() { + ctx.LoginDialog = true + } go ctx.updateStatus() } } |