Chromium Code Reviews| Index: appengine/chromium_build_stats/default/compiler_proxy_log.go |
| diff --git a/appengine/chromium_build_stats/default/compiler_proxy_log.go b/appengine/chromium_build_stats/default/compiler_proxy_log.go |
| index ea81829173feb8b44593571188a957affbb38bcc..6845057fca41ba70d970cc1134d99d305db468a6 100644 |
| --- a/appengine/chromium_build_stats/default/compiler_proxy_log.go |
| +++ b/appengine/chromium_build_stats/default/compiler_proxy_log.go |
| @@ -86,6 +86,23 @@ var ( |
| </body> |
| </html> |
| `)) |
| + |
| + compilerProxyAuthTmpl = template.Must(template.New("compiler_proxy_auth").Parse(` |
| +<html> |
| +<head> |
| + <title>compiler_proxy log</title> |
| +</head> |
| +<body> |
| +{{if .User}} |
| +{{.User.Email}} is not alow to access this page. |
| +Please <a href="{{.Logout}}">logout</a> and login with @google.com account. |
| +<div align="right"><a href="{{.Logout}}">logout</a></div> |
| +{{else}} |
| + <div align="right"><a href="{{.Login}}">login</a></div> |
| +You need to <a href="{{.Login}}">login</a> with @google.com account to access compiler_proxy log file. |
| +{{end}} |
| +</body> |
| +</html>`)) |
| ) |
| func init() { |
| @@ -95,13 +112,13 @@ func init() { |
| // compilerProxyLogHandler handles /<path> for compiler_proxy.INFO log file in gs://chrome-goma-log/<path> |
| func compilerProxyLogHandler(w http.ResponseWriter, req *http.Request) { |
| ctx := appengine.NewContext(req) |
| - user := user.Current(ctx) |
| - if user == nil { |
| - http.Error(w, "Login required", http.StatusUnauthorized) |
| + u := user.Current(ctx) |
| + if u == nil { |
| + authPage(w, req, http.StatusUnauthorized, compilerProxyAuthTmpl, u, path.Join("/compiler_proxy_log", req.URL.Path)) |
| return |
| } |
| - if !strings.HasSuffix(user.Email, "@google.com") { |
| - http.Error(w, "Unauthorized to access", http.StatusUnauthorized) |
| + if !strings.HasSuffix(u.Email, "@google.com") { |
|
Yoshisato Yanagisawa
2016/07/05 05:00:05
maybe intended but L117 and L120 are the same?
|
| + authPage(w, req, http.StatusUnauthorized, compilerProxyAuthTmpl, u, path.Join("/compiler_proxy_log", req.URL.Path)) |
| return |
| } |