From 60a35bdde41e8648594dc6a501a11000081ff878 Mon Sep 17 00:00:00 2001 From: Ruben Pollan Date: Thu, 6 Aug 2020 13:01:22 +0200 Subject: [pkg] add float-deployed demo libpvn for tests --- pkg/backend/api.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'pkg/backend/api.go') 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() } } -- cgit v1.2.3