From a57640fd330cc854b0d48a3b685dd61bec9cf57d Mon Sep 17 00:00:00 2001 From: Tuomo Ala-Vannesluoma Date: Thu, 28 Jun 2018 21:50:02 +0300 Subject: Fix not exposing project existence when group is found but project is not --- app.go | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'app.go') diff --git a/app.go b/app.go index 284a420c..af4d5744 100644 --- a/app.go +++ b/app.go @@ -95,15 +95,27 @@ func (a *theApp) getHostAndDomain(r *http.Request) (host string, domain *domain. } func (a *theApp) checkAuthenticationIfNotExists(domain *domain.D, w http.ResponseWriter, r *http.Request) bool { - if domain == nil { - // To avoid user knowing if pages exist, we will force user to login and authorize pages - if a.Auth.CheckAuthenticationWithoutProject(w, r) { + if domain == nil || domain.GetID(r) == 0 { + + // Only if auth is supported + if a.Auth.IsAuthSupported() { + + // To avoid user knowing if pages exist, we will force user to login and authorize pages + if a.Auth.CheckAuthenticationWithoutProject(w, r) { + return true + } + + // User is authenticated, show the 404 + httperrors.Serve404(w) return true } - // User is authenticated, show the 404 + } + + // Without auth, fall back to 404 + if domain == nil { httperrors.Serve404(w) - return true } + return false } -- cgit v1.2.3