From 422c16f39a6c7969f21d633e7946689e782ea391 Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Mon, 11 Nov 2019 18:03:19 +0900 Subject: [PATCH] Tweak admin user pass reset success copy This also adjusts the style and includes the user's password, so the admin can easily notify them. Ref T695 --- admin.go | 2 ++ templates/user/admin/view-user.tmpl | 23 ++++++++++------------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/admin.go b/admin.go index b155321..5f7d0c7 100644 --- a/admin.go +++ b/admin.go @@ -177,6 +177,7 @@ func handleViewAdminUser(app *App, u *User, w http.ResponseWriter, r *http.Reque LastPost string NewPassword string TotalPosts int64 + ClearEmail string }{ Config: app.cfg.App, Message: r.FormValue("m"), @@ -187,6 +188,7 @@ func handleViewAdminUser(app *App, u *User, w http.ResponseWriter, r *http.Reque for _, flash := range flashes { if strings.HasPrefix(flash, "SUCCESS: ") { p.NewPassword = strings.TrimPrefix(flash, "SUCCESS: ") + p.ClearEmail = u.EmailClear(app.keys) } } diff --git a/templates/user/admin/view-user.tmpl b/templates/user/admin/view-user.tmpl index ac1f8bd..c1d7615 100644 --- a/templates/user/admin/view-user.tmpl +++ b/templates/user/admin/view-user.tmpl @@ -9,9 +9,10 @@ h3 { } input.copy-text { text-align: center; - font-size: 1.2em; - color: #555; - margin-left: 1rem; + font-size: 1.2em; + color: #555; + width: 100%; + box-sizing: border-box; } button[type="submit"].danger { padding-left: 2rem; @@ -22,16 +23,12 @@ button[type="submit"].danger { {{template "admin-header" .}}

{{.User.Username}}

- {{if .NewPassword}}

New password for user {{.User.Username}} is - -

- You must share this new password with the user, this is the only time it will be displayed. -

+ {{if .NewPassword}}
+

This user's password has been reset to:

+

+

They can use this new password to log in to their account. This will only be shown once, so be sure to copy it and send it to them now.

+ {{if .User.Email}}

Their email address is: {{.ClearEmail}}

{{end}} +
{{end}}