form: functional "collect on sign-up" setting
was added without functionality by accident in a7aa3fd. This commit adds
the functionality in. Probably some other fixes too.
This commit is contained in:
@@ -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.Section("discord").Key("start_command").SetValue(strings.TrimPrefix(strings.TrimPrefix(sc, "/"), "!"))
|
||||||
|
|
||||||
config.MustSetValue("email", "collect", "true")
|
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", "topic", "Jellyfin notifications")
|
||||||
config.MustSetValue("matrix", "show_on_reg", "true")
|
config.MustSetValue("matrix", "show_on_reg", "true")
|
||||||
|
|||||||
+20
-21
@@ -776,9 +776,27 @@ sections:
|
|||||||
- ["en-us", "English (US)"]
|
- ["en-us", "English (US)"]
|
||||||
value: en-us
|
value: en-us
|
||||||
description: Default email language. Submit a PR on github if you'd like to translate.
|
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
|
- setting: no_username
|
||||||
name: Use email addresses as username
|
name: Use email addresses as username
|
||||||
depends_true: method
|
depends_true: collect
|
||||||
type: bool
|
type: bool
|
||||||
value: false
|
value: false
|
||||||
description: Use email address from invite form as username on Jellyfin.
|
description: Use email address from invite form as username on Jellyfin.
|
||||||
@@ -811,25 +829,6 @@ sections:
|
|||||||
type: bool
|
type: bool
|
||||||
value: false
|
value: false
|
||||||
description: Send emails as plain text instead of HTML.
|
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
|
- setting: test_note
|
||||||
name: 'Test your settings:'
|
name: 'Test your settings:'
|
||||||
type: note
|
type: note
|
||||||
@@ -1483,7 +1482,7 @@ sections:
|
|||||||
name: Email confirmation
|
name: Email confirmation
|
||||||
description: If enabled, a user will be sent an email confirmation link to ensure
|
description: If enabled, a user will be sent an email confirmation link to ensure
|
||||||
their password is right before they can make an account.
|
their password is right before they can make an account.
|
||||||
depends_true: email|method
|
depends_true: email|collect
|
||||||
settings:
|
settings:
|
||||||
- setting: enabled
|
- setting: enabled
|
||||||
name: Enabled
|
name: Enabled
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
window.reCAPTCHASiteKey = "{{ .reCAPTCHASiteKey }}";
|
window.reCAPTCHASiteKey = "{{ .reCAPTCHASiteKey }}";
|
||||||
window.userPageEnabled = {{ .userPageEnabled }};
|
window.userPageEnabled = {{ .userPageEnabled }};
|
||||||
window.userPageAddress = "{{ .userPageAddress }}";
|
window.userPageAddress = "{{ .userPageAddress }}";
|
||||||
|
window.collectEmail = {{ .collectEmail }};
|
||||||
{{ if index . "customSuccessCard" }}
|
{{ if index . "customSuccessCard" }}
|
||||||
window.customSuccessCard = {{ .customSuccessCard }};
|
window.customSuccessCard = {{ .customSuccessCard }};
|
||||||
{{ else }}
|
{{ else }}
|
||||||
|
|||||||
+4
-2
@@ -68,8 +68,10 @@
|
|||||||
<input type="text" class="input ~neutral @high mt-2 mb-4" placeholder="{{ .strings.username }}" id="create-username" aria-label="{{ .strings.username }}">
|
<input type="text" class="input ~neutral @high mt-2 mb-4" placeholder="{{ .strings.username }}" id="create-username" aria-label="{{ .strings.username }}">
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label class="label supra" for="create-email">{{ .strings.emailAddress }}</label>
|
<div>
|
||||||
<input type="email" class="input ~neutral @high mt-2 mb-4" placeholder="{{ .strings.emailAddress }}" id="create-email" aria-label="{{ .strings.emailAddress }}" value="{{ .email }}">
|
<label class="label supra" for="create-email">{{ .strings.emailAddress }}</label>
|
||||||
|
<input type="email" class="input ~neutral @high mt-2 mb-4" placeholder="{{ .strings.emailAddress }}" id="create-email" aria-label="{{ .strings.emailAddress }}" value="{{ .email }}">
|
||||||
|
</div>
|
||||||
{{ if .telegramEnabled }}
|
{{ if .telegramEnabled }}
|
||||||
<span class="button ~info @low full-width center mb-4" id="link-telegram">{{ .strings.linkTelegram }} {{ if .telegramRequired }}({{ .strings.required }}){{ end }}</span>
|
<span class="button ~info @low full-width center mb-4" id="link-telegram">{{ .strings.linkTelegram }} {{ if .telegramRequired }}({{ .strings.required }}){{ end }}</span>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|||||||
+7
-1
@@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/hrfee/jfa-go/jellyseerr"
|
"github.com/hrfee/jfa-go/jellyseerr"
|
||||||
@@ -28,7 +29,12 @@ func (app *appContext) SynchronizeJellyseerrUser(jfID string) {
|
|||||||
if ok && email.Addr != "" && user.Email != email.Addr {
|
if ok && email.Addr != "" && user.Email != email.Addr {
|
||||||
err = app.js.ModifyMainUserSettings(jfID, jellyseerr.MainUserSettings{Email: email.Addr})
|
err = app.js.ModifyMainUserSettings(jfID, jellyseerr.MainUserSettings{Email: email.Addr})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
app.err.Printf(lm.FailedSetEmailAddress, lm.Jellyseerr, jfID, err)
|
if strings.Contains(err.Error(), "INVALID_EMAIL") {
|
||||||
|
app.err.Printf(lm.FailedSetEmailAddress, lm.Jellyseerr, jfID, err.Error()+"\""+email.Addr+"\"")
|
||||||
|
} else {
|
||||||
|
|
||||||
|
app.err.Printf(lm.FailedSetEmailAddress, lm.Jellyseerr, jfID, err)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
contactMethods[jellyseerr.FieldEmailEnabled] = email.Contact
|
contactMethods[jellyseerr.FieldEmailEnabled] = email.Contact
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-1
@@ -39,6 +39,7 @@ interface formWindow extends GlobalWindow {
|
|||||||
userPageEnabled: boolean;
|
userPageEnabled: boolean;
|
||||||
userPageAddress: string;
|
userPageAddress: string;
|
||||||
customSuccessCard: boolean;
|
customSuccessCard: boolean;
|
||||||
|
collectEmail: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
loadLangSelector("form");
|
loadLangSelector("form");
|
||||||
@@ -171,7 +172,13 @@ const submitSpan = form.querySelector("span.submit") as HTMLSpanElement;
|
|||||||
const submitText = submitSpan.textContent;
|
const submitText = submitSpan.textContent;
|
||||||
let usernameField = document.getElementById("create-username") as HTMLInputElement;
|
let usernameField = document.getElementById("create-username") as HTMLInputElement;
|
||||||
const emailField = document.getElementById("create-email") as HTMLInputElement;
|
const emailField = document.getElementById("create-email") as HTMLInputElement;
|
||||||
if (!window.usernameEnabled) { usernameField.parentElement.remove(); usernameField = emailField; }
|
window.emailRequired &&= window.collectEmail;
|
||||||
|
if (!window.usernameEnabled) {
|
||||||
|
usernameField.parentElement.remove(); usernameField = emailField;
|
||||||
|
} else if (!window.collectEmail) {
|
||||||
|
emailField.parentElement.classList.add("unfocused");
|
||||||
|
emailField.value = "";
|
||||||
|
}
|
||||||
const passwordField = document.getElementById("create-password") as HTMLInputElement;
|
const passwordField = document.getElementById("create-password") as HTMLInputElement;
|
||||||
const rePasswordField = document.getElementById("create-reenter-password") as HTMLInputElement;
|
const rePasswordField = document.getElementById("create-reenter-password") as HTMLInputElement;
|
||||||
|
|
||||||
|
|||||||
@@ -299,6 +299,7 @@ func (app *appContext) ResetPassword(gc *gin.Context) {
|
|||||||
"strings": app.storage.lang.PasswordReset[lang].Strings,
|
"strings": app.storage.lang.PasswordReset[lang].Strings,
|
||||||
"success": false,
|
"success": false,
|
||||||
"customSuccessCard": false,
|
"customSuccessCard": false,
|
||||||
|
"collectEmail": app.config.Section("email").Key("collect").MustBool(true),
|
||||||
}
|
}
|
||||||
pwr, isInternal := app.internalPWRs[pin]
|
pwr, isInternal := app.internalPWRs[pin]
|
||||||
// if isInternal && setPassword {
|
// if isInternal && setPassword {
|
||||||
@@ -761,6 +762,7 @@ func (app *appContext) InviteProxy(gc *gin.Context) {
|
|||||||
"validate": app.config.Section("password_validation").Key("enabled").MustBool(false),
|
"validate": app.config.Section("password_validation").Key("enabled").MustBool(false),
|
||||||
"requirements": app.validator.getCriteria(),
|
"requirements": app.validator.getCriteria(),
|
||||||
"email": email,
|
"email": email,
|
||||||
|
"collectEmail": app.config.Section("email").Key("collect").MustBool(true),
|
||||||
"username": !app.config.Section("email").Key("no_username").MustBool(false),
|
"username": !app.config.Section("email").Key("no_username").MustBool(false),
|
||||||
"strings": app.storage.lang.User[lang].Strings,
|
"strings": app.storage.lang.User[lang].Strings,
|
||||||
"validationStrings": app.storage.lang.User[lang].validationStringsJSON,
|
"validationStrings": app.storage.lang.User[lang].validationStringsJSON,
|
||||||
|
|||||||
Reference in New Issue
Block a user