diff --git a/config.go b/config.go index df6daa4..44a198f 100644 --- a/config.go +++ b/config.go @@ -266,6 +266,11 @@ func NewConfig(configPathOrContents any, dataPath string, logs LoggerSet) (*Conf config.Section("discord").Key("start_command").SetValue(strings.TrimPrefix(strings.TrimPrefix(sc, "/"), "!")) config.MustSetValue("email", "collect", "true") + collect := config.Section("email").Key("collect").MustBool(true) + required := config.Section("email").Key("required").MustBool(false) && collect + config.Section("email").Key("required").SetValue(strconv.FormatBool(required)) + unique := config.Section("email").Key("require_unique").MustBool(false) && collect + config.Section("email").Key("require_unique").SetValue(strconv.FormatBool(unique)) config.MustSetValue("matrix", "topic", "Jellyfin notifications") config.MustSetValue("matrix", "show_on_reg", "true") diff --git a/config/config-base.yaml b/config/config-base.yaml index 7d486d3..40a9e29 100644 --- a/config/config-base.yaml +++ b/config/config-base.yaml @@ -776,9 +776,27 @@ sections: - ["en-us", "English (US)"] value: en-us description: Default email language. Submit a PR on github if you'd like to translate. + - setting: collect + name: Collect on sign-up + type: bool + value: true + description: Ask for an email address on the sign-up form. + - setting: required + name: Require on sign-up + depends_true: collect + type: bool + value: false + description: Require an email address on sign-up. + - setting: require_unique + name: Require unique address + requires_restart: true + depends_true: method + type: bool + value: false + description: Disables using the same address on multiple accounts. - setting: no_username name: Use email addresses as username - depends_true: method + depends_true: collect type: bool value: false description: Use email address from invite form as username on Jellyfin. @@ -811,25 +829,6 @@ sections: type: bool value: false description: Send emails as plain text instead of HTML. - - setting: collect - name: Collect on sign-up - depends_true: method - type: bool - value: true - description: Ask for an email address on the sign-up form. - - setting: required - name: Require on sign-up - depends_true: collect - type: bool - value: false - description: Require an email address on sign-up. - - setting: require_unique - name: Require unique address - requires_restart: true - depends_true: method - type: bool - value: false - description: Disables using the same address on multiple accounts. - setting: test_note name: 'Test your settings:' type: note @@ -1483,7 +1482,7 @@ sections: name: Email confirmation description: If enabled, a user will be sent an email confirmation link to ensure their password is right before they can make an account. - depends_true: email|method + depends_true: email|collect settings: - setting: enabled name: Enabled diff --git a/html/form-base.html b/html/form-base.html index 77e6a36..f21475e 100644 --- a/html/form-base.html +++ b/html/form-base.html @@ -27,6 +27,7 @@ window.reCAPTCHASiteKey = "{{ .reCAPTCHASiteKey }}"; window.userPageEnabled = {{ .userPageEnabled }}; window.userPageAddress = "{{ .userPageAddress }}"; + window.collectEmail = {{ .collectEmail }}; {{ if index . "customSuccessCard" }} window.customSuccessCard = {{ .customSuccessCard }}; {{ else }} diff --git a/html/form.html b/html/form.html index 336d21d..acfbf29 100644 --- a/html/form.html +++ b/html/form.html @@ -68,8 +68,10 @@ - - +