2021-12-29 11:56:19 +05:30
|
|
|
package handlers
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"github.com/authorizerdev/authorizer/server/constants"
|
2022-05-29 17:22:46 +05:30
|
|
|
"github.com/authorizerdev/authorizer/server/memorystore"
|
2021-12-29 11:56:19 +05:30
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
)
|
|
|
|
|
2022-01-17 11:32:13 +05:30
|
|
|
// DashboardHandler is the handler for the /dashboard route
|
2021-12-29 11:56:19 +05:30
|
|
|
func DashboardHandler() gin.HandlerFunc {
|
|
|
|
return func(c *gin.Context) {
|
2021-12-30 10:01:51 +05:30
|
|
|
isOnboardingCompleted := false
|
2022-05-29 17:22:46 +05:30
|
|
|
adminSecret, err := memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAdminSecret)
|
|
|
|
if err != nil || adminSecret != "" {
|
2021-12-30 10:01:51 +05:30
|
|
|
isOnboardingCompleted = true
|
2021-12-29 11:56:19 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
c.HTML(http.StatusOK, "dashboard.tmpl", gin.H{
|
2021-12-30 10:01:51 +05:30
|
|
|
"data": map[string]interface{}{
|
|
|
|
"isOnboardingCompleted": isOnboardingCompleted,
|
2021-12-29 11:56:19 +05:30
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|