Fix a panic bug

This commit is contained in:
James Mills 2023-08-28 00:44:35 +10:00
parent e827f0cb23
commit f8c888d6b0
No known key found for this signature in database
GPG key ID: AC4C014F1440EBD6

View file

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