{-# LANGUAGE DeriveDataTypeable, GeneralizedNewtypeDeriving, FlexibleContexts, FlexibleInstances, MultiParamTypeClasses, RankNTypes, TypeFamilies, UndecidableInstances #-} {-# OPTIONS_GHC -F -pgmFtrhsx #-} module Happstack.Auth.HSP.Login where import Control.Applicative (Alternative, (<*>), (<$>), (<*), (*>), optional) import Control.Monad (replicateM, mplus) import Control.Monad.Trans (MonadIO(liftIO)) import Data.Acid (AcidState, query', update') import Data.Maybe (mapMaybe) import Data.Set (Set) import qualified Data.Set as Set import Data.Text (Text) import qualified Data.Text as Text import Data.Time.Clock (getCurrentTime) import Happstack.Auth.Core.Auth import Happstack.Auth.Core.AuthParts import Happstack.Auth.Core.AuthURL import Happstack.Auth.Core.ProfileURL import Happstack.Auth.Core.Profile import Happstack.Auth.Core.ProfileParts import Happstack.Server -- (CookieLife(Session), Response, ServerMonad(..), FilterMonad(..), Input(..), Happstack, ServerPartT, addCookie, escape, internalServerError, lookCookieValue, lookPairs, mkCookie, seeOther, toResponse, unauthorized) import Happstack.Server.HSP.HTML (XML) import HSP (Attr(..), EmbedAsAttr(..), EmbedAsChild(..), XMLGenT(..), XMLGenerator, genElement, genEElement, unXMLGenT) import HSP.ServerPartT() import qualified HSX.XMLGenerator as HSX import Happstack.Auth.HSP.FormPart import Text.Digestive import Text.Digestive.Forms.Happstack () import Text.Digestive.HSP.Html4 import Web.Authenticate.OpenId (Identifier, authenticate, getForwardUrl) import Web.Authenticate.OpenId.Providers (google, yahoo, livejournal, myspace) import Web.Authenticate.Facebook (Facebook) import Web.Routes (RouteT, ShowURL, showURL, showURLParams, nestURL, URL) import Web.Routes.XMLGenT -- * AuthURL stuff logoutPage :: (XMLGenerator m, Alternative m, Happstack m, EmbedAsAttr m (Attr String AuthURL)) => AcidState AuthState -> XMLGenT m (HSX.XML m) logoutPage authStateH = do deleteAuthCookie authStateH
You are now logged out. Click here to log in again.
Enter your livejournal account name to connect. You may be prompted to log into your livejournal account and to confirm the login.
<% formPart "p" actionURL handleSuccess (handleFailure appTemplate) liveJournalForm %>Attempted to set AuthId to <% show $ unAuthId authId %>, but failed because the Identifier is not associated with that AuthId.
{- localLoginPage :: (Happstack m, Alternative m) => (forall header body. ( EmbedAsChild (RouteT AuthURL m) XML , EmbedAsChild (RouteT AuthURL m) header , EmbedAsChild (RouteT AuthURL m) body) => (String -> header -> body -> RouteT AuthURL m Response)) -> AuthURL -> String -> RouteT AuthURL m Response -} localLoginPage authStateH appTemplate here onAuthURL = do actionURL <- showURL here appTemplate "Login" () $Invalid UserPassId <% show $ unUserPassId userPassId %>
This account does not use a username and password.
<% userPassErrorString e %>
Your password has updated.