~bigbes/sr-ht-dolt

6af58599373a90f23c8b8ace22f03fe72c5ecde0 — Eugene Blikh 9 days ago 27823bb
web: take the login redirect from chrome.LoginURLFor

Building a whole Page resolved the nav, the brand and the profile link
for a response that is a Location header and nothing else.
1 files changed, 5 insertions(+), 1 deletions(-)

M web/router.go
M web/router.go => web/router.go +5 -1
@@ 253,8 253,12 @@ func (a *app) forbidden(w http.ResponseWriter, r *http.Request, msg string) {

// redirectLogin sends an unauthenticated caller to meta's login, returning them
// to the current URL afterwards.
//
// LoginURLFor rather than a whole Page for one field off it: building the page
// resolves the nav, the profile link and the brand for a response that is a
// Location header and nothing else.
func (a *app) redirectLogin(w http.ResponseWriter, r *http.Request) {
	http.Redirect(w, r, a.page(r, "").LoginURL, http.StatusSeeOther)
	http.Redirect(w, r, a.chrome.LoginURLFor(r), http.StatusSeeOther)
}

// loadRepoForBrowse loads the repo named by the {user}/{db} URL params and