mirror of
https://github.com/miniflux/v2.git
synced 2025-06-27 16:36:00 +00:00
Delay call of view.New
after logging the user in
There is no need to do extra work like creating a session and its associated view until the user has been properly identified and as many possibly-failing sql request have been successfully run.
This commit is contained in:
parent
d55b410800
commit
8d80e9103f
15 changed files with 37 additions and 53 deletions
|
@ -15,9 +15,6 @@ import (
|
|||
|
||||
// EditUser shows the form to edit a user.
|
||||
func (h *handler) showEditUserPage(w http.ResponseWriter, r *http.Request) {
|
||||
sess := session.New(h.store, request.SessionID(r))
|
||||
view := view.New(h.tpl, r, sess)
|
||||
|
||||
user, err := h.store.UserByID(request.UserID(r))
|
||||
if err != nil {
|
||||
html.ServerError(w, r, err)
|
||||
|
@ -46,6 +43,8 @@ func (h *handler) showEditUserPage(w http.ResponseWriter, r *http.Request) {
|
|||
IsAdmin: selectedUser.IsAdmin,
|
||||
}
|
||||
|
||||
sess := session.New(h.store, request.SessionID(r))
|
||||
view := view.New(h.tpl, r, sess)
|
||||
view.Set("form", userForm)
|
||||
view.Set("selected_user", selectedUser)
|
||||
view.Set("menu", "settings")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue