This commit is contained in:
+10
-5
@@ -141,15 +141,20 @@ func (app *application) accountEmailConfirmPost(w http.ResponseWriter, r *http.R
|
||||
func (app *application) renderAccount(w http.ResponseWriter, r *http.Request, form accountForm, status int) {
|
||||
data := app.newTemplateData(r)
|
||||
data.Form = form
|
||||
if user, ok := userFromContext(r.Context()); ok {
|
||||
data.AccountProtected = app.config.DemoAccountEmail != "" && strings.EqualFold(strings.TrimSpace(user.Email), app.config.DemoAccountEmail)
|
||||
}
|
||||
if !app.loadOptionalGarden(w, r, data) {
|
||||
return
|
||||
}
|
||||
sessions, _, err := client.FromContext(r.Context()).AccountSessions(r.Context())
|
||||
if err != nil {
|
||||
app.handleAPIError(w, r, err)
|
||||
return
|
||||
if !data.AccountProtected {
|
||||
sessions, _, err := client.FromContext(r.Context()).AccountSessions(r.Context())
|
||||
if err != nil {
|
||||
app.handleAPIError(w, r, err)
|
||||
return
|
||||
}
|
||||
data.AccountSessions = sessions
|
||||
}
|
||||
data.AccountSessions = sessions
|
||||
app.render(w, status, "account.tmpl", data)
|
||||
}
|
||||
func (app *application) copyAccountError(form *accountForm, err error) {
|
||||
|
||||
Reference in New Issue
Block a user