Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0
Ce dépôt a été archivé le 2022-05-07. Vous pouvez voir ses fichiers ou le cloner, mais pas ouvrir de ticket ou de demandes d'ajout, ni soumettre de changements.
nyaa-pantsu/controllers/user/logout.go
akuma06 b3e3ec6083 Fix Navigation Admin Panel (#1398)
* 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
2017-08-26 12:15:28 +10:00

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)
}
}