diff options
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/backend/api.go | 18 | ||||
-rw-r--r-- | pkg/backend/status.go | 1 | ||||
-rw-r--r-- | pkg/config/config.go | 59 |
3 files changed, 37 insertions, 41 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() } } diff --git a/pkg/backend/status.go b/pkg/backend/status.go index 2bfb52d..5e9a0f8 100644 --- a/pkg/backend/status.go +++ b/pkg/backend/status.go @@ -37,6 +37,7 @@ type connectionCtx struct { AskForDonations bool `json:"askForDonations"` DonateDialog bool `json:"donateDialog"` DonateURL string `json:"donateURL"` + LoginDialog bool `json:"loginDialog"` Version string `json:"version"` Errors string `json:"errors"` Status status `json:"status"` diff --git a/pkg/config/config.go b/pkg/config/config.go index 80f5df4..e9866d2 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -1,22 +1,22 @@ // Code generated by go generate; DO NOT EDIT. // This file was generated by vendorize.py -// At 2020-06-16 21:44:41 +// At 2020-08-13 22:38:42 package config /* All these constants are defined in the vendor.conf file */ const ( - Provider = "riseup.net" - ApplicationName = "RiseupVPN" - BinaryName = "riseup-vpn" - Auth = "anon" - DonateURL = "https://riseup.net/vpn/donate" - AskForDonations = "true" - HelpURL = "https://riseup.net/support" - TosURL = "https://riseup.net/tos" - APIURL = "https://api.black.riseup.net/" - GeolocationAPI = "https://api.black.riseup.net:9001/json" + Provider = "vpnlib.bitmask.net" + ApplicationName = "DemoLib" + BinaryName = "demo-lib" + Auth = "sip" + DonateURL = "" + AskForDonations = "false" + HelpURL = "https://libraryvpn.org/" + TosURL = "https://libraryvpn.org/" + APIURL = "https://api.vpnlib.bitmask.net/" + GeolocationAPI = "https://getmyip.vpnlib.bitmask.net/" ) var Version string @@ -29,34 +29,11 @@ CaCert : a string containing a representation of the provider CA, used to */ var CaCert = []byte(`-----BEGIN CERTIFICATE----- -MIIFjTCCA3WgAwIBAgIBATANBgkqhkiG9w0BAQ0FADBZMRgwFgYDVQQKDA9SaXNl -dXAgTmV0d29ya3MxGzAZBgNVBAsMEmh0dHBzOi8vcmlzZXVwLm5ldDEgMB4GA1UE -AwwXUmlzZXVwIE5ldHdvcmtzIFJvb3QgQ0EwHhcNMTQwNDI4MDAwMDAwWhcNMjQw -NDI4MDAwMDAwWjBZMRgwFgYDVQQKDA9SaXNldXAgTmV0d29ya3MxGzAZBgNVBAsM -Emh0dHBzOi8vcmlzZXVwLm5ldDEgMB4GA1UEAwwXUmlzZXVwIE5ldHdvcmtzIFJv -b3QgQ0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC76J4ciMJ8Sg0m -TP7DF2DT9zNe0Csk4myoMFC57rfJeqsAlJCv1XMzBmXrw8wq/9z7XHv6n/0sWU7a -7cF2hLR33ktjwODlx7vorU39/lXLndo492ZBhXQtG1INMShyv+nlmzO6GT7ESfNE -LliFitEzwIegpMqxCIHXFuobGSCWF4N0qLHkq/SYUMoOJ96O3hmPSl1kFDRMtWXY -iw1SEKjUvpyDJpVs3NGxeLCaA7bAWhDY5s5Yb2fA1o8ICAqhowurowJpW7n5ZuLK -5VNTlNy6nZpkjt1QycYvNycffyPOFm/Q/RKDlvnorJIrihPkyniV3YY5cGgP+Qkx -HUOT0uLA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