feat(auth): invite links for several people, invite by email, registration with approval or email domains
MindSift CI & Docker Release / Build, Test in Container & Push (push) Successful in 2m20s
MindSift CI & Docker Release / Build, Test in Container & Push (push) Successful in 2m20s
- Invites: link /?invite=CODE, copy link, send by email, max uses with counter - Registration modes closed | approval | domain | domain+approval | open, waiting list with approve/reject - REGISTRATION_MODE / REGISTRATION_DOMAINS lock the admin setting; ALLOW_REGISTRATION=true is honoured Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
db5c5cde9b
commit
af77b9e809
24 files changed
+1077
-142
No files matched your search
@@ -138,6 +138,10 @@ func (s *Store) GetSystemSettings() (*domain.SystemSettings, error) {
|
||||
settings.SharingMode = v
|
||||
case "allow_registration":
|
||||
settings.AllowRegistration = (v == "true" || v == "1")
|
||||
case "registration_mode":
|
||||
settings.RegistrationMode = NormalizeRegistrationMode(v)
|
||||
case "registration_domains":
|
||||
settings.RegistrationDomains = v
|
||||
case "instance_name":
|
||||
settings.InstanceName = v
|
||||
case "smtp_host":
|
||||
@@ -173,10 +177,28 @@ func (s *Store) GetSystemSettings() (*domain.SystemSettings, error) {
|
||||
}
|
||||
}
|
||||
}
|
||||
// Older installations only knew the open/closed switch
|
||||
if settings.RegistrationMode == "" {
|
||||
settings.RegistrationMode = RegistrationClosed
|
||||
if settings.AllowRegistration {
|
||||
settings.RegistrationMode = RegistrationOpen
|
||||
}
|
||||
}
|
||||
settings.AllowRegistration = settings.RegistrationMode == RegistrationOpen
|
||||
return settings, nil
|
||||
}
|
||||
|
||||
func (s *Store) UpdateSystemSettings(settings *domain.SystemSettings) error {
|
||||
// Clients that only send the old switch keep working
|
||||
settings.RegistrationMode = NormalizeRegistrationMode(settings.RegistrationMode)
|
||||
if settings.RegistrationMode == "" {
|
||||
settings.RegistrationMode = RegistrationClosed
|
||||
if settings.AllowRegistration {
|
||||
settings.RegistrationMode = RegistrationOpen
|
||||
}
|
||||
}
|
||||
settings.AllowRegistration = settings.RegistrationMode == RegistrationOpen
|
||||
settings.RegistrationDomains = strings.Join(ParseEmailDomains(settings.RegistrationDomains), ", ")
|
||||
regStr := "false"
|
||||
if settings.AllowRegistration {
|
||||
regStr = "true"
|
||||
@@ -221,7 +243,9 @@ func (s *Store) UpdateSystemSettings(settings *domain.SystemSettings) error {
|
||||
('allow_private_webhooks', ?),
|
||||
('backup_enabled', ?),
|
||||
('backup_time', ?),
|
||||
('backup_retention_days', ?)
|
||||
('backup_retention_days', ?),
|
||||
('registration_mode', ?),
|
||||
('registration_domains', ?)
|
||||
ON CONFLICT(key) DO UPDATE SET value = excluded.value`,
|
||||
settings.SharingMode,
|
||||
regStr,
|
||||
@@ -238,6 +262,8 @@ func (s *Store) UpdateSystemSettings(settings *domain.SystemSettings) error {
|
||||
strconv.FormatBool(settings.BackupEnabled),
|
||||
settings.BackupTime,
|
||||
strconv.Itoa(settings.BackupRetentionDays),
|
||||
settings.RegistrationMode,
|
||||
settings.RegistrationDomains,
|
||||
)
|
||||
return err
|
||||
}
|
||||
Reference in new issue
Block a user