diff --git a/invites.go b/invites.go index 1e58ac3..1bd75e6 100644 --- a/invites.go +++ b/invites.go @@ -110,6 +110,11 @@ func handleCreateUserInvite(app *App, u *User, w http.ResponseWriter, r *http.Re func handleViewInvite(app *App, w http.ResponseWriter, r *http.Request) error { inviteCode := mux.Vars(r)["code"] + i, err := app.db.GetUserInvite(inviteCode) + if err != nil { + return err + } + if u := getUserSession(app, r); u != nil { // check if invite belongs to another user // error can be ignored as not important in this case @@ -130,11 +135,6 @@ func handleViewInvite(app *App, w http.ResponseWriter, r *http.Request) error { return nil } - i, err := app.db.GetUserInvite(inviteCode) - if err != nil { - return err - } - p := struct { page.StaticPage Error string