Pass username to template
All checks were successful
Build and push Probo image on the registry / login (push) Successful in 2m52s
All checks were successful
Build and push Probo image on the registry / login (push) Successful in 2m52s
This commit is contained in:
parent
d3b1fd0feb
commit
647d694e91
1 changed files with 4 additions and 2 deletions
|
|
@ -15,6 +15,7 @@ var ExamsHandler = func(h *template.Handler, w http.ResponseWriter, r *http.Requ
|
|||
}
|
||||
|
||||
claims := token.Claims.(jwt.MapClaims)
|
||||
username := claims["username"].(string)
|
||||
isAdmin := claims["is_admin"].(bool)
|
||||
|
||||
if !isAdmin {
|
||||
|
|
@ -31,8 +32,9 @@ var ExamsHandler = func(h *template.Handler, w http.ResponseWriter, r *http.Requ
|
|||
log.Info("Showing exams", "session", session)
|
||||
|
||||
err = h.WithData(map[string]interface{}{
|
||||
"Session": session,
|
||||
"Exams": exams,
|
||||
"Username": username,
|
||||
"Session": session,
|
||||
"Exams": exams,
|
||||
}).ExecuteTemplate(w)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue