Include Persona login icon yesodweb/authenticate#19

This commit is contained in:
Michael Snoyman 2013-02-18 11:30:23 +02:00
parent 431787f7cb
commit 581248b1c8
3 changed files with 11 additions and 2 deletions

View File

@ -1,5 +1,6 @@
{-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
module Yesod.Auth.BrowserId module Yesod.Auth.BrowserId
( authBrowserId ( authBrowserId
, authBrowserIdAudience , authBrowserIdAudience
@ -19,6 +20,8 @@ import Control.Exception (throwIO)
import Text.Julius (julius, rawJS) import Text.Julius (julius, rawJS)
import Data.Aeson (toJSON) import Data.Aeson (toJSON)
import Network.URI (uriPath, parseURI) import Network.URI (uriPath, parseURI)
import Data.FileEmbed (embedFile)
import Data.ByteString (ByteString)
pid :: Text pid :: Text
pid = "browserid" pid = "browserid"
@ -62,6 +65,10 @@ helper maudience = AuthPlugin
, credsIdent = email , credsIdent = email
, credsExtra = [] , credsExtra = []
} }
("GET", ["static", "sign-in.png"]) -> sendResponse
( "image/png" :: ByteString
, toContent $(embedFile "persona_sign_in_blue.png")
)
(_, []) -> badMethod (_, []) -> badMethod
_ -> notFound _ -> notFound
, apLogin = \toMaster -> do , apLogin = \toMaster -> do
@ -76,10 +83,11 @@ helper maudience = AuthPlugin
$newline never $newline never
<p> <p>
<a href="javascript:#{onclick}()"> <a href="javascript:#{onclick}()">
<img src="https://browserid.org/i/sign_in_green.png"> <img src=@{toMaster loginIcon}>
|] |]
} }
where where
loginIcon = PluginR pid ["static", "sign-in.png"]
stripScheme t = fromMaybe t $ T.stripPrefix "//" $ snd $ T.breakOn "//" t stripScheme t = fromMaybe t $ T.stripPrefix "//" $ snd $ T.breakOn "//" t
-- | Generates a function to handle on-click events, and returns that function -- | Generates a function to handle on-click events, and returns that function

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@ -1,5 +1,5 @@
name: yesod-auth name: yesod-auth
version: 1.1.4.1 version: 1.1.5
license: MIT license: MIT
license-file: LICENSE license-file: LICENSE
author: Michael Snoyman, Patrick Brisbin author: Michael Snoyman, Patrick Brisbin
@ -11,6 +11,7 @@ cabal-version: >= 1.6.0
build-type: Simple build-type: Simple
homepage: http://www.yesodweb.com/ homepage: http://www.yesodweb.com/
description: Authentication for Yesod. description: Authentication for Yesod.
extra-source-files: persona_sign_in_blue.png
library library
build-depends: base >= 4 && < 5 build-depends: base >= 4 && < 5