added user informations cell
All checks were successful
Tests / Run Go Tests (push) Successful in 16s
All checks were successful
Tests / Run Go Tests (push) Successful in 16s
This commit is contained in:
@@ -3,6 +3,7 @@ package endpoints
|
||||
import (
|
||||
"arbeitszeitmessung/models"
|
||||
"arbeitszeitmessung/templates"
|
||||
"context"
|
||||
"log"
|
||||
"net/http"
|
||||
)
|
||||
@@ -38,5 +39,9 @@ func changePassword(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func showUserPage(w http.ResponseWriter, r *http.Request, status int) {
|
||||
templates.UserPage(status).Render(r.Context(), w)
|
||||
var ctx context.Context
|
||||
if user, err := models.GetUserFromSession(Session, r.Context()); err == nil {
|
||||
ctx = context.WithValue(r.Context(), "user", user)
|
||||
}
|
||||
templates.UserPage(status).Render(ctx, w)
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ func LoginHandler(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
func UserSettingsHandler(w http.ResponseWriter, r *http.Request) {
|
||||
helper.RequiresLogin(Session, w, r)
|
||||
|
||||
switch r.Method {
|
||||
case http.MethodGet:
|
||||
showUserPage(w, r, 0)
|
||||
|
||||
Reference in New Issue
Block a user