1
0
Fork 0

use the global constant for accounts.

Dieser Commit ist enthalten in:
Sebastian Tobie 2021-01-24 00:43:31 +01:00
Ursprung 2c798d6006
Commit 9817b81b92
1 geänderte Dateien mit 2 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -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