diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/api.go | 2 | ||||
| -rw-r--r-- | src/discovery.go | 2 | ||||
| -rw-r--r-- | src/oauth.go | 6 | ||||
| -rw-r--r-- | src/state.go | 4 |
4 files changed, 6 insertions, 8 deletions
@@ -16,7 +16,7 @@ func (server *Server) apiAuthenticated(method string, endpoint string, opts *HTT } url := server.Endpoints.API.V3.API + endpoint - // Ensure we have non-expired tokens + // Ensure we have valid tokens oauthErr := server.OAuth.EnsureTokens() if oauthErr != nil { diff --git a/src/discovery.go b/src/discovery.go index e88d74e..4498779 100644 --- a/src/discovery.go +++ b/src/discovery.go @@ -107,7 +107,6 @@ func (eduvpn *VPNState) GetOrganizationsList() (string, error) { } eduvpn.EnsureDisco() eduvpn.DiscoList.Organizations = &body - eduvpn.WriteConfig() return body, nil } @@ -123,6 +122,5 @@ func (eduvpn *VPNState) GetServersList() (string, error) { } eduvpn.EnsureDisco() eduvpn.DiscoList.Servers = &body - eduvpn.WriteConfig() return body, nil } diff --git a/src/oauth.go b/src/oauth.go index eb4e13f..831fa0f 100644 --- a/src/oauth.go +++ b/src/oauth.go @@ -292,15 +292,11 @@ func (state *VPNState) LoginOAuth() error { if oauthErr != nil { return oauthErr } - - state.WriteConfig() return nil } func (oauth *OAuth) Login() error { - // FIXME: Find a better way - state := GetVPNState() - return state.LoginOAuth() + return GetVPNState().LoginOAuth() } func (oauth *OAuth) NeedsRelogin() bool { diff --git a/src/state.go b/src/state.go index 23bc1cd..1eb8ebd 100644 --- a/src/state.go +++ b/src/state.go @@ -61,6 +61,10 @@ func (state *VPNState) Deregister() error { // Close the log file state.CloseLog() + // Write the config + state.WriteConfig() + + // Re-initialize the server and FSM state.Server = &Server{} state.InitializeFSM() return nil |
