summaryrefslogtreecommitdiff
path: root/client/client.go
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2024-03-14 17:19:25 +0100
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2024-03-14 17:19:25 +0100
commit948d986fda345ff41da699adf2dbf26144269145 (patch)
tree5800568b9a7af700e346067a3ad7c84096b9e519 /client/client.go
parent35b11f421c23b18680b9468cca6cdec08430aba7 (diff)
Client + Server: Cache secure internet profile choice per location
Diffstat (limited to 'client/client.go')
-rw-r--r--client/client.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/client/client.go b/client/client.go
index 73f94d3..cfb95eb 100644
--- a/client/client.go
+++ b/client/client.go
@@ -517,6 +517,16 @@ func (c *Client) SetSecureLocation(orgID string, countryCode string) error {
return i18nerr.Wrapf(err, "Failed to get the secure internet server with id: '%s' for setting a location", orgID)
}
srv.CountryCode = countryCode
+
+ // no cached location profiles
+ if srv.LocationProfiles == nil {
+ return nil
+ }
+
+ // restore profile from the location
+ if v, ok := srv.LocationProfiles[srv.CountryCode]; ok {
+ srv.Profiles.Current = v
+ }
return nil
}