added setting to turn off login/edits - LOGIN_AND_EDITS

This commit is contained in:
2026-04-23 06:19:45 +00:00
parent 3c70cb99a3
commit a30eb4d42d
6 changed files with 33 additions and 6 deletions
+5
View File
@@ -45,6 +45,7 @@ type Config struct {
RequireAdminActivation bool
RequireEmailConfirmation bool
MFAEnabledByDefault bool
LoginAndEdits bool
// Security settings (failed-login thresholds and auto-ban config)
PwdFailuresThreshold int
@@ -92,6 +93,7 @@ var defaultConfig = map[string]map[string]string{
"REQUIRE_ADMIN_ACTIVATION": "true",
"REQUIRE_EMAIL_CONFIRMATION": "false",
"MFA_ENABLED_BY_DEFAULT": "false",
"LOGIN_AND_EDITS": "true",
},
"SECURITY": {
"PWD_FAILURES_THRESHOLD": "5",
@@ -219,6 +221,7 @@ func Load() (*Config, error) {
config.RequireAdminActivation, _ = authSection.Key("REQUIRE_ADMIN_ACTIVATION").Bool()
config.RequireEmailConfirmation, _ = authSection.Key("REQUIRE_EMAIL_CONFIRMATION").Bool()
config.MFAEnabledByDefault, _ = authSection.Key("MFA_ENABLED_BY_DEFAULT").Bool()
config.LoginAndEdits, _ = authSection.Key("LOGIN_AND_EDITS").Bool()
// Load SECURITY section
secSection := cfg.Section("SECURITY")
@@ -395,6 +398,8 @@ func (c *Config) SaveSetting(section, key, value string) error {
c.RequireEmailConfirmation = value == "true"
case "MFA_ENABLED_BY_DEFAULT":
c.MFAEnabledByDefault = value == "true"
case "LOGIN_AND_EDITS":
c.LoginAndEdits = value == "true"
}
case "SECURITY":
switch key {