Merge branch 'master' into wai-2.0
This commit is contained in:
commit
94f42659ea
@ -62,9 +62,9 @@ If you aren't building from an application, remove the `./` and create a new dir
|
||||
|
||||
|
||||
|
||||
## hsenv (Linux only)
|
||||
## hsenv (Linux and Mac OS X)
|
||||
|
||||
[hsenv](http://hackage.haskell.org/package/hsenv) prevents your custom build of Yesod from interfering with your currently installed cabal packages:
|
||||
[hsenv](https://github.com/tmhedberg/hsenv) prevents your custom build of Yesod from interfering with your currently installed cabal packages:
|
||||
|
||||
* hsenv creates an isolated environment like cabal-dev
|
||||
* hsenv works at the shell level, so every shell must activate the hsenv
|
||||
|
||||
@ -164,6 +164,14 @@ class (YesodAuth site, PathPiece (AuthEmailId site)) => YesodAuthEmail site wher
|
||||
| TS.length x >= 3 = return $ Right ()
|
||||
| otherwise = return $ Left "Password must be at least three characters"
|
||||
|
||||
-- | Response after sending a confirmation email.
|
||||
--
|
||||
-- Since 1.2.2
|
||||
confirmationEmailSentResponse :: Text -> HandlerT site IO Html
|
||||
confirmationEmailSentResponse identifier = defaultLayout $ do
|
||||
setTitleI Msg.ConfirmationEmailSentTitle
|
||||
[whamlet|<p>_{Msg.ConfirmationEmailSent identifier}|]
|
||||
|
||||
authEmail :: YesodAuthEmail m => AuthPlugin m
|
||||
authEmail =
|
||||
AuthPlugin "email" dispatch $ \tm ->
|
||||
@ -249,9 +257,7 @@ registerHelper allowUsername dest = do
|
||||
render <- getUrlRender
|
||||
let verUrl = render $ verify (toPathPiece lid) verKey
|
||||
lift $ sendVerifyEmail email verKey verUrl
|
||||
lift $ defaultLayout $ do
|
||||
setTitleI Msg.ConfirmationEmailSentTitle
|
||||
[whamlet|<p>_{Msg.ConfirmationEmailSent identifier}|]
|
||||
lift $ confirmationEmailSentResponse identifier
|
||||
|
||||
postRegisterR :: YesodAuthEmail master => HandlerT Auth (HandlerT master IO) Html
|
||||
postRegisterR = registerHelper False registerR
|
||||
|
||||
@ -14,6 +14,7 @@ module Yesod.Auth.Message
|
||||
, finnishMessage
|
||||
, chineseMessage
|
||||
, spanishMessage
|
||||
, czechMessage
|
||||
) where
|
||||
|
||||
import Data.Monoid (mappend)
|
||||
@ -473,4 +474,41 @@ chineseMessage SendPasswordResetEmail = "发送密码重置邮件"
|
||||
chineseMessage PasswordResetPrompt = "输入你的邮箱地址或用户名,你将收到一封密码重置邮件。"
|
||||
chineseMessage InvalidUsernamePass = "无效的用户名/密码组合"
|
||||
|
||||
|
||||
czechMessage :: AuthMessage -> Text
|
||||
czechMessage NoOpenID = "Nebyl nalezen identifikátor OpenID"
|
||||
czechMessage LoginOpenID = "Přihlásit přes OpenID"
|
||||
czechMessage LoginGoogle = "Přihlásit přes Google"
|
||||
czechMessage LoginYahoo = "Přihlásit přes Yahoo"
|
||||
czechMessage Email = "E-mail"
|
||||
czechMessage Password = "Heslo"
|
||||
czechMessage Register = "Registrovat"
|
||||
czechMessage RegisterLong = "Zaregistrovat nový účet"
|
||||
czechMessage EnterEmail = "Níže zadejte svou e-mailovou adresu a bude vám poslán potvrzovací e-mail."
|
||||
czechMessage ConfirmationEmailSentTitle = "Potvrzovací e-mail odeslán"
|
||||
czechMessage (ConfirmationEmailSent email) =
|
||||
"Potvrzovací e-mail byl odeslán na " `mappend` email `mappend` "."
|
||||
czechMessage AddressVerified = "Adresa byla ověřena, prosím nastavte si nové heslo"
|
||||
czechMessage InvalidKeyTitle = "Neplatný ověřovací klíč"
|
||||
czechMessage InvalidKey = "Bohužel, ověřovací klíč je neplatný."
|
||||
czechMessage InvalidEmailPass = "Neplatná kombinace e-mail/heslo"
|
||||
czechMessage BadSetPass = "Pro nastavení hesla je vyžadováno přihlášení"
|
||||
czechMessage SetPassTitle = "Nastavit heslo"
|
||||
czechMessage SetPass = "Nastavit nové heslo"
|
||||
czechMessage NewPass = "Nové heslo"
|
||||
czechMessage ConfirmPass = "Potvrdit"
|
||||
czechMessage PassMismatch = "Hesla si neodpovídají, zkuste to znovu"
|
||||
czechMessage PassUpdated = "Heslo aktualizováno"
|
||||
czechMessage Facebook = "Přihlásit přes Facebook"
|
||||
czechMessage LoginViaEmail = "Přihlásit přes e-mail"
|
||||
czechMessage InvalidLogin = "Neplatné přihlášení"
|
||||
czechMessage NowLoggedIn = "Přihlášení proběhlo úspěšně"
|
||||
czechMessage LoginTitle = "Přihlásit"
|
||||
czechMessage PleaseProvideUsername = "Prosím, zadejte svoje uživatelské jméno"
|
||||
czechMessage PleaseProvidePassword = "Prosím, zadejte svoje heslo"
|
||||
czechMessage NoIdentifierProvided = "Nebyl poskytnut žádný e-mail nebo uživatelské jméno"
|
||||
czechMessage InvalidEmailAddress = "Zadaná e-mailová adresa je neplatná"
|
||||
czechMessage PasswordResetTitle = "Obnovení hesla"
|
||||
czechMessage ProvideIdentifier = "E-mail nebo uživatelské jméno"
|
||||
czechMessage SendPasswordResetEmail = "Poslat e-mail pro obnovení hesla"
|
||||
czechMessage PasswordResetPrompt = "Zadejte svou e-mailovou adresu nebo uživatelské jméno a bude vám poslán email pro obnovení hesla."
|
||||
czechMessage InvalidUsernamePass = "Neplatná kombinace uživatelského jména a hesla"
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
name: yesod-auth
|
||||
version: 1.2.1
|
||||
version: 1.2.2
|
||||
license: MIT
|
||||
license-file: LICENSE
|
||||
author: Michael Snoyman, Patrick Brisbin
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
name: yesod-bin
|
||||
version: 1.2.2.1
|
||||
version: 1.2.3
|
||||
license: MIT
|
||||
license-file: LICENSE
|
||||
author: Michael Snoyman <michael@snoyman.com>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
name: yesod-core
|
||||
version: 1.2.4
|
||||
version: 1.2.4.1
|
||||
license: MIT
|
||||
license-file: LICENSE
|
||||
author: Michael Snoyman <michael@snoyman.com>
|
||||
|
||||
@ -42,6 +42,7 @@ module Yesod.Form.Fields
|
||||
, OptionList (..)
|
||||
, mkOptionList
|
||||
, optionsPersist
|
||||
, optionsPersistKey
|
||||
, optionsPairs
|
||||
, optionsEnum
|
||||
) where
|
||||
@ -86,6 +87,8 @@ import Control.Applicative ((<$>), (<|>))
|
||||
|
||||
import Data.Attoparsec.Text (Parser, char, string, digit, skipSpace, endOfInput, parseOnly)
|
||||
|
||||
import Yesod.Persist.Core
|
||||
|
||||
defaultFormMessage :: FormMessage -> Text
|
||||
defaultFormMessage = englishFormMessage
|
||||
|
||||
@ -513,6 +516,31 @@ optionsPersist filts ords toDisplay = fmap mkOptionList $ do
|
||||
, optionExternalValue = toPathPiece key
|
||||
}) pairs
|
||||
|
||||
-- | An alternative to 'optionsPersist' which returns just the @Key@ instead of
|
||||
-- the entire @Entity@.
|
||||
--
|
||||
-- Since 1.3.2
|
||||
optionsPersistKey
|
||||
:: (YesodPersist site
|
||||
, PersistEntity a
|
||||
, PersistQuery (YesodPersistBackend site (HandlerT site IO))
|
||||
, PathPiece (Key a)
|
||||
, RenderMessage site msg
|
||||
, PersistEntityBackend a ~ PersistMonadBackend (YesodDB site))
|
||||
=> [Filter a]
|
||||
-> [SelectOpt a]
|
||||
-> (a -> msg)
|
||||
-> HandlerT site IO (OptionList (Key a))
|
||||
|
||||
optionsPersistKey filts ords toDisplay = fmap mkOptionList $ do
|
||||
mr <- getMessageRender
|
||||
pairs <- runDB $ selectList filts ords
|
||||
return $ map (\(Entity key value) -> Option
|
||||
{ optionDisplay = mr (toDisplay value)
|
||||
, optionInternalValue = key
|
||||
, optionExternalValue = toPathPiece key
|
||||
}) pairs
|
||||
|
||||
selectFieldHelper
|
||||
:: (Eq a, RenderMessage site FormMessage)
|
||||
=> (Text -> Text -> [(Text, Text)] -> WidgetT site IO () -> WidgetT site IO ())
|
||||
|
||||
@ -99,13 +99,18 @@ askFiles = do
|
||||
(x, _, _) <- ask
|
||||
return $ liftM snd x
|
||||
|
||||
-- | Converts a form field into monadic form. This field requires a value
|
||||
-- and will return 'FormFailure' if left empty.
|
||||
mreq :: (RenderMessage site FormMessage, HandlerSite m ~ site, MonadHandler m)
|
||||
=> Field m a
|
||||
-> FieldSettings site
|
||||
-> Maybe a
|
||||
=> Field m a -- ^ form field
|
||||
-> FieldSettings site -- ^ settings for this field
|
||||
-> Maybe a -- ^ optional default value
|
||||
-> MForm m (FormResult a, FieldView site)
|
||||
mreq field fs mdef = mhelper field fs mdef (\m l -> FormFailure [renderMessage m l MsgValueRequired]) FormSuccess True
|
||||
|
||||
-- | Converts a form field into monadic form. This field is optional, i.e.
|
||||
-- if filled in, it returns 'Just a', if left empty, it returns 'Nothing'.
|
||||
-- Arguments are the same as for 'mreq' (apart from type of default value).
|
||||
mopt :: (site ~ HandlerSite m, MonadHandler m)
|
||||
=> Field m a
|
||||
-> FieldSettings site
|
||||
@ -155,6 +160,7 @@ mhelper Field {..} FieldSettings {..} mdef onMissing onFound isReq = do
|
||||
, fvRequired = isReq
|
||||
})
|
||||
|
||||
-- | Applicative equivalent of 'mreq'.
|
||||
areq :: (RenderMessage site FormMessage, HandlerSite m ~ site, MonadHandler m)
|
||||
=> Field m a
|
||||
-> FieldSettings site
|
||||
@ -162,6 +168,7 @@ areq :: (RenderMessage site FormMessage, HandlerSite m ~ site, MonadHandler m)
|
||||
-> AForm m a
|
||||
areq a b = formToAForm . liftM (second return) . mreq a b
|
||||
|
||||
-- | Applicative equivalent of 'mopt'.
|
||||
aopt :: MonadHandler m
|
||||
=> Field m a
|
||||
-> FieldSettings (HandlerSite m)
|
||||
@ -218,7 +225,7 @@ postHelper form env = do
|
||||
_ === _ = False -- in order to avoid timing attacks.
|
||||
return ((res', xml), enctype)
|
||||
|
||||
-- | Similar to 'runFormPost', except it always ignore the currently available
|
||||
-- | Similar to 'runFormPost', except it always ignores the currently available
|
||||
-- environment. This is necessary in cases like a wizard UI, where a single
|
||||
-- page will both receive and incoming form and produce a new, blank form. For
|
||||
-- general usage, you can stick with @runFormPost@.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
name: yesod-form
|
||||
version: 1.3.1
|
||||
version: 1.3.2
|
||||
license: MIT
|
||||
license-file: LICENSE
|
||||
author: Michael Snoyman <michael@snoyman.com>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
name: yesod-platform
|
||||
version: 1.2.3
|
||||
version: 1.2.4
|
||||
license: MIT
|
||||
license-file: LICENSE
|
||||
author: Michael Snoyman <michael@snoyman.com>
|
||||
@ -15,7 +15,7 @@ homepage: http://www.yesodweb.com/
|
||||
library
|
||||
build-depends: base >= 4 && < 5
|
||||
, SHA == 1.6.1
|
||||
, aeson == 0.6.1.0
|
||||
, aeson == 0.6.2.0
|
||||
, ansi-terminal == 0.6
|
||||
, asn1-data == 0.7.1
|
||||
, asn1-types == 0.2.0
|
||||
@ -30,22 +30,24 @@ library
|
||||
, blaze-markup == 0.5.1.5
|
||||
, byteable == 0.1.1
|
||||
, byteorder == 1.0.4
|
||||
, case-insensitive == 1.0.0.2
|
||||
, case-insensitive == 1.1
|
||||
, cereal == 0.3.5.2
|
||||
, certificate == 1.3.8
|
||||
, cipher-aes == 0.1.8
|
||||
, cipher-aes == 0.2.5
|
||||
, cipher-rc4 == 0.1.2
|
||||
, clientsession == 0.9
|
||||
, conduit == 1.0.7.3
|
||||
, clientsession == 0.9.0.3
|
||||
, conduit == 1.0.7.4
|
||||
, cookie == 0.4.0.1
|
||||
, cprng-aes == 0.3.4
|
||||
, crypto-api == 0.12.2.1
|
||||
, cprng-aes == 0.5.2
|
||||
, crypto-api == 0.12.2.2
|
||||
, crypto-cipher-types == 0.0.4
|
||||
, crypto-conduit == 0.5.2
|
||||
, crypto-numbers == 0.1.3
|
||||
, crypto-pubkey == 0.1.4
|
||||
, crypto-numbers == 0.2.1
|
||||
, crypto-pubkey == 0.2.1
|
||||
, crypto-pubkey-types == 0.4.0
|
||||
, crypto-random-api == 0.2.0
|
||||
, cryptohash == 0.9.1
|
||||
, crypto-random == 0.0.7
|
||||
, cryptohash == 0.10.0
|
||||
, cryptohash-cryptoapi == 0.1.0
|
||||
, css-text == 0.1.1
|
||||
, data-default == 0.5.3
|
||||
, data-default-class == 0.0.1
|
||||
@ -56,23 +58,23 @@ library
|
||||
, date-cache == 0.3.0
|
||||
, dlist == 0.5
|
||||
, email-validate == 1.0.0
|
||||
, entropy == 0.2.2.1
|
||||
, entropy == 0.2.2.2
|
||||
, failure == 0.2.0.1
|
||||
, fast-logger == 0.3.2
|
||||
, fast-logger == 0.3.3
|
||||
, file-embed == 0.0.4.9
|
||||
, filesystem-conduit == 1.0.0.1
|
||||
, hamlet == 1.1.7.1
|
||||
, hjsmin == 0.1.4.1
|
||||
, hspec == 1.6.1
|
||||
, hspec-expectations == 0.3.2
|
||||
, hspec == 1.7.2
|
||||
, hspec-expectations == 0.3.3
|
||||
, html-conduit == 1.1.0
|
||||
, http-attoparsec == 0.1.0
|
||||
, http-conduit == 1.9.4.1
|
||||
, http-conduit == 1.9.4.5
|
||||
, http-date == 0.0.4
|
||||
, http-types == 0.8.0
|
||||
, http-types == 0.8.1
|
||||
, language-javascript == 0.5.7
|
||||
, lifted-base == 0.2.1.0
|
||||
, mime-mail == 0.4.2
|
||||
, mime-mail == 0.4.2.1
|
||||
, mime-types == 0.1.0.3
|
||||
, mmorph == 1.0.0
|
||||
, monad-control == 0.3.2.1
|
||||
@ -80,7 +82,7 @@ library
|
||||
, network-conduit == 1.0.0
|
||||
, path-pieces == 0.1.2
|
||||
, pem == 0.1.2
|
||||
, persistent == 1.2.2.0
|
||||
, persistent == 1.2.3.0
|
||||
, persistent-template == 1.2.0.2
|
||||
, pool-conduit == 0.1.2
|
||||
, primitive == 0.5.0.1
|
||||
@ -89,54 +91,55 @@ library
|
||||
, pwstore-fast == 2.3
|
||||
, quickcheck-io == 0.1.0
|
||||
, resource-pool == 0.2.1.1
|
||||
, resourcet == 0.4.7.1
|
||||
, resourcet == 0.4.8
|
||||
, safe == 0.3.3
|
||||
, securemem == 0.1.3
|
||||
, semigroups == 0.9.2
|
||||
, setenv == 0.1.0
|
||||
, shakespeare == 1.0.5
|
||||
, shakespeare == 1.0.5.1
|
||||
, shakespeare-css == 1.0.6.2
|
||||
, shakespeare-i18n == 1.0.0.3
|
||||
, shakespeare-js == 1.1.4.1
|
||||
, shakespeare-text == 1.0.0.6
|
||||
, silently == 1.2.4.1
|
||||
, simple-sendfile == 0.2.12
|
||||
, skein == 1.0.3
|
||||
, skein == 1.0.6
|
||||
, socks == 0.5.1
|
||||
, stringsearch == 0.3.6.4
|
||||
, system-fileio == 0.3.11
|
||||
, system-filepath == 0.4.7
|
||||
, tagged == 0.6.1
|
||||
, tagsoup == 0.12.8
|
||||
, tagged == 0.7
|
||||
, tagsoup == 0.13
|
||||
, tagstream-conduit == 0.5.4
|
||||
, tls == 1.1.2
|
||||
, tls-extra == 0.6.4
|
||||
, tls == 1.1.5
|
||||
, tls-extra == 0.6.5
|
||||
, transformers-base == 0.4.1
|
||||
, unix-compat == 0.4.1.1
|
||||
, unordered-containers == 0.2.3.1
|
||||
, unordered-containers == 0.2.3.2
|
||||
, utf8-light == 0.4.0.1
|
||||
, utf8-string == 0.3.7
|
||||
, vault == 0.2.0.4
|
||||
, vault == 0.3.0.0
|
||||
, vector == 0.10.0.1
|
||||
, void == 0.6.1
|
||||
, wai == 1.4.0.1
|
||||
, wai-app-static == 1.3.1.3
|
||||
, wai-extra == 1.3.4.2
|
||||
, wai == 1.4.0.2
|
||||
, wai-app-static == 1.3.1.4
|
||||
, wai-extra == 1.3.4.4
|
||||
, wai-logger == 0.3.1
|
||||
, wai-test == 1.3.1.1
|
||||
, warp == 1.3.9
|
||||
, warp == 1.3.9.2
|
||||
, word8 == 0.0.3
|
||||
, xml-conduit == 1.1.0.5
|
||||
, xml-conduit == 1.1.0.7
|
||||
, xml-types == 0.3.4
|
||||
, xss-sanitize == 0.3.4
|
||||
, yaml == 0.8.4
|
||||
, yesod == 1.2.1.1
|
||||
, yesod-auth == 1.2.0.2
|
||||
, yesod-core == 1.2.3
|
||||
, yesod-form == 1.3.0.1
|
||||
, yaml == 0.8.4.1
|
||||
, yesod == 1.2.2
|
||||
, yesod-auth == 1.2.2
|
||||
, yesod-core == 1.2.4.1
|
||||
, yesod-form == 1.3.2
|
||||
, yesod-persistent == 1.2.1
|
||||
, yesod-routes == 1.2.0.1
|
||||
, yesod-static == 1.2.0
|
||||
, yesod-test == 1.2.0
|
||||
, yesod-static == 1.2.0.1
|
||||
, yesod-test == 1.2.1
|
||||
, zlib-bindings == 0.1.1.3
|
||||
, zlib-conduit == 1.0.0
|
||||
|
||||
|
||||
@ -73,7 +73,7 @@ import Language.Haskell.TH
|
||||
import Language.Haskell.TH.Syntax as TH
|
||||
|
||||
import Crypto.Conduit (hashFile, sinkHash)
|
||||
import Crypto.Hash.MD5 (MD5)
|
||||
import Crypto.Hash.CryptoAPI (MD5)
|
||||
import Control.Monad.Trans.State
|
||||
|
||||
import qualified Data.ByteString.Base64
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
name: yesod-static
|
||||
version: 1.2.0
|
||||
version: 1.2.0.1
|
||||
license: MIT
|
||||
license-file: LICENSE
|
||||
author: Michael Snoyman <michael@snoyman.com>
|
||||
@ -38,7 +38,7 @@ library
|
||||
, unix-compat >= 0.2
|
||||
, conduit >= 0.5
|
||||
, crypto-conduit >= 0.4
|
||||
, cryptohash >= 0.6.1
|
||||
, cryptohash-cryptoapi >= 0.1.0
|
||||
, system-filepath >= 0.4.6 && < 0.5
|
||||
, system-fileio >= 0.3
|
||||
, data-default
|
||||
@ -71,7 +71,7 @@ test-suite tests
|
||||
, unix-compat
|
||||
, conduit
|
||||
, crypto-conduit
|
||||
, cryptohash
|
||||
, cryptohash-cryptoapi
|
||||
, system-filepath
|
||||
, system-fileio
|
||||
, data-default
|
||||
|
||||
@ -1,11 +1,8 @@
|
||||
# Overview
|
||||
|
||||
The yesod package
|
||||
The yesod package groups together the various Yesod related packages into one cohesive whole.
|
||||
|
||||
* groups together the various Yesod related packages into one cohesive whole.
|
||||
* contains the executable yesod
|
||||
* yesod devel - start a development environment
|
||||
* yesod init - create a scaffolded site
|
||||
For the yesod executeable, see [yesod-bin](/yesod-bin)
|
||||
|
||||
# Scaffolding
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user