Add admin-route & dropdown-menu. Add clear-cache & create-code. Adjustments for activation-code and user models. Add sweet-alert for admin-tools.
This commit is contained in:
9
main.go
9
main.go
@@ -22,6 +22,8 @@ func main() {
|
||||
router.LoadHTMLGlob("templates/**/*")
|
||||
protected := router.Group("/")
|
||||
protected.Use(AuthRequired())
|
||||
admin := router.Group("/admin")
|
||||
admin.Use(AdminAuthRequired())
|
||||
|
||||
models.ConnectDatabase()
|
||||
|
||||
@@ -35,6 +37,10 @@ func main() {
|
||||
gin.LoggerWithWriter(utils.GinWriter),
|
||||
gin.Recovery(),
|
||||
)
|
||||
admin.Use(
|
||||
gin.LoggerWithWriter(utils.GinWriter),
|
||||
gin.Recovery(),
|
||||
)
|
||||
|
||||
router.Static("/static", "./static")
|
||||
|
||||
@@ -67,6 +73,9 @@ func main() {
|
||||
protected.GET("/settings", controllers.GetSettings)
|
||||
protected.PATCH("/settings", controllers.UpdateSettings)
|
||||
|
||||
admin.GET("/clear_cache", controllers.DeleteAllCaches)
|
||||
admin.POST("/create_code", controllers.CreateCode)
|
||||
|
||||
log.Println("Running on 8000...")
|
||||
log.Fatal(router.Run(":8000"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user