diff --git a/admin.go b/admin.go index 5f7d0c7..3b05bd4 100644 --- a/admin.go +++ b/admin.go @@ -184,19 +184,19 @@ func handleViewAdminUser(app *App, u *User, w http.ResponseWriter, r *http.Reque Colls: []inspectedCollection{}, } + var err error + p.User, err = app.db.GetUserForAuth(username) + if err != nil { + return impart.HTTPError{http.StatusInternalServerError, fmt.Sprintf("Could not get user: %v", err)} + } + flashes, _ := getSessionFlashes(app, w, r, nil) for _, flash := range flashes { if strings.HasPrefix(flash, "SUCCESS: ") { p.NewPassword = strings.TrimPrefix(flash, "SUCCESS: ") - p.ClearEmail = u.EmailClear(app.keys) + p.ClearEmail = p.User.EmailClear(app.keys) } } - - var err error - p.User, err = app.db.GetUserForAuth(username) - if err != nil { - return impart.HTTPError{http.StatusInternalServerError, fmt.Sprintf("Could not get user: %v", err)} - } p.UserPage = NewUserPage(app, r, u, p.User.Username, nil) p.TotalPosts = app.db.GetUserPostsCount(p.User.ID) lp, err := app.db.GetUserLastPostTime(p.User.ID) diff --git a/templates/user/admin/view-user.tmpl b/templates/user/admin/view-user.tmpl index 720a714..4157fca 100644 --- a/templates/user/admin/view-user.tmpl +++ b/templates/user/admin/view-user.tmpl @@ -23,7 +23,7 @@ input.copy-text {

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}} + {{if .ClearEmail}}

Their email address is: {{.ClearEmail}}

{{end}} {{end}}