mirror of
https://github.com/rjNemo/auth
synced 2026-06-06 08:26:39 +00:00
17 lines
415 B
Go
17 lines
415 B
Go
package server
|
|
|
|
import "net/http"
|
|
|
|
func (s *Server) dashboardHandler() http.HandlerFunc {
|
|
return func(w http.ResponseWriter, r *http.Request) {
|
|
state := sessionFromContext(r.Context())
|
|
|
|
if !state.Authenticated {
|
|
w.WriteHeader(http.StatusUnauthorized)
|
|
s.render(w, "unauthorized.html", newUnauthorizedData("Sign in to continue."))
|
|
return
|
|
}
|
|
|
|
s.render(w, "in.html", PageData{Email: state.Email})
|
|
}
|
|
}
|