1
0
Fork 0
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:
jvoisin 2024-03-04 00:32:16 +01:00 committed by Frédéric Guillot
parent d55b410800
commit 8d80e9103f
15 changed files with 37 additions and 53 deletions

View file

@ -14,9 +14,6 @@ import (
)
func (h *handler) showCreateUserPage(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)
@ -28,6 +25,8 @@ func (h *handler) showCreateUserPage(w http.ResponseWriter, r *http.Request) {
return
}
sess := session.New(h.store, request.SessionID(r))
view := view.New(h.tpl, r, sess)
view.Set("form", &form.UserForm{})
view.Set("menu", "settings")
view.Set("user", user)