Skip to content

Commit

Permalink
form: add setting for changing redirect url
Browse files Browse the repository at this point in the history
for #167, Settings > General (Advanced) > Form success redirect URL.
  • Loading branch information
hrfee committed Dec 20, 2021
1 parent d8b1f03 commit e6cc7fc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 2 additions & 0 deletions config.go
Expand Up @@ -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"))))
Expand Down
9 changes: 9 additions & 0 deletions config/config-base.json
Expand Up @@ -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."
}
}
},
Expand Down
6 changes: 3 additions & 3 deletions views.go
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand All @@ -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,
Expand Down

0 comments on commit e6cc7fc

Please sign in to comment.