From f8b59a50ffd9137f4e333f853032ca9f31cdc651 Mon Sep 17 00:00:00 2001 From: Jeremy Wharton Date: Tue, 17 Oct 2023 05:08:19 -0500 Subject: [PATCH] satellite/console: configure sending invites to unregistered emails This change adds a flag to the satellite config indicating whether unregistered email addresses should receive project invitation emails. Change-Id: I0396f25574ddae3f9adaea32a6e7cd15b931bf12 --- satellite/console/config.go | 27 ++++++++++--------- satellite/console/consoleweb/config.go | 1 + satellite/console/consoleweb/server.go | 1 + satellite/console/service.go | 2 +- scripts/testdata/satellite-config.yaml.lock | 3 +++ .../components/modals/AddTeamMemberModal.vue | 18 +++++++++++-- .../src/components/team/HeaderArea.vue | 14 ++++++++-- .../components/team/ProjectMembersArea.vue | 17 ++++++++++-- .../src/store/modules/notificationsStore.ts | 3 ++- web/satellite/src/types/config.gen.ts | 4 ++- .../src/utils/plugins/notificator.ts | 4 +-- .../src/components/TeamTableComponent.vue | 12 +++++++-- .../dialogs/AddTeamMemberDialog.vue | 14 +++++++++- 13 files changed, 93 insertions(+), 27 deletions(-) diff --git a/satellite/console/config.go b/satellite/console/config.go index 34090fe5d..976d97567 100644 --- a/satellite/console/config.go +++ b/satellite/console/config.go @@ -14,19 +14,20 @@ import ( // Config keeps track of core console service configuration parameters. type Config struct { - PasswordCost int `help:"password hashing cost (0=automatic)" testDefault:"4" default:"0"` - OpenRegistrationEnabled bool `help:"enable open registration" default:"false" testDefault:"true"` - DefaultProjectLimit int `help:"default project limits for users" default:"1" testDefault:"5"` - AsOfSystemTimeDuration time.Duration `help:"default duration for AS OF SYSTEM TIME" devDefault:"-5m" releaseDefault:"-5m" testDefault:"0"` - LoginAttemptsWithoutPenalty int `help:"number of times user can try to login without penalty" default:"3"` - FailedLoginPenalty float64 `help:"incremental duration of penalty for failed login attempts in minutes" default:"2.0"` - ProjectInvitationExpiration time.Duration `help:"duration that project member invitations are valid for" default:"168h"` - UserBalanceForUpgrade int64 `help:"amount of base units of US micro dollars needed to upgrade user's tier status" default:"10000000"` - PlacementEdgeURLOverrides PlacementEdgeURLOverrides `help:"placement-specific edge service URL overrides in the format {\"placementID\": {\"authService\": \"...\", \"publicLinksharing\": \"...\", \"internalLinksharing\": \"...\"}, \"placementID2\": ...}"` - BlockExplorerURL string `help:"url of the transaction block explorer" default:"https://etherscan.io/"` - UsageLimits UsageLimitsConfig - Captcha CaptchaConfig - Session SessionConfig + PasswordCost int `help:"password hashing cost (0=automatic)" testDefault:"4" default:"0"` + OpenRegistrationEnabled bool `help:"enable open registration" default:"false" testDefault:"true"` + DefaultProjectLimit int `help:"default project limits for users" default:"1" testDefault:"5"` + AsOfSystemTimeDuration time.Duration `help:"default duration for AS OF SYSTEM TIME" devDefault:"-5m" releaseDefault:"-5m" testDefault:"0"` + LoginAttemptsWithoutPenalty int `help:"number of times user can try to login without penalty" default:"3"` + FailedLoginPenalty float64 `help:"incremental duration of penalty for failed login attempts in minutes" default:"2.0"` + ProjectInvitationExpiration time.Duration `help:"duration that project member invitations are valid for" default:"168h"` + UnregisteredInviteEmailsEnabled bool `help:"indicates whether invitation emails can be sent to unregistered email addresses" default:"false"` + UserBalanceForUpgrade int64 `help:"amount of base units of US micro dollars needed to upgrade user's tier status" default:"10000000"` + PlacementEdgeURLOverrides PlacementEdgeURLOverrides `help:"placement-specific edge service URL overrides in the format {\"placementID\": {\"authService\": \"...\", \"publicLinksharing\": \"...\", \"internalLinksharing\": \"...\"}, \"placementID2\": ...}"` + BlockExplorerURL string `help:"url of the transaction block explorer" default:"https://etherscan.io/"` + UsageLimits UsageLimitsConfig + Captcha CaptchaConfig + Session SessionConfig } // CaptchaConfig contains configurations for login/registration captcha system. diff --git a/satellite/console/consoleweb/config.go b/satellite/console/consoleweb/config.go index 7ed234e9b..76e92cb52 100644 --- a/satellite/console/consoleweb/config.go +++ b/satellite/console/consoleweb/config.go @@ -51,6 +51,7 @@ type FrontendConfig struct { NeededTransactionConfirmations int `json:"neededTransactionConfirmations"` ObjectBrowserPaginationEnabled bool `json:"objectBrowserPaginationEnabled"` BillingFeaturesEnabled bool `json:"billingFeaturesEnabled"` + UnregisteredInviteEmailsEnabled bool `json:"unregisteredInviteEmailsEnabled"` } // Satellites is a configuration value that contains a list of satellite names and addresses. diff --git a/satellite/console/consoleweb/server.go b/satellite/console/consoleweb/server.go index 1b707e834..58b742055 100644 --- a/satellite/console/consoleweb/server.go +++ b/satellite/console/consoleweb/server.go @@ -750,6 +750,7 @@ func (server *Server) frontendConfigHandler(w http.ResponseWriter, r *http.Reque NeededTransactionConfirmations: server.neededTokenPaymentConfirmations, ObjectBrowserPaginationEnabled: server.config.ObjectBrowserPaginationEnabled, BillingFeaturesEnabled: server.config.BillingFeaturesEnabled, + UnregisteredInviteEmailsEnabled: server.config.UnregisteredInviteEmailsEnabled, } err := json.NewEncoder(w).Encode(&cfg) diff --git a/satellite/console/service.go b/satellite/console/service.go index bae0249b2..4677c8c5f 100644 --- a/satellite/console/service.go +++ b/satellite/console/service.go @@ -3821,7 +3821,7 @@ func (s *Service) inviteProjectMembers(ctx context.Context, sender *User, projec } } unverifiedUsers = append(unverifiedUsers, oldest) - } else { + } else if s.config.UnregisteredInviteEmailsEnabled { newUserEmails = append(newUserEmails, email) } } diff --git a/scripts/testdata/satellite-config.yaml.lock b/scripts/testdata/satellite-config.yaml.lock index 63274c8e3..695a5be78 100755 --- a/scripts/testdata/satellite-config.yaml.lock +++ b/scripts/testdata/satellite-config.yaml.lock @@ -400,6 +400,9 @@ compensation.withheld-percents: 75,75,75,50,50,50,25,25,25,0,0,0,0,0,0 # url link to terms and conditions page # console.terms-and-conditions-url: https://www.storj.io/terms-of-service/ +# indicates whether invitation emails can be sent to unregistered email addresses +# console.unregistered-invite-emails-enabled: false + # the default free-tier bandwidth usage limit # console.usage-limits.bandwidth.free: 25.00 GB diff --git a/web/satellite/src/components/modals/AddTeamMemberModal.vue b/web/satellite/src/components/modals/AddTeamMemberModal.vue index b332487a5..6517167e9 100644 --- a/web/satellite/src/components/modals/AddTeamMemberModal.vue +++ b/web/satellite/src/components/modals/AddTeamMemberModal.vue @@ -61,7 +61,7 @@