blob: 12d039ecde4bf95e0f468203c748498a8ad4af7e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
package templates
import (
"glsamaker/pkg/app/handler/authentication/utils"
"glsamaker/pkg/models"
"glsamaker/pkg/models/users"
"html/template"
"net/http"
)
// renderIndexTemplate renders all templates used for the login page
func RenderAccessDeniedTemplate(w http.ResponseWriter, r *http.Request) {
user := utils.GetAuthenticatedUser(r)
templates := template.Must(
template.Must(
template.New("Show").
ParseGlob("web/templates/layout/*.tmpl")).
ParseGlob("web/templates/authentication/accessDenied.tmpl"))
templates.ExecuteTemplate(w, "accessDenied.tmpl", createAccessDeniedData(user))
}
// createPageData creates the data used in the template of the landing page
func createAccessDeniedData(user *users.User) interface{} {
return struct {
Page string
Application *models.GlobalSettings
User *users.User
}{
Page: "",
Application: models.GetDefaultGlobalSettings(),
User: user,
}
}
|