mirror of
https://github.com/ngoduykhanh/wireguard-ui.git
synced 2025-05-24 00:24:06 +03:00
*: allows for BASE_PATH configuration (#183)
This commit is contained in:
parent
90bb2851bf
commit
87b08a8f7c
13 changed files with 108 additions and 84 deletions
|
@ -53,7 +53,7 @@ func Login(db store.IStore) echo.HandlerFunc {
|
|||
// TODO: refresh the token
|
||||
sess, _ := session.Get("session", c)
|
||||
sess.Options = &sessions.Options{
|
||||
Path: "/",
|
||||
Path: util.BasePath,
|
||||
MaxAge: 86400,
|
||||
HttpOnly: true,
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ func Login(db store.IStore) echo.HandlerFunc {
|
|||
func Logout() echo.HandlerFunc {
|
||||
return func(c echo.Context) error {
|
||||
clearSession(c)
|
||||
return c.Redirect(http.StatusTemporaryRedirect, "/login")
|
||||
return c.Redirect(http.StatusTemporaryRedirect, util.BasePath + "/login")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,9 +14,9 @@ func ValidSession(next echo.HandlerFunc) echo.HandlerFunc {
|
|||
if !isValidSession(c) {
|
||||
nextURL := c.Request().URL
|
||||
if nextURL != nil && c.Request().Method == http.MethodGet {
|
||||
return c.Redirect(http.StatusTemporaryRedirect, fmt.Sprintf("/login?next=%s", c.Request().URL))
|
||||
return c.Redirect(http.StatusTemporaryRedirect, fmt.Sprintf(util.BasePath + "/login?next=%s", c.Request().URL))
|
||||
} else {
|
||||
return c.Redirect(http.StatusTemporaryRedirect, "/login")
|
||||
return c.Redirect(http.StatusTemporaryRedirect, util.BasePath + "/login")
|
||||
}
|
||||
}
|
||||
return next(c)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue