remove redundant bracket

This commit is contained in:
Freiric Barral 2014-08-29 19:56:12 +02:00
parent 165713c350
commit d6fe3090d7

View File

@ -56,7 +56,7 @@ oauth2Github clientId clientSecret scopes = basicPlugin {apDispatch = dispatch}
oauth = OAuth2 oauth = OAuth2
{ oauthClientId = encodeUtf8 clientId { oauthClientId = encodeUtf8 clientId
, oauthClientSecret = encodeUtf8 clientSecret , oauthClientSecret = encodeUtf8 clientSecret
, oauthOAuthorizeEndpoint = encodeUtf8 $ "https://github.com/login/oauth/authorize?scopes=" `T.append` (T.intercalate "," scopes) , oauthOAuthorizeEndpoint = encodeUtf8 $ "https://github.com/login/oauth/authorize?scopes=" `T.append` T.intercalate "," scopes
, oauthAccessTokenEndpoint = "https://github.com/login/oauth/access_token" , oauthAccessTokenEndpoint = "https://github.com/login/oauth/access_token"
, oauthCallback = Nothing , oauthCallback = Nothing
} }
@ -70,16 +70,16 @@ oauth2Github clientId clientSecret scopes = basicPlugin {apDispatch = dispatch}
dispatch "GET" ["forward"] = do dispatch "GET" ["forward"] = do
state <- liftIO $ fmap (T.pack . toString) nextRandom state <- liftIO $ fmap (T.pack . toString) nextRandom
setSession "githubState" state setSession "githubState" state
(apDispatch (withState state)) "GET" ["forward"] apDispatch (withState state) "GET" ["forward"]
dispatch "GET" ["callback"] = do dispatch "GET" ["callback"] = do
state <- lift $ runInputGet $ ireq textField "state" state <- lift $ runInputGet $ ireq textField "state"
savedState <- lookupSession "githubState" savedState <- lookupSession "githubState"
case savedState of case savedState of
Just saved | saved == state -> (apDispatch basicPlugin) "GET" ["callback"] Just saved | saved == state -> apDispatch basicPlugin "GET" ["callback"]
_ -> invalidArgs ["state"] _ -> invalidArgs ["state"]
dispatch method ps = (apDispatch basicPlugin) method ps dispatch method ps = apDispatch basicPlugin method ps
fetchGithubProfile :: Manager -> AccessToken -> IO (Creds m) fetchGithubProfile :: Manager -> AccessToken -> IO (Creds m)
fetchGithubProfile manager token = do fetchGithubProfile manager token = do