auth

Paddy 2014-11-11 Parent:4ae226929e92 Child:8bc51f76e717

74:ff7bf5bd0df3 Browse Files

Combine ErrNoSession and ErrInvalidSession. We want to redirect to a login screen for both, right? So let's just handle them at the same time.

oauth2.go

     1.1 --- a/oauth2.go	Tue Nov 11 21:22:57 2014 -0500
     1.2 +++ b/oauth2.go	Tue Nov 11 21:29:10 2014 -0500
     1.3 @@ -107,14 +107,10 @@
     1.4  func GetGrantHandler(w http.ResponseWriter, r *http.Request, context Context) {
     1.5  	session, err := checkCookie(r, context)
     1.6  	if err != nil {
     1.7 -		if err == ErrNoSession {
     1.8 +		if err == ErrNoSession || ErrInvalidSession {
     1.9  			// TODO(paddy): redirect to login screen
    1.10  			//return
    1.11  		}
    1.12 -		if err == ErrInvalidSession {
    1.13 -			// TODO(paddy): return an access denied error
    1.14 -			//return
    1.15 -		}
    1.16  		// TODO(paddy): return a server error
    1.17  		//return
    1.18  	}