摘要: main = defaultMain[ bench "bigTable html" $ nf bigTableHtml bigTableData, bench "bigTable hamlet" $ nf bigTableHamlet bigTableData, bench "bigTable widget" $ nf bigTableWidget bigTableData, bench "bigTable blaze" $ nf bigTableBlaze bigTableData]whererows :: In 阅读全文
posted @ 2012-03-19 11:41 kelby 阅读(216) 评论(0) 推荐(0) 编辑
摘要: getAuth :: a -> AuthgetAuth = const Auth-- | User credentialsdata Creds m = Creds{ credsPlugin :: Text -- ^ How the user was authenticated, credsIdent :: Text -- ^ Identifier. Exact meaning depends on plugin., credsExtra :: [(Text, Text)]}class (Yesod m, PathPiece (AuthId m), RenderMessage m Form 阅读全文
posted @ 2012-03-19 11:38 kelby 阅读(400) 评论(0) 推荐(0) 编辑
摘要: mkPersist [$persist|Emailemail String Eqstatus Bool updateverkey String null updatepassword String null updateUniqueEmail email|]data A2 = A2 { connPool :: ConnectionPool }mkYesod "A2" [$parseRoutes|/auth AuthR Auth getAuth|]instance Yesod A2 where approot _ = "http://localhost:3000&q 阅读全文
posted @ 2012-03-19 11:36 kelby 阅读(299) 评论(0) 推荐(0) 编辑
摘要: getRootR :: Handler ()getRootR = redirect RedirectTemporary $ AuthR LoginRgetAfterLoginR :: Handler RepHtmlgetAfterLoginR = domauth <- maybeAuthIddefaultLayout $ addHamlet [hamlet|<p>Auth: #{show mauth}|]instance Yesod BID whereapproot _ = "http://localhost:3000"instance YesodAuth 阅读全文
posted @ 2012-03-19 11:33 kelby 阅读(190) 评论(0) 推荐(0) 编辑
摘要: getRootR :: Handler RepHtmlgetRootR = getAfterLoginRgetAfterLoginR :: Handler RepHtmlgetAfterLoginR = domauth <- maybeAuthIddefaultLayout $ addHamlet [hamlet|<p>Auth: #{show mauth}$maybe _ <- mauth<p><a href=@{AuthR LogoutR}>Logout$nothing<p><a href=@{AuthR LoginR}&g 阅读全文
posted @ 2012-03-19 11:32 kelby 阅读(239) 评论(0) 推荐(0) 编辑
摘要: oauthUrl :: Text -> AuthRouteoauthUrl name = PluginR name ["forward"]authOAuth :: YesodAuth m=> OAuth -- ^ 'OAuth' data-type for signing.-> (Credential -> IO (Creds m)) -- ^ How to extract ident. -> AuthPlugin mauthOAuth oauth mkCreds = AuthPlugin name dispatch login 阅读全文
posted @ 2012-03-19 11:29 kelby 阅读(309) 评论(0) 推荐(0) 编辑