b3e3ec6083
* Fix Navigation Admin Panel * Fix broken html on reassign page * fix user link in comment list * Fix Unknown bytes * Fix switch file upload/magnet * fix modtools background white + width * fix /mod/ redirection url * Fix last torrents on modpanel * empty torrent file input * Add hidden class to h3
24 lignes
480 o
Go
24 lignes
480 o
Go
package userController
|
|
|
|
import (
|
|
"net/http"
|
|
"strings"
|
|
|
|
"github.com/NyaaPantsu/nyaa/utils/cookies"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// UserLogoutHandler : Controller to logout users
|
|
func UserLogoutHandler(c *gin.Context) {
|
|
logout := c.PostForm("logout")
|
|
if logout != "" {
|
|
cookies.Clear(c)
|
|
url := c.DefaultPostForm("redirectTo", "/")
|
|
if strings.Contains(url, "/mod/") {
|
|
url = "/"
|
|
}
|
|
c.Redirect(http.StatusSeeOther, url)
|
|
} else {
|
|
c.Status(http.StatusNotFound)
|
|
}
|
|
}
|