Display user name only if claims are not nil
This commit is contained in:
parent
12f2a7a1d5
commit
945a2a29dd
1 changed files with 3 additions and 1 deletions
|
@ -247,7 +247,9 @@ func (rend *HTMLRenderer) Render(w http.ResponseWriter, r *http.Request, data in
|
|||
rend.writeError(w, r, &htmlTemplateData{err, nil})
|
||||
}
|
||||
|
||||
if r.Context().Value("user") != nil {
|
||||
log.Println("Current user is", r.Context().Value("user").(*jwt.Token).Claims.(jwt.MapClaims)["name"])
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
||||
err := t.ExecuteTemplate(w, options[0]["tpl_layout"][0], &htmlTemplateData{data, options[0]})
|
||||
|
|
Loading…
Reference in a new issue