Skip to content

Commit

Permalink
清理cookie
Browse files Browse the repository at this point in the history
  • Loading branch information
gcslaoli committed Dec 17, 2023
1 parent b39951e commit ab10eab
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions api/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ func Index(r *ghttp.Request) {

ctx := r.GetCtx()
if r.Session.MustGet("offical-session").IsEmpty() {
r.Session.RemoveAll()
r.Response.RedirectTo("/login")
// r.Response.Writer.Write([]byte("Hello XyHelper"))
return
Expand Down Expand Up @@ -72,6 +73,7 @@ func Index(r *ghttp.Request) {
func C(r *ghttp.Request) {
ctx := r.GetCtx()
if r.Session.MustGet("offical-session").IsEmpty() {
r.Session.RemoveAll()
r.Response.RedirectTo("/login")
return
}
Expand Down Expand Up @@ -130,6 +132,7 @@ func C(r *ghttp.Request) {
func Discovery(r *ghttp.Request) {

if r.Session.MustGet("offical-session").IsEmpty() {
r.Session.RemoveAll()
r.Response.RedirectTo("/login")
return
}
Expand Down Expand Up @@ -182,6 +185,7 @@ func Discovery(r *ghttp.Request) {
func Editor(r *ghttp.Request) {

if r.Session.MustGet("offical-session").IsEmpty() {
r.Session.RemoveAll()
r.Response.RedirectTo("/login")
return
}
Expand Down Expand Up @@ -242,6 +246,7 @@ func Editor(r *ghttp.Request) {
func Slug(r *ghttp.Request) {

if r.Session.MustGet("offical-session").IsEmpty() {
r.Session.RemoveAll()
r.Response.RedirectTo("/login")
return
}
Expand Down Expand Up @@ -299,6 +304,7 @@ func Slug(r *ghttp.Request) {
func G(r *ghttp.Request) {

if r.Session.MustGet("offical-session").IsEmpty() {
r.Session.RemoveAll()
r.Response.RedirectTo("/login")
return
}
Expand Down Expand Up @@ -356,6 +362,7 @@ func G(r *ghttp.Request) {
func GC(r *ghttp.Request) {

if r.Session.MustGet("offical-session").IsEmpty() {
r.Session.RemoveAll()
r.Response.RedirectTo("/login")
return
}
Expand Down Expand Up @@ -415,6 +422,7 @@ func GC(r *ghttp.Request) {
// Mine 我的
func Mine(r *ghttp.Request) {
if r.Session.MustGet("offical-session").IsEmpty() {
r.Session.RemoveAll()
r.Response.RedirectTo("/login")
return
}
Expand Down

0 comments on commit ab10eab

Please sign in to comment.