form: add setting for changing redirect url

for #167, Settings > General (Advanced) > Form success redirect URL.
This commit is contained in:
Harvey Tindall 2021-12-20 20:44:08 +00:00
parent d8b1f03ac4
commit e6cc7fce1a
Signed by: hrfee
GPG Key ID: BBC65952848FB1A2
3 changed files with 14 additions and 3 deletions

View File

@ -39,6 +39,8 @@ func (app *appContext) loadConfig() error {
app.MustSetValue("jellyfin", "public_server", app.config.Section("jellyfin").Key("server").String())
app.MustSetValue("ui", "redirect_url", app.config.Section("jellyfin").Key("public_server").String())
for _, key := range app.config.Section("files").Keys() {
if name := key.Name(); name != "html_templates" && name != "lang_files" {
key.SetValue(key.MustString(filepath.Join(app.dataPath, (key.Name() + ".json"))))

View File

@ -247,6 +247,15 @@
"type": "text",
"value": "",
"description": "URL base for when running jfa-go with a reverse proxy in a subfolder. include preceding /, e.g \"/accounts\"."
},
"redirect_url": {
"name": "Form success redirect URL",
"required": false,
"requires_restart": false,
"type": "text",
"value": "",
"advanced": true,
"description": "Set a different URL for the sign-up form to redirect the user to when they've signed up. Default to 'Public Server' or 'Server' in the Jellyfin tab."
}
}
},

View File

@ -160,7 +160,7 @@ func (app *appContext) ResetPassword(gc *gin.Context) {
if isInternal && setPassword {
data["helpMessage"] = app.config.Section("ui").Key("help_message").String()
data["successMessage"] = app.config.Section("ui").Key("success_message").String()
data["jfLink"] = app.config.Section("jellyfin").Key("public_server").String()
data["jfLink"] = app.config.Section("ui").Key("redirect_url").String()
data["validate"] = app.config.Section("password_validation").Key("enabled").MustBool(false)
data["requirements"] = app.validator.getCriteria()
data["strings"] = app.storage.lang.PasswordReset[lang].Strings
@ -313,7 +313,7 @@ func (app *appContext) InviteProxy(gc *gin.Context) {
"strings": app.storage.lang.Form[lang].Strings,
"successMessage": app.config.Section("ui").Key("success_message").String(),
"contactMessage": app.config.Section("ui").Key("contact_message").String(),
"jfLink": app.config.Section("jellyfin").Key("public_server").String(),
"jfLink": app.config.Section("ui").Key("redirect_url").String(),
})
inv, ok := app.storage.invites[code]
if ok {
@ -337,7 +337,7 @@ func (app *appContext) InviteProxy(gc *gin.Context) {
"contactMessage": app.config.Section("ui").Key("contact_message").String(),
"helpMessage": app.config.Section("ui").Key("help_message").String(),
"successMessage": app.config.Section("ui").Key("success_message").String(),
"jfLink": app.config.Section("jellyfin").Key("public_server").String(),
"jfLink": app.config.Section("ui").Key("redirect_url").String(),
"validate": app.config.Section("password_validation").Key("enabled").MustBool(false),
"requirements": app.validator.getCriteria(),
"email": email,