diff --git a/yesod-auth/Yesod/Auth/GoogleEmail.hs b/yesod-auth/Yesod/Auth/GoogleEmail.hs new file mode 100644 index 00000000..f1e5075d --- /dev/null +++ b/yesod-auth/Yesod/Auth/GoogleEmail.hs @@ -0,0 +1,99 @@ +{-# LANGUAGE QuasiQuotes #-} +{-# LANGUAGE CPP #-} +{-# LANGUAGE OverloadedStrings #-} +-- | Use an email address as an identifier via Google's OpenID login system. +-- +-- This backend will not use the OpenID identifier at all. It only uses OpenID +-- as a login system. By using this plugin, you are trusting Google to validate +-- an email address, and requiring users to have a Google account. On the plus +-- side, you get to use email addresses as the identifier, many users have +-- existing Google accounts, the login system has been long tested (as opposed +-- to BrowserID), and it requires no credential managing or setup (as opposed +-- to Email). +module Yesod.Auth.GoogleEmail + ( authGoogleEmail + , forwardUrl + ) where + +import Yesod.Auth +import qualified Web.Authenticate.OpenId as OpenId +import Control.Monad.Attempt + +import Yesod.Form +import Yesod.Handler +import Yesod.Widget +import Yesod.Request +import Text.Blaze (toHtml) +import Data.Text (Text) +import qualified Yesod.Auth.Message as Msg +import qualified Data.Text as T + +forwardUrl :: AuthRoute +forwardUrl = PluginR "googleemail" ["forward"] + +authGoogleEmail :: YesodAuth m => AuthPlugin m +authGoogleEmail = + AuthPlugin "googleemail" dispatch login + where + complete = PluginR "googleemail" ["complete"] + name = "openid_identifier" + login tm = do + [whamlet| +