use the global constant for accounts.
Dieser Commit ist enthalten in:
Ursprung
2c798d6006
Commit
9817b81b92
|
@ -6,6 +6,7 @@ import (
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/phuslu/log"
|
"github.com/phuslu/log"
|
||||||
|
"go.sebtobie.de/httpserver"
|
||||||
"go.sebtobie.de/httpserver/auth"
|
"go.sebtobie.de/httpserver/auth"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -39,7 +40,7 @@ func LogMiddleware(c *gin.Context) {
|
||||||
|
|
||||||
// RequireUser is an middleware that looks if the user is an Anonymous user and redircts it to the login if so.
|
// RequireUser is an middleware that looks if the user is an Anonymous user and redircts it to the login if so.
|
||||||
func RequireUser(c *gin.Context) {
|
func RequireUser(c *gin.Context) {
|
||||||
var acc = c.MustGet("account").(auth.Account)
|
var acc = c.MustGet(httpserver.Accounts).(auth.Account)
|
||||||
if acc.Anonymous() {
|
if acc.Anonymous() {
|
||||||
acc.Redirect(c)
|
acc.Redirect(c)
|
||||||
return
|
return
|
||||||
|
|
Laden…
In neuem Issue referenzieren