aboutsummaryrefslogtreecommitdiffstats
path: root/dashboard/app/handler.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-03-20 11:33:18 +0100
committerDmitry Vyukov <dvyukov@google.com>2018-03-20 11:33:18 +0100
commite8a29b89d0df7f009939d39b68037d731ec9b325 (patch)
tree78ef361571f52f5cfa3a40405b0779cc9580f60f /dashboard/app/handler.go
parent8884d5d1e6b2892fe1c050b2fe8cc62db5971681 (diff)
dashboard/app: don't log un-signed-in users as errors
Un-signed-in users are redirected to login page. And maybe they have access after sign-in. Otherwise the error will be logged aftger sign-in.
Diffstat (limited to 'dashboard/app/handler.go')
-rw-r--r--dashboard/app/handler.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/dashboard/app/handler.go b/dashboard/app/handler.go
index f31b68b5e..d7f503349 100644
--- a/dashboard/app/handler.go
+++ b/dashboard/app/handler.go
@@ -67,11 +67,10 @@ func checkAccessLevel(c context.Context, r *http.Request, level AccessLevel) err
if accessLevel(c, r) >= level {
return nil
}
- userID := "not-signed-in"
if u := user.Current(c); u != nil {
- userID = fmt.Sprintf("%q [%q]", u.Email, u.AuthDomain)
+ // Log only if user is signed in. Not-signed-in users are redirected to login page.
+ log.Errorf(c, "unauthorized access: %q [%q] access level %v", u.Email, u.AuthDomain, level)
}
- log.Errorf(c, "unauthorized access: %v access level %v", userID, level)
return ErrAccess
}