mirror of
https://github.com/hrfee/jfa-go.git
synced 2026-03-18 21:50:33 +01:00
userpage: fix redirect on contact method change
root userpage paths ("") would mess up the redirect, wrapper function
returns "/" if thats the case. For #455.
This commit is contained in:
@@ -199,7 +199,7 @@ func (app *appContext) confirmMyAction(gc *gin.Context, key string) {
|
|||||||
|
|
||||||
// Perform an Action
|
// Perform an Action
|
||||||
if target == NoOp {
|
if target == NoOp {
|
||||||
gc.Redirect(http.StatusSeeOther, PAGES.MyAccount)
|
gc.Redirect(http.StatusSeeOther, MustGetNonEmptyURL(PAGES.MyAccount))
|
||||||
return
|
return
|
||||||
} else if target == UserEmailChange {
|
} else if target == UserEmailChange {
|
||||||
app.modifyEmail(id, claims["email"].(string))
|
app.modifyEmail(id, claims["email"].(string))
|
||||||
@@ -214,7 +214,7 @@ func (app *appContext) confirmMyAction(gc *gin.Context, key string) {
|
|||||||
}, gc, true)
|
}, gc, true)
|
||||||
|
|
||||||
app.info.Printf(lm.UserEmailAdjusted, gc.GetString("jfId"))
|
app.info.Printf(lm.UserEmailAdjusted, gc.GetString("jfId"))
|
||||||
gc.Redirect(http.StatusSeeOther, PAGES.MyAccount)
|
gc.Redirect(http.StatusSeeOther, MustGetNonEmptyURL(PAGES.MyAccount))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,6 +66,13 @@ func FixFullURL(v string) string {
|
|||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func MustGetNonEmptyURL(path string) string {
|
||||||
|
if !strings.HasPrefix(path, "/") {
|
||||||
|
return "/" + path
|
||||||
|
}
|
||||||
|
return path
|
||||||
|
}
|
||||||
|
|
||||||
func FormatSubpath(path string, removeSingleSlash bool) string {
|
func FormatSubpath(path string, removeSingleSlash bool) string {
|
||||||
if path == "/" {
|
if path == "/" {
|
||||||
if removeSingleSlash {
|
if removeSingleSlash {
|
||||||
|
|||||||
Reference in New Issue
Block a user