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
1 changed files with 5 additions and 5 deletions
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 {
|
func handleViewInvite(app *App, w http.ResponseWriter, r *http.Request) error {
|
||||||
inviteCode := mux.Vars(r)["code"]
|
inviteCode := mux.Vars(r)["code"]
|
||||||
|
|
||||||
|
i, err := app.db.GetUserInvite(inviteCode)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
if u := getUserSession(app, r); u != nil {
|
if u := getUserSession(app, r); u != nil {
|
||||||
// check if invite belongs to another user
|
// check if invite belongs to another user
|
||||||
// error can be ignored as not important in this case
|
// 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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
i, err := app.db.GetUserInvite(inviteCode)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
p := struct {
|
p := struct {
|
||||||
page.StaticPage
|
page.StaticPage
|
||||||
Error string
|
Error string
|
||||||
|
|
Loading…
Add table
Reference in a new issue