yesod/yesod-auth/Yesod/Auth/Dummy.hs
Michael Snoyman 67ae9c739b Merge commit 'e4e2dd75cc86909d66062a7655b8cbc3a959932d'
Conflicts:
	yesod-auth/Yesod/Auth.hs
	yesod-auth/Yesod/Auth/BrowserId.hs
	yesod-auth/Yesod/Auth/Dummy.hs
	yesod-auth/Yesod/Auth/Email.hs
	yesod-auth/Yesod/Auth/HashDB.hs
	yesod-auth/Yesod/Auth/OpenId.hs
	yesod-auth/Yesod/Auth/Rpxnow.hs
	yesod-form/Yesod/Form/Fields.hs
	yesod-form/Yesod/Form/Functions.hs
	yesod-form/Yesod/Form/Jquery.hs
	yesod-form/Yesod/Form/Nic.hs
	yesod-form/Yesod/Helpers/Crud.hs
	yesod-newsfeed/Yesod/AtomFeed.hs
	yesod-newsfeed/Yesod/RssFeed.hs
2012-03-25 11:07:12 +02:00

32 lines
941 B
Haskell

{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE OverloadedStrings #-}
-- | Provides a dummy authentication module that simply lets a user specify
-- his/her identifier. This is not intended for real world use, just for
-- testing.
module Yesod.Auth.Dummy
( authDummy
) where
import Yesod.Auth
import Yesod.Form (runInputPost, textField, ireq)
import Yesod.Handler (notFound)
import Text.Hamlet (hamlet)
import Yesod.Widget (toWidget)
authDummy :: YesodAuth m => AuthPlugin m
authDummy =
AuthPlugin "dummy" dispatch login
where
dispatch "POST" [] = do
ident <- runInputPost $ ireq textField "ident"
setCreds True $ Creds "dummy" ident []
dispatch _ _ = notFound
url = PluginR "dummy" []
login authToMaster =
toWidget [hamlet|
<form method="post" action="@{authToMaster url}">
Your new identifier is: #
<input type="text" name="ident">
<input type="submit" value="Dummy Login">
|]