Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1597)

Unified Diff: appengine/chromium_build_stats/default/ninja_log.go

Issue 2125513002: chromium_build_stats: redirect login url if not logged in. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: appengine/chromium_build_stats/default/ninja_log.go
diff --git a/appengine/chromium_build_stats/default/ninja_log.go b/appengine/chromium_build_stats/default/ninja_log.go
index 5355edafe01b6b8e8e84b041f964bf2fabc7df44..ea488af226856bcf480ec28f6ce69500b7a46323 100644
--- a/appengine/chromium_build_stats/default/ninja_log.go
+++ b/appengine/chromium_build_stats/default/ninja_log.go
@@ -164,32 +164,7 @@ func ninjalogForm(w http.ResponseWriter, req *http.Request) {
}
ctx := appengine.NewContext(req)
u := user.Current(ctx)
- login, err := user.LoginURL(ctx, "/ninja_log/")
- if err != nil {
- http.Error(w, err.Error(), http.StatusInternalServerError)
- return
- }
- logout, err := user.LogoutURL(ctx, "/ninja_log/")
- if err != nil {
- http.Error(w, err.Error(), http.StatusInternalServerError)
- return
- }
- w.Header().Set("Content-Type", "text/html")
- w.WriteHeader(http.StatusOK)
- data := struct {
- User *user.User
- Login string
- Logout string
- }{
- User: u,
- Login: login,
- Logout: logout,
- }
- err = formTmpl.Execute(w, data)
- if err != nil {
- ctx.Errorf("formTmpl: %v", err)
- }
-
+ authPage(w, req, http.StatusOK, formTmpl, u, "/ninja_log/")
}
func ninjalogUpload(w http.ResponseWriter, req *http.Request) {

Powered by Google App Engine
This is Rietveld 408576698