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
This commit is contained in:
parent
d954b7c8e3
commit
891b15b8a8
10
invites.go
10
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user