2019-09-28 20:04:51 -04:00
|
|
|
package auth
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
jchenry_http "github.com/jchenry/jchenry/http"
|
|
|
|
)
|
|
|
|
|
|
|
|
func UserHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
2019-10-09 11:56:57 -04:00
|
|
|
session, err := Store.Get(r, SessionName)
|
2019-09-28 20:04:51 -04:00
|
|
|
if err != nil {
|
|
|
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
jchenry_http.RenderTemplate(w, "user", session.Values["profile"])
|
|
|
|
}
|
2019-09-29 15:30:24 -04:00
|
|
|
|
|
|
|
type User struct {
|
2019-10-09 11:56:57 -04:00
|
|
|
ID string `json:"sub"`
|
|
|
|
Email string `json:"email"`
|
|
|
|
FirstName string `json:"given_name"`
|
|
|
|
LastName string `json:"family_name"`
|
|
|
|
Picture string `json:"picture"`
|
|
|
|
Nickname string `json:"nickname"`
|
|
|
|
Apps map[string]interface{} `json:"app_metadata,omitempty"`
|
2019-09-29 15:30:24 -04:00
|
|
|
}
|