GoogleEmail2: proper error message when permission denied
This commit is contained in:
parent
e2e2edf270
commit
2179a8e30d
@ -1,3 +1,7 @@
|
|||||||
|
## 1.4.8
|
||||||
|
|
||||||
|
* GoogleEmail2: proper error message when permission denied
|
||||||
|
|
||||||
## 1.4.7
|
## 1.4.7
|
||||||
|
|
||||||
* add a runHttpRequest function for handling HTTP errors
|
* add a runHttpRequest function for handling HTTP errors
|
||||||
|
|||||||
@ -50,14 +50,17 @@ module Yesod.Auth.GoogleEmail2
|
|||||||
import Yesod.Auth (Auth, AuthPlugin (AuthPlugin),
|
import Yesod.Auth (Auth, AuthPlugin (AuthPlugin),
|
||||||
AuthRoute, Creds (Creds),
|
AuthRoute, Creds (Creds),
|
||||||
Route (PluginR), YesodAuth,
|
Route (PluginR), YesodAuth,
|
||||||
runHttpRequest, setCredsRedirect)
|
runHttpRequest, setCredsRedirect,
|
||||||
|
logoutDest)
|
||||||
import qualified Yesod.Auth.Message as Msg
|
import qualified Yesod.Auth.Message as Msg
|
||||||
import Yesod.Core (HandlerSite, HandlerT, MonadHandler,
|
import Yesod.Core (HandlerSite, HandlerT, MonadHandler,
|
||||||
TypedContent, getRouteToParent,
|
TypedContent, getRouteToParent,
|
||||||
getUrlRender, invalidArgs,
|
getUrlRender, invalidArgs,
|
||||||
lift, liftIO, lookupGetParam,
|
lift, liftIO, lookupGetParam,
|
||||||
lookupSession, notFound, redirect,
|
lookupSession, notFound, redirect,
|
||||||
setSession, whamlet, (.:))
|
setSession, whamlet, (.:),
|
||||||
|
setMessage, getYesod, authRoute,
|
||||||
|
toHtml)
|
||||||
|
|
||||||
|
|
||||||
import Blaze.ByteString.Builder (fromByteString, toByteString)
|
import Blaze.ByteString.Builder (fromByteString, toByteString)
|
||||||
@ -187,7 +190,18 @@ authPlugin storeToken clientID clientSecret =
|
|||||||
mcode <- lookupGetParam "code"
|
mcode <- lookupGetParam "code"
|
||||||
code <-
|
code <-
|
||||||
case mcode of
|
case mcode of
|
||||||
Nothing -> invalidArgs ["Missing code paramter"]
|
Nothing -> do
|
||||||
|
merr <- lookupGetParam "error"
|
||||||
|
case merr of
|
||||||
|
Nothing -> invalidArgs ["Missing code paramter"]
|
||||||
|
Just err -> do
|
||||||
|
master <- lift getYesod
|
||||||
|
let msg =
|
||||||
|
case err of
|
||||||
|
"access_denied" -> "Access denied"
|
||||||
|
_ -> "Unknown error occurred: " `T.append` err
|
||||||
|
setMessage $ toHtml msg
|
||||||
|
lift $ redirect $ logoutDest master
|
||||||
Just c -> return c
|
Just c -> return c
|
||||||
|
|
||||||
render <- getUrlRender
|
render <- getUrlRender
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
name: yesod-auth
|
name: yesod-auth
|
||||||
version: 1.4.7
|
version: 1.4.8
|
||||||
license: MIT
|
license: MIT
|
||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
author: Michael Snoyman, Patrick Brisbin
|
author: Michael Snoyman, Patrick Brisbin
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user