From 891b15b8a8e077e27a19b9384d0bc4470b7bb5f6 Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Mon, 23 Sep 2019 09:19:21 -0400 Subject: [PATCH] Always return invite errors This ensures we see a 404 page when looking up an invalid invite URL, even if the user is logged in. Ref T690 --- invites.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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