Archived
Template
1
0

Initial commit

This commit is contained in:
uberswe
2021-12-12 14:56:13 +01:00
commit 0511f8fbca
1627 changed files with 773292 additions and 0 deletions

21
middleware/noauth.go Normal file
View File

@ -0,0 +1,21 @@
package middleware
import (
"github.com/gin-gonic/gin"
"net/http"
)
var SessionIdentifierKey = "SESSION_IDENTIFIER"
// NoAuth is for routes that can only be accessed when the user is unauthenticated
func NoAuth() gin.HandlerFunc {
return func(c *gin.Context) {
_, exists := c.Get(UserIDKey)
if !exists {
c.Next()
return
}
c.Redirect(http.StatusTemporaryRedirect, "/admin")
c.Abort()
}
}