auth
22:e6a44cfda658 Browse Files
Redirect unauthenticated users to the login page. Redirect unauthenticated users to the login page, and encode the current URL in the redirect_to param so that the user returns to the OAuth2 flow after they log in.
1.1 --- a/authorize.go Sat Aug 16 20:34:56 2014 -0400 1.2 +++ b/authorize.go Sat Aug 16 20:49:19 2014 -0400 1.3 @@ -144,7 +144,7 @@ 1.4 } 1.5 1.6 if err := validateSession(r, ctx); err == ErrorNotAuthenticated { 1.7 - // TODO: redirect to login 1.8 + http.Redirect(w, r, "/auth/login?redirect_to="+url.QueryEscape(r.URL.String()), http.StatusFound) 1.9 return 1.10 } else if err != nil { 1.11 ctx.RenderError(w, err) 1.12 @@ -198,7 +198,7 @@ 1.13 } 1.14 1.15 if err := validateSession(r, ctx); err == ErrorNotAuthenticated { 1.16 - // TODO: redirect to login 1.17 + http.Redirect(w, r, "/auth/login?redirect_to="+url.QueryEscape(r.URL.String()), http.StatusFound) 1.18 return 1.19 } else if err != nil { 1.20 ctx.RenderError(w, err)