mirror of
https://github.com/ordinary-dev/phoenix
synced 2024-09-19 19:30:28 +05:00
Fix a panic bug
This commit is contained in:
parent
e827f0cb23
commit
f8c888d6b0
|
@ -78,15 +78,16 @@ func AuthMiddleware(c *gin.Context, db *gorm.DB, cfg *config.Config) {
|
|||
return
|
||||
}
|
||||
SetTokenCookie(c, token)
|
||||
} else {
|
||||
if database.CountAdmins(db) < 1 {
|
||||
c.Redirect(http.StatusFound, "/registration")
|
||||
} else {
|
||||
c.Redirect(http.StatusFound, "/signin")
|
||||
}
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
|
||||
if database.CountAdmins(db) < 1 {
|
||||
c.Redirect(http.StatusFound, "/registration")
|
||||
} else {
|
||||
c.Redirect(http.StatusFound, "/signin")
|
||||
}
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
|
||||
// Create a new token if the old one is about to expire
|
||||
|
|
Loading…
Reference in a new issue