| OLD | NEW |
| (Empty) | |
| 1 package chromiumbuildstats |
| 2 |
| 3 import ( |
| 4 "html/template" |
| 5 "net/http" |
| 6 |
| 7 "appengine" |
| 8 "appengine/user" |
| 9 ) |
| 10 |
| 11 func authPage(w http.ResponseWriter, req *http.Request, status int, tmpl *templa
te.Template, u *user.User, reqpath string) { |
| 12 ctx := appengine.NewContext(req) |
| 13 login, err := user.LoginURL(ctx, reqpath) |
| 14 if err != nil { |
| 15 http.Error(w, err.Error(), http.StatusInternalServerError) |
| 16 return |
| 17 } |
| 18 logout, err := user.LogoutURL(ctx, reqpath) |
| 19 if err != nil { |
| 20 http.Error(w, err.Error(), http.StatusInternalServerError) |
| 21 return |
| 22 } |
| 23 w.Header().Set("Content-Type", "text/html") |
| 24 w.WriteHeader(status) |
| 25 data := struct { |
| 26 User *user.User |
| 27 Login string |
| 28 Logout string |
| 29 }{ |
| 30 User: u, |
| 31 Login: login, |
| 32 Logout: logout, |
| 33 } |
| 34 err = tmpl.Execute(w, data) |
| 35 if err != nil { |
| 36 ctx.Errorf("tmpl: %v", err) |
| 37 } |
| 38 } |
| OLD | NEW |