diff --git a/cmd/server/assets/admin/users/index.html b/cmd/server/assets/admin/users/index.html
index 28f988d72..79a735136 100644
--- a/cmd/server/assets/admin/users/index.html
+++ b/cmd/server/assets/admin/users/index.html
@@ -60,7 +60,7 @@
{{end}}
- {{.Name}}
+ {{.Name}}
{{if .IsRealmAdmin}}
diff --git a/cmd/server/assets/admin/users/show.html b/cmd/server/assets/admin/users/show.html
new file mode 100644
index 000000000..b0bd90e16
--- /dev/null
+++ b/cmd/server/assets/admin/users/show.html
@@ -0,0 +1,73 @@
+{{define "admin/users/show"}}
+{{$user := .user}}
+{{$stats := .stats}}
+
+
+
+
+ {{template "head" .}}
+
+
+
+ {{template "admin/navbar" .}}
+
+
+ {{template "flash" .}}
+
+ {{$user.Name}}
+
+ Here is information about the user.
+
+
+
+
+
+ Name
+
+ {{$user.Name}}
+
+
+
+ Email
+
+ {{$user.Email}}
+
+
+
+ Password
+
+ Password was last changed {{$user.PasswordAgeString}} ago.
+
+
+ {{if $user.SystemAdmin}}
+
+ System admin
+ Enabled
+ {{end}}
+
+
+
+
+
+
+
+ {{range $realm := $user.Realms}}
+ -
+ {{$realm.Name}}
+
+ {{range $admin := $user.AdminRealms}}
+ {{if eq $admin.ID $realm.ID}}
+ Admin
+ {{end}}
+ {{end}}
+
+ {{end}}
+
+
+
+
+ ← All users
+
+
+
+{{end}}
diff --git a/cmd/server/assets/login/account.html b/cmd/server/assets/login/account.html
index 42e07073c..da8b6a10e 100644
--- a/cmd/server/assets/login/account.html
+++ b/cmd/server/assets/login/account.html
@@ -17,24 +17,24 @@
{{template "flash" .}}
My Account
- Information and settings for your account
+ Information and settings for your account.
Name
-
+
{{$user.Name}}
Email
-
+
{{$user.Email}}
{{if $user.SystemAdmin}}
System admin
- Enabled
+ Enabled
{{end}}
@@ -51,7 +51,7 @@ System admin
Password was last changed {{$user.PasswordAgeString}}
- ago
+ ago.
Change password
diff --git a/cmd/server/assets/users/show.html b/cmd/server/assets/users/show.html
index 2f9407641..dd0ce39b2 100644
--- a/cmd/server/assets/users/show.html
+++ b/cmd/server/assets/users/show.html
@@ -27,19 +27,23 @@ {{$user.Name}}
- Name
-
+ Name
+
{{$user.Name}}
- Email
-
+ Email
+
{{$user.Email}}
- Admin
-
- {{$user.CanAdminRealm $currentRealm.ID}}
+ Realm admin
+
+ {{if $user.CanAdminRealm $currentRealm.ID}}
+ Enabled
+ {{else}}
+ Disabled
+ {{end}}
Send password reset
diff --git a/internal/routes/server.go b/internal/routes/server.go
index 6cb343fb2..34dc44b36 100644
--- a/internal/routes/server.go
+++ b/internal/routes/server.go
@@ -350,6 +350,7 @@ func Server(
adminSub.Handle("/realms/{id:[0-9]+}", adminController.HandleRealmsUpdate()).Methods("PATCH")
adminSub.Handle("/users", adminController.HandleUsersIndex()).Methods("GET")
+ adminSub.Handle("/users/{id:[0-9]+}", adminController.HandleUserShow()).Methods("GET")
adminSub.Handle("/users/{id:[0-9]+}", adminController.HandleUserDelete()).Methods("DELETE")
adminSub.Handle("/users", adminController.HandleSystemAdminCreate()).Methods("POST")
adminSub.Handle("/users/new", adminController.HandleSystemAdminCreate()).Methods("GET")
diff --git a/pkg/controller/admin/users_list.go b/pkg/controller/admin/users_list.go
index 80da2acb2..a80098b02 100644
--- a/pkg/controller/admin/users_list.go
+++ b/pkg/controller/admin/users_list.go
@@ -63,6 +63,30 @@ func (c *Controller) HandleUsersIndex() http.Handler {
})
}
+// HandleUserShow renders details about a user.
+func (c *Controller) HandleUserShow() http.Handler {
+ return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ ctx := r.Context()
+ vars := mux.Vars(r)
+
+ // Pull the user from the id.
+ user, err := c.db.FindUser(vars["id"])
+ if err != nil {
+ if database.IsNotFound(err) {
+ controller.NotFound(w, r, c.h)
+ return
+ }
+
+ controller.InternalError(w, r, c.h, err)
+ return
+ }
+
+ m := controller.TemplateMapFromContext(ctx)
+ m["user"] = user
+ c.h.RenderHTML(w, "admin/users/show", m)
+ })
+}
+
// HandleUserDelete deletes a user from the system.
func (c *Controller) HandleUserDelete() http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|