diff --git a/.gitignore b/.gitignore index e809c018..e5067852 100644 --- a/.gitignore +++ b/.gitignore @@ -6,5 +6,4 @@ dist client_session_key.aes cabal-dev/ yesod/foobar/ -yesod-platform/yesod-platform.cabal .virthualenv diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..8599bd8d --- /dev/null +++ b/.travis.yml @@ -0,0 +1,7 @@ +language: haskell + +install: + - cabal install mega-sdist hspec cabal-meta cabal-src + - cabal-meta install + +script: mega-sdist --test diff --git a/LICENSE b/LICENSE index 8643e5d8..d9f04179 100644 --- a/LICENSE +++ b/LICENSE @@ -1,25 +1,20 @@ -The following license covers this documentation, and the source code, except -where otherwise indicated. +Copyright (c) 2012 Michael Snoyman, http://www.yesodweb.com/ -Copyright 2010, Michael Snoyman. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, -OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md index e0156e8f..9674180b 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +# Yesod + An advanced web framework using the Haskell programming language. Featuring: * safety & security guaranteed at compile time @@ -9,99 +11,118 @@ An advanced web framework using the Haskell programming language. Featuring: * this is built in to the Haskell programming language (like Erlang) * handles a greater concurrent load than any other web application server -## Learn more: http://yesodweb.com/ +# Learn more: http://yesodweb.com/ -## Installation: http://www.yesodweb.com/page/five-minutes +## Install the latests stable Yesod: http://www.yesodweb.com/page/quickstart cabal update && cabal install yesod -## Create a new project after installing +### Create a new project after installing yesod init +Your application is a cabal package and you use `cabal` to install its dependencies. + +# Installing & isolation + +Install conflicts are unfortunately common in Haskell development. +If you are not using any sandbox tools, you may discover that some of the other haskell installs on your system are broken. +You can prevent this by using sandbox tools: `cabal-dev` or `virthualenv`, now being renamed to `hsenv`. + +Isolating an entire project with a virtual machine is also a great idea, you just need some tools to help that process. +[Vagrant](http://vagrantup.com) is a great tool for that and there is a [Haskell Platform installer](https://bitbucket.org/puffnfresh/vagrant-haskell-heroku) for it. ## Using cabal-dev cabal-dev creates a sandboxed environment for an individual cabal package. -Your application is a cabal package and you should use cabal-dev with your Yesod application. -Instead of using the `cabal` command, use the `cabal-dev` command. +Instead of using the `cabal` command, use the `cabal-dev` command which will use the sandbox. Use `yesod-devel --dev` when developing your application. -## Installing the latest development version from github -Yesod is broken up into 4 separate code repositories each built upon many smaller packages. -Install conflicts are unfortunately common in Haskell development. -However, we can prevent most of them by using some extra tools. -This will require a little up-front reading and learning, but save you from a lot of misery in the long-run. -See the above explanation of cabal-dev, and below of virthualenv. +## Installing the latest development version from github for use with your application -Please note that cabal-dev will not work in a virthualenv shell - you can't use both at the same time. + cabal update + cabal install cabal-meta cabal-src -### virthualenv +In your application folder, create a `sources.txt` file with the following contents: -We recommend using [virthualenv](http://hackage.haskell.org/package/virthualenv) when hacking on Yesod. -This is optional, but prevents your custom build of Yesod from interfering with your currently installed cabal packages. + ./ + https://github.com/yesodweb/yesod + https://github.com/yesodweb/shakespeare + https://github.com/yesodweb/persistent + https://github.com/yesodweb/wai -virthualenv will not work on Windows - Windows users should use only cabal-dev. +`./` means build your app. The yesod repos will be cloned and placed in a `vendor` repo. +Now run: `cabal-meta install`. If you use `cabal-dev`, run `cabal-meta --dev install` + +This should work almost all of the time. You can read more on [cabal-meta](https://github.com/yesodweb/cabal-meta) +If you aren't building from an application, remove the `./` and create a new directory for your sources.txt first. + + + +## virthualenv + +We recommend using [virthualenv](http://hackage.haskell.org/package/virthualenv)/[hsenv](https://github.com/Paczesiowa/hsenv) when hacking on Yesod from Linux. This is optional, but prevents your custom build of Yesod from interfering with your currently installed cabal packages. + +virthualenv will not work on Windows and maybe not Mac. Use cabal-dev instead * virthualenv creates an isolated environment like cabal-dev * virthualenv works at the shell level, so every shell must activate the virthualenv * cabal-dev by default isolates a single cabal package, but virthualenv isolates multiple packages together. * cabal-dev can isolate multiple packages together by using the -s sandbox argument -To just install Yesod from github, we only need cabal-dev. For hacking we prefer virthualenv: it is more convenient to just use normal cabal commands rather than `cabal-dev -s`. +## cabal-src -### cabal-src - -Michael Snoyman just released the cabal-src tool, which helps resolve dependency conflicts when installing local packages. This capability is already built in if you are using cabal-dev. Otherwise install it with: +The cabal-src tool helps resolve dependency conflicts when installing local packages. +This capability is already built in if you are using cabal-dev or cabal-meta. Otherwise install cabal-src with: cabal install cabal-src -Whenever you would use `cabal install` for a local package, use `cabal-src-install` instead. Our installer script now uses cabal-src-install when it is available. +Whenever you would use `cabal install` to install a local package, use `cabal-src-install` instead. +Our installer script now uses cabal-src-install when it is available. -### Building Yesod +## Cloning the repos + +The above instructions for building the latest should work well. +But you can clone the repos without the help of cabal-meta: ~~~ { .bash } -# update your package database if you haven't recently -cabal update -# install required libraries -cabal install Cabal cabal-install - -# use cabal-dev -cabal install cabal-dev - -# or use virthualenv -cabal install cabal-src virthualenv -cd yesodweb # the folder where you put the yesod, persistent, hamlet & wai repos -virthualenv --name=yesod -. .virthualenv/bin/activate - -# clone and install all repos -# see below about first using virthualenv/cabal-dev before running ./scripts/install -for repo in hamlet persistent wai yesod; do +for repo in shakespeare persistent wai yesod; do git clone http://github.com/yesodweb/$repo ( cd $repo git submodule update --init - ./scripts/install ) done +~~~~ + +## Building your changes to Yesod + +Yesod is composed of 4 "mega-repos", each with multiple cabal packages. `./script/install` will run tests against each package and install each package. + +### install package in all repos + +~~~ { .bash } +for repo in shakespeare persistent wai yesod; do + pushd $repo + ./scripts/install + popd +done ~~~ - -#### installing repo packages +### Clean build (sometimes necessary) ~~~ { .bash } -# install and test all packages in a repo -./scripts/install - -# If things seem weird, you may need to do a clean. ./scripts/install --clean +~~~ +### Building individual packages + +~~~ { .bash } # move to the individual package you are working on cd shakespeare-text @@ -110,11 +131,3 @@ cabal configure -ftest --enable-tests cabal build cabal test ~~~ - - -### Use your development version of Yesod in your application - -Note that we have recommended to you to install Yesod into a sandboxed virthualenv environment. -This is great for development, but when you want to use these development versions in your application that means they are not available through your user/global cabal database for your application. -You should just continue to use your yesod virthualenv shell for your application. -You can also use the same`cabal-dev shared sandbox. diff --git a/scripts b/scripts index eba05a0b..e1128e3e 160000 --- a/scripts +++ b/scripts @@ -1 +1 @@ -Subproject commit eba05a0b5fe121883969f8fa9b7f7669592430a4 +Subproject commit e1128e3eacb21cb4a59c00f30abf536c8ba66893 diff --git a/sources.txt b/sources.txt index 20fc55d6..3830938b 100644 --- a/sources.txt +++ b/sources.txt @@ -10,4 +10,3 @@ ./yesod-default ./yesod-test ./yesod -./yesod-test diff --git a/yesod-auth-oauth/LICENSE b/yesod-auth-oauth/LICENSE index 8643e5d8..d9f04179 100644 --- a/yesod-auth-oauth/LICENSE +++ b/yesod-auth-oauth/LICENSE @@ -1,25 +1,20 @@ -The following license covers this documentation, and the source code, except -where otherwise indicated. +Copyright (c) 2012 Michael Snoyman, http://www.yesodweb.com/ -Copyright 2010, Michael Snoyman. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, -OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/yesod-auth-oauth/yesod-auth-oauth.cabal b/yesod-auth-oauth/yesod-auth-oauth.cabal index d3c92cc5..97992b24 100644 --- a/yesod-auth-oauth/yesod-auth-oauth.cabal +++ b/yesod-auth-oauth/yesod-auth-oauth.cabal @@ -1,5 +1,5 @@ name: yesod-auth-oauth -version: 1.0.0 +version: 1.1.0.0 license: BSD3 license-file: LICENSE author: Hiromi Ishii @@ -10,8 +10,7 @@ stability: Stable cabal-version: >= 1.6.0 build-type: Simple homepage: http://www.yesodweb.com/ -extra-source-files: include/qq.h -description: Authentication for Yesod. +description: Oauth Authentication for Yesod. flag ghc7 @@ -21,13 +20,13 @@ library cpp-options: -DGHC7 else build-depends: base >= 4 && < 4.3 - build-depends: authenticate-oauth >= 1.3 && < 1.4 + build-depends: authenticate-oauth >= 1.4 && < 1.5 , bytestring >= 0.9.1.4 && < 0.10 - , yesod-core >= 1.0 && < 1.1 - , yesod-auth >= 1.0 && < 1.1 + , yesod-core >= 1.1 && < 1.2 + , yesod-auth >= 1.1 && < 1.2 , text >= 0.7 && < 0.12 - , yesod-form >= 1.0 && < 1.1 - , transformers >= 0.2.2 && < 0.3 + , yesod-form >= 1.1 && < 1.2 + , transformers >= 0.2.2 && < 0.4 exposed-modules: Yesod.Auth.OAuth ghc-options: -Wall diff --git a/yesod-auth/LICENSE b/yesod-auth/LICENSE index 8643e5d8..d9f04179 100644 --- a/yesod-auth/LICENSE +++ b/yesod-auth/LICENSE @@ -1,25 +1,20 @@ -The following license covers this documentation, and the source code, except -where otherwise indicated. +Copyright (c) 2012 Michael Snoyman, http://www.yesodweb.com/ -Copyright 2010, Michael Snoyman. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, -OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/yesod-auth/Yesod/Auth.hs b/yesod-auth/Yesod/Auth.hs index 6b284e7c..3e8d7106 100644 --- a/yesod-auth/Yesod/Auth.hs +++ b/yesod-auth/Yesod/Auth.hs @@ -149,7 +149,10 @@ setCreds doRedirects creds = do Nothing -> when doRedirects $ do case authRoute y of - Nothing -> do rh <- defaultLayout $ toWidget [shamlet|

Invalid login |] + Nothing -> do rh <- defaultLayout $ toWidget [shamlet| +$newline never +

Invalid login +|] sendResponse rh Just ar -> do setMessageI Msg.InvalidLogin redirect ar @@ -168,6 +171,7 @@ getCheckR = do where html' creds = [shamlet| +$newline never

Authentication Status $maybe _ <- creds

Logged in. diff --git a/yesod-auth/Yesod/Auth/BrowserId.hs b/yesod-auth/Yesod/Auth/BrowserId.hs index 4b3f7c88..be847acf 100644 --- a/yesod-auth/Yesod/Auth/BrowserId.hs +++ b/yesod-auth/Yesod/Auth/BrowserId.hs @@ -62,6 +62,7 @@ helper maudience = AuthPlugin , apLogin = \toMaster -> do addScriptRemote browserIdJs toWidget [hamlet| +$newline never

diff --git a/yesod-auth/Yesod/Auth/Dummy.hs b/yesod-auth/Yesod/Auth/Dummy.hs index e9ba805c..7ba931e5 100644 --- a/yesod-auth/Yesod/Auth/Dummy.hs +++ b/yesod-auth/Yesod/Auth/Dummy.hs @@ -24,6 +24,7 @@ authDummy = url = PluginR "dummy" [] login authToMaster = toWidget [hamlet| +$newline never

Your new identifier is: # diff --git a/yesod-auth/Yesod/Auth/Email.hs b/yesod-auth/Yesod/Auth/Email.hs index 4e35f09a..5101ff0e 100644 --- a/yesod-auth/Yesod/Auth/Email.hs +++ b/yesod-auth/Yesod/Auth/Email.hs @@ -79,6 +79,7 @@ authEmail :: YesodAuthEmail m => AuthPlugin m authEmail = AuthPlugin "email" dispatch $ \tm -> [whamlet| +$newline never @@ -112,6 +113,7 @@ getRegisterR = do defaultLayout $ do setTitleI Msg.RegisterLong [whamlet| +$newline never

_{Msg.EnterEmail}

_{Msg.ConfirmationEmailSent email} |] + [whamlet| +$newline never +

_{Msg.ConfirmationEmailSent email} +|] getVerifyR :: YesodAuthEmail m => AuthEmailId m -> Text -> GHandler Auth m RepHtml @@ -161,7 +166,10 @@ getVerifyR lid key = do _ -> return () defaultLayout $ do setTitleI Msg.InvalidKey - [whamlet|

_{Msg.InvalidKey} |] + [whamlet| +$newline never +

_{Msg.InvalidKey} +|] postLoginR :: YesodAuthEmail master => GHandler Auth master () postLoginR = do @@ -200,6 +208,7 @@ getPasswordR = do defaultLayout $ do setTitleI Msg.SetPassTitle [whamlet| +$newline never

_{Msg.SetPass}

diff --git a/yesod-auth/Yesod/Auth/GoogleEmail.hs b/yesod-auth/Yesod/Auth/GoogleEmail.hs index 9d796123..8f06abe3 100644 --- a/yesod-auth/Yesod/Auth/GoogleEmail.hs +++ b/yesod-auth/Yesod/Auth/GoogleEmail.hs @@ -1,5 +1,6 @@ {-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE CPP #-} -- | Use an email address as an identifier via Google's OpenID login system. -- -- This backend will not use the OpenID identifier at all. It only uses OpenID @@ -20,25 +21,35 @@ import qualified Web.Authenticate.OpenId as OpenId import Yesod.Handler import Yesod.Widget (whamlet) import Yesod.Request +#if MIN_VERSION_blaze_html(0, 5, 0) +import Text.Blaze.Html (toHtml) +#else import Text.Blaze (toHtml) +#endif import Data.Text (Text) import qualified Yesod.Auth.Message as Msg import qualified Data.Text as T import Control.Exception.Lifted (try, SomeException) +pid :: Text +pid = "googleemail" + forwardUrl :: AuthRoute -forwardUrl = PluginR "googleemail" ["forward"] +forwardUrl = PluginR pid ["forward"] googleIdent :: Text googleIdent = "https://www.google.com/accounts/o8/id" authGoogleEmail :: YesodAuth m => AuthPlugin m authGoogleEmail = - AuthPlugin "googleemail" dispatch login + AuthPlugin pid dispatch login where - complete = PluginR "googleemail" ["complete"] + complete = PluginR pid ["complete"] login tm = - [whamlet|_{Msg.LoginGoogle}|] + [whamlet| +$newline never +_{Msg.LoginGoogle} +|] dispatch "GET" ["forward"] = do render <- getUrlRender toMaster <- getRouteToMaster @@ -72,15 +83,16 @@ authGoogleEmail = completeHelper :: YesodAuth m => [(Text, Text)] -> GHandler Auth m () completeHelper gets' = do master <- getYesod - eres <- lift $ try $ OpenId.authenticate gets' (authHttpManager master) + eres <- lift $ try $ OpenId.authenticateClaimed gets' (authHttpManager master) toMaster <- getRouteToMaster let onFailure err = do setMessage $ toHtml $ show (err :: SomeException) redirect $ toMaster LoginR - let onSuccess (OpenId.Identifier ident, _) = do + let onSuccess oir = do + let OpenId.Identifier ident = OpenId.oirOpLocal oir memail <- lookupGetParam "openid.ext1.value.email" case (memail, "https://www.google.com/accounts/o8/id" `T.isPrefixOf` ident) of - (Just email, True) -> setCreds True $ Creds "openid" email [] + (Just email, True) -> setCreds True $ Creds pid email [] (_, False) -> do setMessage "Only Google login is supported" redirect $ toMaster LoginR diff --git a/yesod-auth/Yesod/Auth/HashDB.hs b/yesod-auth/Yesod/Auth/HashDB.hs index cbce0785..1e400aeb 100644 --- a/yesod-auth/Yesod/Auth/HashDB.hs +++ b/yesod-auth/Yesod/Auth/HashDB.hs @@ -76,7 +76,7 @@ import Yesod.Handler import Yesod.Form import Yesod.Auth import Yesod.Widget (toWidget) -import Text.Hamlet (hamlet, shamlet) +import Text.Hamlet (hamlet) import Control.Applicative ((<$>), (<*>)) import Control.Monad (replicateM,liftM) @@ -176,7 +176,7 @@ postLoginR uniq = do (validateUser <$> (uniq =<< mu) <*> mp) if isValid then setCreds True $ Creds "hashdb" (fromMaybe "" mu) [] - else do setMessage [shamlet| Invalid username/password |] + else do setMessage "Invalid username/password" toMaster <- getRouteToMaster redirect $ toMaster LoginR @@ -207,7 +207,7 @@ getAuthIdHashDB authR uniq creds = do -- user exists Just (Entity uid _) -> return $ Just uid Nothing -> do - setMessage [shamlet| User not found |] + setMessage "User not found" redirect $ authR LoginR -- | Prompt for username and password, validate that against a database @@ -221,6 +221,7 @@ authHashDB :: ( YesodAuth m, YesodPersist m , PersistUnique b (GHandler Auth m)) => (Text -> Maybe (Unique user b)) -> AuthPlugin m authHashDB uniq = AuthPlugin "hashdb" dispatch $ \tm -> toWidget [hamlet| +$newline never