Compare commits

..

3521 Commits

Author SHA1 Message Date
Benjamin-McRae-Tracsis
b24028200c
Actually export the new options (#1825)
* actually export the new options

* bump version number, update changelog
2023-11-28 15:04:23 -07:00
Benjamin-McRae-Tracsis
22c5e46d5c
Add an options data structure to allow fine-tuned control of what instances are generated for a route (#1819)
* remove read from the list of derived instances, partially closing #1773, #1203

* bump version

* adjusting a version bound because the next version breaks compilation

* make a RouteOpts type that allows for finer control over what instances are derived for a Route

* some lintings

* adjust versioning and changelog

* actually a more major version bump

* verified that export list is complete

* add @ since
2023-10-23 08:39:21 -06:00
Michael Snoyman
2b29a73a50
Merge pull request #1821 from yitz-zoomin/test-bare-get-params
Add addBareGetParam to yesod-test
2023-09-22 07:29:39 +03:00
Yitz Gale
26de905117 Use haddock @since notation 2023-09-19 17:50:20 +03:00
Yitz Gale
32b609e93f Add PR link to ChangeLog.md 2023-09-19 13:13:06 +00:00
Yitz Gale
8534caa05a Add addBareGetParam to yesod-test 2023-09-19 13:10:12 +00:00
Michael Snoyman
9471c75c9c
Merge pull request #1820 from Vekhir/patch-2
Support Aeson 2.2
2023-09-14 07:54:51 +03:00
Vekhir
c7c0176292
Update ChangeLog.md for 1.6.11.2 2023-09-14 06:04:05 +02:00
Vekhir
9795042cc7
Support Aeson 2.2 2023-09-14 06:00:14 +02:00
Michael Snoyman
11b7089436
Merge pull request #1818 from Vekhir/patch-1
Add attoparsec-aeson to support aeson-2.2
2023-09-14 05:48:31 +03:00
Vekhir
86247aa865 Add attoparsec-aeson to stack.yaml 2023-09-13 15:25:42 +02:00
Vekhir
a742ae5c16 Add attoparsec-aeson to support aeson-2.2
The module `Data.Aeson.Parser` is moved into attoparsec-aeson for aeson >=2.2.
For aeson <2.2, attoparsec-aeson is an empty package, since the module exists within aeson.
2023-09-11 15:31:53 +02:00
Michael Snoyman
0d10965e0f
Merge pull request #1817 from ciukstar/datetime-local-field
Add datetimeLocalField
2023-09-05 08:51:42 +03:00
ciukstar
3206cf4c73 Update the Changelog.md file with a link to PR 2023-08-31 03:55:54 +03:00
ciukstar
773c815b90 Add datetimeLocalField 2023-08-31 03:46:20 +03:00
Michael Snoyman
7a10dd3628
Merge pull request #1812 from jezen/master
Fix SubSub compilation for GHC >= 9.0.1
2023-07-26 06:39:48 -04:00
Jezen Thomas
4a3df62979
Fix SubSub compilation for GHC >= 9.0.1
Resolves #1811.

Related:

- https://stackoverflow.com/questions/73719275/evaluation-of-template-haskell-in-yesod?noredirect=1&lq=1

- https://github.com/yesodweb/yesodweb.com-content/pull/269
2023-07-26 12:21:31 +03:00
Michael Snoyman
b3416ec0a4
Merge pull request #1805 from AriFordsham/ari/subsites
Fix subsite-to-subsite dispatch
2023-07-13 06:23:41 +03:00
Ari Fordsham
48ee9f2134 Merge branch 'ari/subsubtest' into ari/subsites 2023-07-09 16:16:12 +03:00
Ari Fordsham
9ce822b8f7 SubSubTest 2023-07-09 16:05:01 +03:00
Michael Snoyman
393954d802
Merge pull request #1806 from yesodweb/no-newstack
Drop newstack
2023-07-02 08:56:44 +03:00
Michael Snoyman
f3f2ae112f Drop newstack 2023-07-02 08:35:55 +03:00
Ari Fordsham
038452fc17 Empty commit to trigger CI 2023-06-25 18:20:42 +03:00
Ari Fordsham
8be44a8cf4 Add changelog 2023-06-25 18:10:53 +03:00
Ari Fordsham
b0634b0d45 Works with subsite-with-static 2023-06-25 18:05:14 +03:00
Ari Fordsham
97b07380e5 Make changes 2023-06-25 16:30:17 +03:00
Sergiu Starciuc
197ecb409f
Add Romanian translation for yesod-form (#1801) 2023-05-10 11:14:51 +02:00
Michael Snoyman
ccfd77192e
Merge pull request #1797 from mixphix/no-star-is-type
No star is type
2023-03-01 08:22:13 +02:00
Melanie Phoenix
ee343e616e changelogs 2023-02-28 11:23:25 -05:00
Melanie Phoenix
ef58df42c6 bump versions 2023-02-28 11:18:52 -05:00
Melanie Phoenix
f6ea77118a no StarIsType 2023-02-28 11:07:01 -05:00
Michael Snoyman
c4e796248c
Merge pull request #1796 from TeofilC/yesod-core-transformers-0.6
Adapt to removal of ListT from transformers-0.6.0
2023-02-10 14:57:45 +02:00
Teo Camarasu
c35bdb1cd4 Adapt to removal of ListT from transformers-0.6.0
Co-authored-by: Ryan Scott <ryan.gl.scott@gmail.com>
2023-02-10 12:15:06 +00:00
Michael Snoyman
0fa3dbcab6
Merge pull request #1795 from TeofilC/monad-aform
yesod-form: Add Monad AForm instance for transformers >=0.6
2023-02-09 08:23:56 +02:00
Teo Camarasu
a6e420b42f yesod-form: bump version and add changelog message for #1795 2023-02-07 10:52:29 +00:00
Teo Camarasu
06fd5df137 yesod-form: Add Monad AForm instance for transformers >=0.6
This is required in order to have a MonadTrans instance
2023-02-07 10:51:51 +00:00
Michael Snoyman
66bed05d33
Merge pull request #1790 from ricky0123/fix-websocket-chat
Fix websocket examples
2022-11-20 09:36:14 +02:00
ricky
d8560042e7 fix websocket chat examples
.
2022-11-17 08:29:58 -06:00
Michael Snoyman
5880bd3119
Merge pull request #1785 from felixonmars/patch-1
Allow vector 0.13
2022-10-11 06:42:40 +03:00
Felix Yan
73db75b8cf
Allow vector 0.13
Builds fine and all tests pass.
2022-10-10 23:53:34 +03:00
Michael Snoyman
e3381d590f
Merge pull request #1783 from cblp/fix-radio
Fix according to Bootstrap 3 docs
2022-10-06 06:36:25 +03:00
Yuriy Syrovetskiy
cb874e3bbb fixup! Update Changelog 2022-10-05 22:53:21 +02:00
Yuriy Syrovetskiy
fbefa3ad37 Update Changelog 2022-10-05 20:32:49 +02:00
Yuriy Syrovetskiy
b841e8cf0b Fix according to Bootstrap 3 docs 2022-10-05 20:21:03 +02:00
Michael Snoyman
5ac0138697
Minor version bump on yesod-test 2022-09-22 09:48:42 +03:00
Michael Snoyman
f729d9bbb6
Merge pull request #1781 from eahlberg/add-by-selector-label-contain
Add bySelectorLabelContain to support testing inputs with the same label
2022-09-22 09:43:20 +03:00
Michael Snoyman
faa4105250
Merge branch 'add-by-selector-label-contain' of github.com:eahlberg/yesod into eahlberg-add-by-selector-label-contain 2022-09-22 06:49:33 +03:00
Michael Snoyman
486b871229
Merge pull request #1782 from yesodweb/support-stack-29
Remove unneeded invocation of Stack in CI
2022-09-22 06:48:14 +03:00
Michael Snoyman
bb74ef5f08
Remove unneeded invocation of Stack in CI 2022-09-22 06:39:22 +03:00
Eric Ahlberg
bca75573b8 Update changelog 2022-09-21 13:50:50 +02:00
Eric Ahlberg
6c2a20699a Refactor 2022-09-21 13:50:50 +02:00
Eric Ahlberg
bd86b4db7a Add bySelectorLabelContain 2022-09-21 13:50:50 +02:00
Eric Ahlberg
b28ee833d1 Add tests 2022-09-21 10:34:02 +02:00
Michael Snoyman
42050fb5c7
Remove bounds on fsnotify 2022-09-18 11:08:53 +03:00
Michael Snoyman
65adf9ba72
Merge pull request #1775 from SupercedeTech/add-with-option-more-flexible-radio-inputs
Add withRadioField a more flexible radio option renderer
2022-09-18 08:05:47 +03:00
Matt Parsons
26a195b8c7
Support GHC 9.4 (#1769)
* Support GHC 9.4

* tidy it on up

* ok tests pass again

* weird

* woo

* Changelog, cabal files

* fix for older cabal

* Drop MacOS from older resolvers

https://github.com/bravit/hid-examples/issues/7#issuecomment-781308838

* oops
2022-09-07 11:49:14 -06:00
Michael Snoyman
02a1a56dd7
Merge pull request #1778 from degustaf/master
Remove deprecated function from testing example
2022-08-26 05:59:57 +03:00
Derek Gustafson
7721b65f58
Remove deprecated function from testing example
byLabel has been deprecated, but is still used as an example.
2022-08-25 17:07:07 -04:00
Jappie Klooster
25f83fb73d Add withRadioField a more flexible radio option renderer
This re-expresses radioField into the new more flexible
function.
Which gives an adhoc example on how to use it as well.

This function passes the radio input to a callback function
to let said function decide how it should be rendered.
These changes allow you to make a radio table for example,
for selecting some row.

bump version number, add @since

add note on radioField

Update changelog
2022-08-17 10:28:42 +02:00
Michael Snoyman
337a9928f2
Merge pull request #1772 from SupercedeTech/make-exception-catching-configurable
Make catching exceptions configurable.
2022-07-20 18:04:39 +03:00
Jappie Klooster
69df01668a
Update yesod-core/src/Yesod/Core/Class/Yesod.hs
Co-authored-by: patrick brisbin <pbrisbin@gmail.com>
2022-07-20 15:23:29 +02:00
Jappie Klooster
dd2ba40873 be more explicit in changelog 2022-07-20 14:30:34 +02:00
Jappie Klooster
13db3db118 Add backwards compatibility for old unliftio 2022-07-20 14:14:14 +02:00
Jappie Klooster
dc4ee0f92c remove unsafeAsyncCatch 2022-07-20 14:07:30 +02:00
Jappie Klooster
01ccea46cc update docs, better names
rename catchBehvaior -> catchHandlerExceptions
rename shouldCatch -> catchHanlderExceptions
2022-07-20 12:43:09 +02:00
Jappie Klooster
5ac65db1bf Delete catchbevior and allow a user to provide a catch.
By default the one from unliftIO is used.
2022-07-20 12:32:48 +02:00
Jappie Klooster
d04c22e3d6 Rewrite default behavior into rethrow async exceptions 2022-07-20 11:55:44 +02:00
Jappie Klooster
964fa0db55 Fix dealing with timeout and add appropriate test
add comments for this nonobvious test
2022-07-14 21:55:00 +02:00
Jappie Klooster
27042c93ce change catchbehavior to get app be in io, make it abstract type 2022-07-07 12:06:56 +02:00
Jappie Klooster
710adc7329 don't patch but minor version bump isntead 2022-07-07 11:15:40 +02:00
Jappie Klooster
9648ccf79f add customapp to core.cabal 2022-07-06 22:43:19 +02:00
Jappie Klooster
827d9269b0 update changelog 2022-07-06 22:41:52 +02:00
Jappie Klooster
1487b121be Make catching exceptions configurable.
Fixes https://github.com/yesodweb/yesod/issues/1771

This is done by adding a function to Yesod
typeclass which can match on any exception
and tell the framework if it should rethrow
or not.

I used an overridable function because it seemed
more flexible then a whitelist.
A user can now for example choose to throw
everything, or catch everything as easily.

add docs

bump
2022-07-06 22:40:24 +02:00
Michael Snoyman
99c1fd49a3
Merge branch 'patch-1' of https://github.com/friedbrice/yesod 2022-05-11 14:44:27 +03:00
Michael Snoyman
50c439da56
Merge pull request #1768 from SupercedeTech/quote-in-test
Fix quote ' not matching in htmlContain* functions
2022-05-11 14:05:57 +03:00
Daniel P. Brice
b8de71c5ab
Update ChangeLog.md 2022-05-10 13:31:34 -07:00
Jappie Klooster
b88b1f430f Add link to PR 2022-05-10 16:27:28 -04:00
Daniel P. Brice
d5a194a7dd
Update yesod-test.cabal 2022-05-10 13:25:45 -07:00
Daniel P. Brice
8028f1defd
assertEq delegates to HUnit.assertEqual
HUnit.assertEqual gives a formatted diff, making it easier to see the differences between the two values at a glance.
2022-05-10 13:24:21 -07:00
Jappie Klooster
5f3e237c29 Bump version and add changes 2022-05-10 16:24:07 -04:00
Jappie Klooster
28fc2269b0 Fix quote ' not matching in any body
This sometimes occured in our code base when generating
names with the fakedata package, someone named o'conner
randomly fails a particular test.

Also add tests for the other matching function and fixed them.

Furthermore, I snuck in logging of the matches as well.
2022-05-10 16:20:35 -04:00
Michael Snoyman
0a273d5aae
Merge pull request #1766 from ivanbakel/fix-meta-typo
Fix typo in how description meta tags are laid out
2022-04-25 05:15:55 +03:00
Isaac van Bakel
032b906a73 Bump version to 1.6.23.1, update ChangeLog 2022-04-21 14:35:22 +01:00
Isaac van Bakel
1295f1c643 Fix typo in how description meta tags are laid out 2022-04-21 14:32:49 +01:00
Michael Snoyman
f338e519f2
Merge pull request #1765 from ivanbakel/idempotent-description
Add API for idempotent page description editing
2022-04-21 05:35:40 +03:00
Isaac van Bakel
04683ca58b Bump yesod-core version, update ChangeLog 2022-04-20 13:01:26 +01:00
Isaac van Bakel
b9fbdb3950 Add idempotent versions of setDescription API
`setDescription` and `setDescriptionI` present a similar API to
`setTitle` and `setTitleI`, but unlike those functions the description
functions are not idempotent - so calling them multiple times inserts
multiple `<meta/>` tags in HTML `<head/>`.

This adds explicitly idempotent versions of those functions which are
handled in a similar way to the title, so that calling them multiple
times has the effect of taking the final value specified.

Because the non-idempotent behaviour of setDescription is not obvious,
this also adds warnings for that behaviour to make it clear what the
effect of multiple calls will be. Unfortunately, setDescriptionIdemp
can't be made a drop-in replacement because developers may have defined
their own layouts which need to take pageDescription into account.
2022-04-20 12:54:23 +01:00
Isaac van Bakel
9c0b00190a Add test of setDescription idempotency
Like setTitle, this function should really be idempotent so developers
don't add multiple conflicting meta descriptions to the page. Unlike
setTitle, the function currently fails its idempotency test.
2022-04-20 12:01:34 +01:00
Michael Snoyman
4f962c9073
Merge pull request #1764 from parsonsmatt/matt/yesod-test-expose-sio
Expose SIO type
2022-04-18 09:09:09 +03:00
parsonsmatt
ef4178f4c8 Add runSIO, changelog, version bump 2022-04-14 08:50:41 -06:00
Michael Snoyman
b0e461c669
Merge pull request #1760 from parsonsmatt/matt/support-persistent-2.14
Support persistent-2.14
2022-04-14 05:53:19 +03:00
parsonsmatt
60d0748834 Expose SIO type 2022-04-13 16:27:01 -06:00
parsonsmatt
7bec27aa3c changelog link 2022-04-13 10:14:55 -06:00
parsonsmatt
d54c17ef27 changelog, version 2022-04-13 10:14:17 -06:00
parsonsmatt
5f71a49c0f Support persistent-2.14 2022-04-13 10:10:35 -06:00
Michael Snoyman
d831b9f108
Merge pull request #1756 from SupercedeTech/remove-sometimes-failing-test
Remove sometimes failing superfluous  test
2022-03-25 16:57:37 +03:00
Jappie Klooster
d54dbf5fd6 bump version number 2022-03-25 07:52:32 -04:00
Jappie Klooster
4daf1d2107 update changelog 2022-03-25 07:51:57 -04:00
Jappie Klooster
73f20b6285 Remove sometimes failing test
This test sometimes fails on nix builds.
I'm not sure why, but it should be superflous with
"thread killed = 500" test anyway.

They test both for async exceptions.
Just a different one.
2022-03-25 07:30:33 -04:00
Michael Snoyman
3d65a3bf16
Remove NumericUnderscores for older GHCs 2022-03-24 10:29:28 +02:00
Michael Snoyman
60111462de
Merge branch 'ghc-9.2-compat' of https://github.com/TeofilC/yesod 2022-03-24 05:25:39 +02:00
Michael Snoyman
53936c43a3
Merge branch 'fix-catch-async-exception-on-requst-threads' of https://github.com/SupercedeTech/yesod 2022-03-24 05:24:18 +02:00
Michael Snoyman
c74fc994ae
Merge pull request #1752 from lykahb/lykahb/content-void
Create instances for ToContent Void, ToTypedContent Void
2022-03-24 04:41:55 +02:00
Teo Camarasu
c6fab6f410 update yesod-bin changelog 2022-03-23 08:43:20 +00:00
Teo Camarasu
b117e5a4cd update yesod-core changelog 2022-03-23 08:43:20 +00:00
Teo Camarasu
87427c1290 bump yesod-bin 2022-03-23 08:43:20 +00:00
Teo Camarasu
3c2b50e08c bump yesod-core 2022-03-23 08:43:20 +00:00
Teo Camarasu
24d3ea9e53 Fix building yesod-bin with Cabal-3.6 2022-03-23 08:43:20 +00:00
Ryan Scott
9039df924d Allow building with template-haskell-2.18.0 2022-03-22 20:29:50 +00:00
Jappie Klooster
764fd94bc6 add changelog entry 2022-03-22 15:51:10 -04:00
Jappie Klooster
f48485e181 Bump version number 2022-03-22 15:46:47 -04:00
Jappie Klooster
5b96d94915 Fix it for async exceptions in the sessions as well 2022-03-22 15:45:20 -04:00
Jappie Klooster
e284a68a9f Remove the use of masks
I don't think these are neccisary.
If an exception get's delivered at these points,
we couldn't do anything about it anyway
2022-03-22 15:18:38 -04:00
Jappie Klooster
4c1719cb6e Disable the allocation limit within the test instead
I don't think we should add that to the function
seems odly specific
2022-03-22 15:15:49 -04:00
Jappie Klooster
eb7405765d Add async exception handling for basic runner. 2022-03-22 14:47:27 -04:00
Jappie Klooster
42abd9b666 add explicit exports 2022-03-22 14:20:46 -04:00
Jappie Klooster
08d37a1857 Add test showing the failures 2022-03-22 14:02:25 -04:00
Boris Lykah
7d44c38c91 Update changelog 2022-03-22 11:46:09 -06:00
Boris Lykah
8fb0cbb31a Bump version for yesod-core 2022-03-22 11:44:16 -06:00
Boris Lykah
d3808c3a97 Create instances for ToContent Void, ToTypedContent Void 2022-03-21 12:17:24 -06:00
Sergiu Starciuc
48d05fd6ab
Color field (#1748)
This PR adds a new colorField function to create an html color field (<input type="color">) as described at https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input/color
2022-03-02 17:49:09 +01:00
Michael Snoyman
5bd872be02
Merge pull request #1746 from yesodweb/enable-new-nightly
Enable new nightly
2022-02-11 07:11:30 +02:00
Michael Snoyman
b4b32cb341
Change yesod-auth version 2022-02-11 06:28:29 +02:00
Michael Snoyman
7af2cd04b6
Allow newer GHC 2022-02-11 06:01:35 +02:00
Michael Snoyman
6e7e7299ba
Update yesod for aeson 2 2022-02-11 06:00:02 +02:00
Michael Snoyman
3583fe2a03
Update yesod-bin for aeson 2 2022-02-11 05:55:17 +02:00
Michael Snoyman
385d17dd94
Support aeson 2 2022-02-11 05:28:01 +02:00
Michael Snoyman
2c498c14b2
Relax an upper bound 2022-02-11 05:10:14 +02:00
Michael Snoyman
863cdfa458
Enable a new nightly 2022-02-11 05:10:05 +02:00
Michael Snoyman
b147b272e2
Merge pull request #1745 from stevehartdata/docs-fix
Add missing documentation to 'warp'
2022-01-20 09:41:16 +02:00
Steve Hart
ee41ae000e Update changelog 2022-01-19 10:26:41 -05:00
Steve Hart
6b164c6007 Add missing documentation to 'warp' 2022-01-19 10:18:12 -05:00
Sibi Prabakaran
b54210cef2
Merge pull request #1742 from smichel17/patch-1
Fix yesod-auth README link & add yesod-auth-oauth2
2021-12-07 11:51:37 +05:30
smichel17
072659b770
Fix yesod-auth README link & add yesod-auth-oauth2
Fixes #1738
2021-12-06 18:13:09 +00:00
Michael Snoyman
f30f96ee41
Merge pull request #1741 from schoettl/yesod-auth-fixes
Fix German translations of AuthMessage
2021-11-16 10:31:59 +02:00
Jakob Schöttl
3f0bf09712 Fix German translations of AuthMessage 2021-11-15 10:25:30 +01:00
Michael Snoyman
e5f9376700
Merge pull request #1740 from stevemao/cleanup
update the examples to show how to cleanup resources once user discon…
2021-10-03 06:26:52 +03:00
Steve Mao
e6d2769408
update the examples to show how to cleanup resources once user disconnects 2021-10-02 17:22:58 +10:00
Michael Snoyman
9a59f0648c
Merge pull request #1739 from stevemao/multiple
add multiple channels example
2021-09-30 05:27:30 +03:00
Steve Mao
4ae578a1a1
add multiple channels example 2021-09-29 23:12:16 +10:00
Michael Snoyman
dfc270b0b2
Merge pull request #1737 from geraldus/ghc-9.0.1
Make yesod-auth buildable with GHC 9.0.1
2021-09-10 14:56:36 +03:00
Arthur Sakhievich Fayzrakhmanov
1a6ba6d099 Update Changelog 2021-09-10 13:35:15 +05:00
Arthur Sakhievich Fayzrakhmanov
67f846d324 Version bump 2021-09-10 11:37:13 +05:00
Arthur Sakhievich Fayzrakhmanov
814584d7d9 Apply stylish-haskell 2021-09-10 11:30:05 +05:00
Arthur Sakhievich Fayzrakhmanov
8f83462134 Fix GHC 9.0.1 build 2021-09-10 11:29:24 +05:00
Michael Snoyman
58311a3d93
Simplify matrix, disable nightly 2021-07-22 18:06:37 +03:00
Michael Snoyman
0d0fa77009
Merge pull request #1734 from googleson78/default-gen
Export defaultGen
2021-07-22 16:38:21 +03:00
Georgi Lyubenov
1f52a39aa2 Export defaultGen 2021-07-22 14:54:58 +03:00
Michael Snoyman
f3dd8cf204
Merge pull request #1731 from felixonmars/patch-1
Correct a typo in yesod-form's description
2021-07-08 12:56:04 +03:00
Felix Yan
e972a63a35
Correct a typo in yesod-form's description 2021-07-08 17:51:58 +08:00
Michael Snoyman
bffa6de813
Merge pull request #1730 from felixonmars/ghc9
Fix compatibility with template-haskell 2.17 for yesod
2021-06-30 18:45:03 +03:00
Felix Yan
44b1ea252c
Bump version and update Changelog 2021-06-30 18:11:33 +08:00
Felix Yan
189487914d
Fix compatibility with template-haskell 2.17 for yesod 2021-06-30 18:07:24 +08:00
Michael Snoyman
9edbc05827
Version bump for #1729 2021-06-27 12:19:01 +03:00
Felix Yan
a1e18c5b68
Fix compatibility with template-haskell 2.17 2021-06-25 10:54:55 +08:00
Michael Snoyman
81236a2832
Merge pull request #1728 from NorfairKing/breadcrumb-loop-detector
yesod-core: detect loops in breadcrumbs
2021-05-21 18:09:59 +03:00
Tom Sydney Kerckhove
2d0dab20a6 minor version bump and changelog entry 2021-05-21 17:09:10 +02:00
Tom Sydney Kerckhove
0db056534c breadcrumbs: guard refactor 2021-05-21 08:41:42 +02:00
Tom Sydney Kerckhove
884d937792 use ++ instead of <> to fix the build 2021-05-20 16:00:55 +02:00
Tom Sydney Kerckhove
59ef730317 yesod-core: refactor the loop detector to not use Just wrapping 2021-05-20 14:28:09 +02:00
Tom Sydney Kerckhove
96a940b60c yesod-core: test for looping breadcrumbs 2021-05-20 14:25:17 +02:00
Tom Sydney Kerckhove
d981c87c39 yesod-core: detect loops in breadcrumbs 2021-05-17 20:40:09 +02:00
Michael Snoyman
8a799d2768
Merge pull request #1726 from Smart-Hypercube-fork/master
Use secure entropy source to generate CSRF tokens
2021-05-11 11:05:37 +03:00
Hypercube
1cb0fc579c Change version number 2021-05-11 14:03:51 +08:00
Hypercube
5deabe53e8 Update changelog 2021-05-11 11:35:59 +08:00
Hypercube
b6215582d8 Use secure entropy source to generate CSRF tokens 2021-05-11 11:32:07 +08:00
Michael Snoyman
5d8566ad5c
Merge pull request #1724 from yesodweb/parsonsmatt-matt/support-persistent-2.13
Parsonsmatt matt/support persistent 2.13
2021-05-07 14:18:13 +03:00
Michael Snoyman
3ea97d21b8
Fix extra-deps 2021-05-07 13:08:39 +03:00
parsonsmatt
b3188d962e add to test 2021-05-06 07:35:37 -06:00
parsonsmatt
3d3fe3f5b6 fix version in changelog 2021-05-05 16:31:30 -06:00
parsonsmatt
d42354ae98 use hackage release 2021-05-05 15:17:46 -06:00
parsonsmatt
69735fc9c6 Add link to changelog, version bump 2021-05-05 12:33:24 -06:00
parsonsmatt
3224e8e6f1 Support persistent-2.13 2021-05-05 12:16:05 -06:00
Michael Snoyman
2f8036c61f
Version bump for bounds 2021-04-15 09:29:10 +03:00
Michael Snoyman
e064306ef3
Version bumps for bounds 2021-04-15 09:18:55 +03:00
Michael Snoyman
cf3d9db87d
Merge pull request #1722 from schoettl/selectFieldGrouped
Forms: selectFieldGrouped
2021-04-15 08:58:21 +03:00
Jakob Schöttl
73a85310c6 Relax version constraints for yesod-form 2021-04-14 13:46:53 +02:00
Jakob Schöttl
08b5150ac0 Fix typo 2021-04-14 13:46:03 +02:00
Jakob Schöttl
7ffff25326 Add some type annotations 2021-04-14 09:40:34 +02:00
Jakob Schöttl
e3a95bd92c Simplify code, fix linter warnings 2021-04-14 09:40:21 +02:00
Jakob Schöttl
848da5ff12 Bump version and fix old version comments 2021-04-14 09:39:13 +02:00
Jakob Schöttl
c6f44d47b9 Also export this helper 2021-04-13 22:22:26 +02:00
Jakob Schöttl
2998849e99 Fix comments 2021-04-13 22:16:29 +02:00
Jakob Schöttl
829b5af62c Fix implementation of instance Functor OptionList 2021-04-13 21:58:40 +02:00
Jakob Schöttl
993de7fa86 Add selectFieldGrouped 2021-04-13 09:57:50 +02:00
Jakob Schöttl
daf977fdb1 Use standard function forM_ 2021-04-10 11:42:04 +02:00
Michael Snoyman
21bfad3570
Merge pull request #1721 from yesodweb/pb/reorder-languages
Stop moving session language ahead of reqLangs
2021-04-09 06:04:58 +03:00
patrick brisbin
0c2a4ebc81
Bump minor, not patch 2021-04-08 10:07:18 -04:00
patrick brisbin
7875930c43
Version bump 2021-04-08 09:53:58 -04:00
patrick brisbin
dc2d5d9cd0
Stop moving session language ahead of reqLangs
Yesod.Core.Handler.languages checks first for a language set in the
user's session, prepending that value to YesodRequest{reqLangs}, so it
is respected above all else if present.

For context, reqLangs itself also includes the session, but just later
in line:

    langs' = catMaybes [ lookup langKey gets -- Query _LANG
                       , lookup langKey cookies     -- Cookie _LANG
                       , lookupText langKey session -- Session _LANG
                       ] ++ langs                    -- Accept-Language(s)

In #1720, it was raised that allowing the session (something implicitly
present for any request) to override a query parameter (something
explicitly given on that request) is surprising.

We decided (without knowing what order reqLangs was doing) that query,
cookie, session, accept was best and languages should be changed to do
that. Conveniently, this just makes languages equivalent to reqLangs, so
that is what this patch does.
2021-04-08 09:34:38 -04:00
Michael Snoyman
c59993ff28
Change cabal-version syntax 2021-04-03 22:37:00 +03:00
Michael Snoyman
b97d8d60b3
Fix changelog 2021-03-30 22:13:53 +03:00
Michael Snoyman
42eea68fb6
Support persistent 2.12 2021-03-30 21:48:10 +03:00
Michael Snoyman
f2657e7ee0
Merge pull request #1717 from Burtannia/devel-ssl
Devel SSL
2021-02-10 17:46:18 +02:00
James Burton
a068bbdb8c Simplified implementation of cert/key parser option 2021-02-10 13:54:22 +00:00
James Burton
4699479bbb Removed unused imports 2021-02-09 17:52:55 +00:00
James Burton
8d0866f08b Updated changelog 2021-02-09 17:41:49 +00:00
James Burton
818e8e3781 Parser now requires that both cert/key be provided or neither 2021-02-09 17:38:50 +00:00
James Burton
8a4fb790cf Revert "Fixed indentation"
This reverts commit 52cf633993.
2021-02-09 12:07:56 +00:00
James Burton
52cf633993 Fixed indentation 2021-02-08 22:42:26 +00:00
James Burton
045d05f7d6 Bumped version 2021-02-08 18:19:40 +00:00
James Burton
9f72790df9 Added options to pass SSL certificate and key to yesod devel 2021-02-08 17:59:49 +00:00
James Burton
1c471acfd5
Fixed bug when duplicating option tags (#1716) 2021-01-08 19:03:46 +00:00
Michael Snoyman
60350c6532
Merge pull request #1715 from yesodweb/multi-form-cabal-version
Bumped cabal version to >= 1.10
2020-12-22 05:05:25 +02:00
Burtannia
bb008df3bd Bumped cabal version to >= 1.10 2020-12-22 02:17:57 +00:00
Michael Snoyman
19bd528ac7
Version bump 2020-12-16 05:45:46 +02:00
Michael Snoyman
9cb8d2d369
Merge pull request #1705 from masaeedu/addmonadstate
Add MonadState instance for SIO
2020-12-16 05:32:31 +02:00
Asad Saeeduddin
63afa32fa0
Add MPTC extension 2020-12-15 21:34:16 -05:00
Asad Saeeduddin
7695803af5
Fix ambiguous get/put issue 2020-12-15 20:48:20 -05:00
Asad Saeeduddin
210c992601
Add MTL dependency 2020-12-15 19:59:28 -05:00
Asad Saeeduddin
a1e708107b
Add MonadState instance for SIO 2020-12-15 19:59:28 -05:00
Michael Snoyman
3015133b0e
Merge pull request #1713 from eahlberg/fix-cookie-test-example
Fix import in cookie example
2020-12-14 16:01:49 +02:00
Eric Ahlberg
383149c0af Update changelog 2020-12-14 14:30:08 +01:00
Eric Ahlberg
44895915ea Fix import in cookie example 2020-12-14 10:39:50 +01:00
Michael Snoyman
f52291d2c9
Forgot to update cabal file 2020-12-14 11:30:14 +02:00
Michael Snoyman
e4cd44a4c7
Fix test suite for latest wai-extra (fixes #1711) 2020-12-14 11:29:11 +02:00
Michael Snoyman
c6c2cd2252
Merge pull request #1710 from yesodweb/pb/has-callstack
Fix up missing HasCallStack
2020-12-02 08:37:52 +02:00
patrick brisbin
761dbc7753
Update yesod-test ChangeLog 2020-12-01 12:00:45 -05:00
patrick brisbin
cb06004044
yesod-test version bump 2020-12-01 11:57:46 -05:00
patrick brisbin
07d76095a7
Add missing HasCallStack
As far as I could tell, all of these functions call failure, or call
things that call failure.
2020-12-01 11:56:37 -05:00
patrick brisbin
24acd4e3b7
Add missing HasCallStack
Even though functions that use this one all have HasCallStack, the fact
that this function itself doesn't means that all errors are reported as
from this line anyway:

    Failures:

      ./Yesod/Test.hs:1571:28:
      1) ...

This should correct that.
2020-12-01 11:49:29 -05:00
Michael Snoyman
95dc598d4b
Merge pull request #1707 from yesodweb/multi-form-delete-button
Multi form delete button
2020-11-20 08:31:48 +02:00
Burtannia
c60430e69e Wrapper error class is now removed on copy 2020-11-20 02:51:34 +00:00
Burtannia
f2d3f3d8da Replaced JS string concatenation with rawJS 2020-11-20 02:47:19 +00:00
Michael Snoyman
3b306b39ba
Merge pull request #1709 from eahlberg/fix-open-graph-functions
Fix functions generating Open Graph metadata
2020-11-19 06:43:31 +02:00
Eric Ahlberg
fd049ec3b0 Update changelog 2020-11-18 19:37:39 +01:00
Eric Ahlberg
13039e567f Bump version 2020-11-18 19:28:36 +01:00
Eric Ahlberg
62479374cf Use property attribute instead of name 2020-11-18 19:22:17 +01:00
Burtannia
91c1a7fac7 Fixed name clashes when using more than one instance of a multi-field 2020-11-18 07:14:40 +00:00
Burtannia
2eec150289 Moved JS constant inside function 2020-11-18 05:16:12 +00:00
Burtannia
0f51f91334 Removed dependency on Semigroup 2020-11-17 22:12:59 +00:00
Burtannia
5c56320c39 Added PR to changelog 2020-11-17 21:20:43 +00:00
Burtannia
da3723d2c7 Bumped version number to 1.7.0 2020-11-17 21:17:34 +00:00
Burtannia
ee5b2e129d Updated changelog and readme 2020-11-17 21:02:14 +00:00
Burtannia
e619b8d6ff Updated since annotations in docs 2020-11-17 21:00:42 +00:00
James Burton
fcda22ec5c Clearing fields now triggers the change event 2020-11-16 00:54:33 +00:00
James Burton
1c742a83d3 Fixed tooltip styling in Bootstrap 4 2020-11-15 23:00:24 +00:00
James Burton
973461e70f Minor refactoring 2020-11-15 22:19:37 +00:00
James Burton
008b4af741 Reworked the field duplication code to be more robust and allow for fields with multiple elements like radio fields 2020-11-15 21:12:23 +00:00
James Burton
e209810b8c Removed strictness from MultiSettings fields that are only used in applicative forms 2020-11-15 17:45:47 +00:00
James Burton
0d0112b73b Updated documentation 2020-11-15 17:44:56 +00:00
Burtannia
7b327b3dcd Made MultiSettings fields strict 2020-11-14 00:51:34 +00:00
Burtannia
44f065c615 Updated docs 2020-11-14 00:37:18 +00:00
Burtannia
df0c61e364 Tooltip now shows in applicative multi-fields 2020-11-13 23:03:14 +00:00
Burtannia
2c1112c52c Fixed bootstrap styling 2020-11-13 22:48:56 +00:00
Burtannia
a3319f766a Error messages are now deleted with fields and are highlighted correctly 2020-11-13 22:25:44 +00:00
Burtannia
39ed1f6453 Added support for customising button contents 2020-11-13 20:18:50 +00:00
Burtannia
e18d0a771b Added delete button to Yesod.Form.Multi 2020-11-13 18:46:42 +00:00
Michael Snoyman
cdd6e28d5f
New cabal-version for Hackage 2020-11-08 12:52:23 +02:00
Michael Snoyman
3cfe814cba
cabal-version bump for Hackage 2020-11-08 12:49:42 +02:00
Michael Snoyman
0325a24826
Merge pull request #1703 from jeffhappily/update-docs-for-handlert
Replace HandlerT with HandlerFor in the documentation
2020-11-08 12:49:26 +02:00
Jeff Happily
29bb2053fd
Bump version and update changelog 2020-11-08 18:32:33 +08:00
Jeff Happily
de375e26de
Replace HandlerT with HandlerFor in the documentation 2020-11-08 10:55:01 +08:00
Michael Snoyman
6a40abf033
More Hackage appeasement 2020-11-06 09:15:40 +02:00
Michael Snoyman
3c65d49376
Hackage wants newer cabal-version 2020-11-06 09:07:06 +02:00
Michael Snoyman
e02f1dc780
Merge pull request #1702 from yesodweb/actions
Move to Github Actions
2020-11-06 09:11:15 +02:00
Michael Snoyman
2a280a0a4e
Move to actions, test persistent 2.11 2020-11-06 07:15:17 +02:00
Michael Snoyman
504b3c74cf
Merge branch 'master' of https://github.com/friedbrice/yesod 2020-11-06 06:24:17 +02:00
Daniel Brice
3a44d47acf link to PR in changelog 2020-11-05 18:06:52 -08:00
Michael Snoyman
a770fd2b63
Appease Hackage 2020-11-05 10:50:38 +02:00
Michael Snoyman
710d40d253
Merge pull request #1700 from Disco-Dave/yesod-websockets/remove-use-of-forkPingThread
Remove use of deprecated forkPingThread
2020-11-05 08:26:44 +02:00
David Burkett
c00d1e1aa8 Use forkPingThread if websockets is less than 0.12.6.0 2020-11-04 21:46:00 -05:00
David Burkett
da09fdc69a Updated the Changelog.md for yesod-websockets to include comment and link for PR 1700 2020-11-04 20:43:41 -05:00
David Burkett
ead5d3388f Remove the use of forkPingThread in Yesod.WebSockets and replaced it with withPingThread 2020-11-04 20:34:37 -05:00
Daniel Brice
46f8879a0a add language extensions (how did this compile before?) 2020-11-04 14:18:23 -08:00
Daniel Brice
0a338177fe bump persistent-template 2020-11-04 14:15:21 -08:00
Daniel Brice
41bcace5fc support persistent 2.11 2020-11-04 14:01:57 -08:00
Michael Snoyman
bcae4c99b1
Merge pull request #1698 from yesodweb/documentErrorResponse
Document ErrorResponse
2020-10-07 09:14:08 +03:00
Maximilian Tagher
24061e18bd .. 2020-10-06 10:41:53 -04:00
Maximilian Tagher
067914aac0 Document ErrorResponse 2020-10-06 10:41:03 -04:00
Michael Snoyman
de45bc0d27
Appease Hackage 2020-09-22 17:37:55 +03:00
Michael Snoyman
f6ac2b1d3a
Fix filepath in cabal file 2020-09-22 17:32:37 +03:00
Michael Snoyman
1b79db382d
Merge pull request #1697 from d86leader/master
Generate appropriate Handler and Widget synonyms for polymorphic sites
2020-09-22 17:30:26 +03:00
d86leader
22c59207c1 Update changelog and version 2020-09-22 15:59:18 +07:00
d86leader
e3528ad85d Add test for regression of mkYesod 2020-09-22 15:41:45 +07:00
d86leader
4c4584fde8 Fix incorrect code generation for polymorphic datatypes 2020-09-22 15:33:43 +07:00
d86leader
62b418a801 Add tests for mkYesod with polymorphic datatypes 2020-09-22 15:33:34 +07:00
Michael Snoyman
84ca72e1d0
Merge pull request #1695 from yesodweb/removeGHandlerFromDocs
Remove GHandler from handlerToIO docs
2020-09-21 05:29:19 +03:00
Maximilian Tagher
6e5fa23dc2 .. 2020-09-20 16:57:01 -04:00
Maximilian Tagher
f0db028ec0 .. 2020-09-20 16:54:44 -04:00
Maximilian Tagher
30f189a48c Remove GHandler from handlerToIO docs 2020-09-20 16:50:16 -04:00
Michael Snoyman
eb5f7a95cd
Merge pull request #1691 from dten/absolute-templates-path
Absolute templates path
2020-08-09 17:48:45 +03:00
David Hewson
8585893b1d bump yesod version 2020-08-09 13:45:16 +01:00
David Hewson
8069d42d90 use globFilePackage in widgetFileReload and widgetFileNoReload
this will mean that files can be build from another directory whilst still finding the package's templates
2020-08-07 13:23:17 +01:00
David Hewson
b73a95c8b6 globFilePackage which provides absolute globFile paths within package 2020-08-07 13:23:17 +01:00
Michael Snoyman
8845483c20
Merge pull request #1689 from felixonmars/skip-semigroups-for-ghc8
Drop dependency on semigroups
2020-08-02 13:28:11 +03:00
Felix Yan
672b82d510
Drop dependency on semigroups
They are not needed on GHC we support.
2020-08-02 17:30:19 +08:00
Michael Snoyman
b2c154b358
Merge pull request #1688 from yesodweb/fixAddHandler
Fix add-handler for new routes file path
2020-08-02 12:19:06 +03:00
Maximilian Tagher
9f1387968f .. 2020-07-30 14:30:08 -04:00
Maximilian Tagher
7cfda1d650 Fix add-handler for new routes file path
https://github.com/yesodweb/yesod/pull/1686 recommended `.yesodroutes` as the file extension for the routes file, and https://github.com/yesodweb/yesod-scaffold/pull/203 added that to the scaffolding. But yesod-bin assumes the file is just named `routes`.

This PR will check if the old path exists and use that, and if not use the new path.

I tested this on the yesod-scaffold repo with both the old and new filename
2020-07-30 14:26:22 -04:00
Maximilian Tagher
77e6c3e7c2
Recommend .yesodroutes file extension (#1686)
* Recommend .yesodroutes file extension

Closes https://github.com/yesodweb/yesod/issues/1685

* ..
2020-07-26 17:08:39 +03:00
Michael Snoyman
7964967ba8
One more sort for #1684 2020-07-04 19:09:50 +03:00
Michael Snoyman
084a3cefb5
Sort directory contents #1684 2020-07-02 19:20:03 +03:00
Michael Snoyman
f5a6ccb363
Appease Hackage 2020-06-29 05:36:16 +03:00
Michael Snoyman
4bfca1bd86
Changelog entry for #1683 2020-06-29 04:47:51 +03:00
Michael Snoyman
c5a56f74fd
Merge pull request #1683 from ncaq/fix-yesod-bin-terminal-kill
fixed: yesod-bin: when C-c, kill yesod-bin and children process
2020-06-30 08:41:51 +03:00
ncaq
b3ed4613e7 fixed: yesod-bin: when C-c, kill yesod-bin and children process
* deleted: `setDelegateCtlc True`
* added: `setCreateGroup True`

When you use a group,
the child process will be terminated when the parent process is terminated.
2020-06-29 17:14:52 +09:00
Maximilian Tagher
a1c6bc553c Update yesod cabal file for distribution
Hackage is now requiring a higher cabal file version, and with that comes a requirement to specify the language of each module
2020-06-26 13:01:43 -04:00
Maximilian Tagher
5cbcebf4db Bump yesod to 1.6.0.2 2020-06-26 12:55:43 -04:00
Maximilian Tagher
51b4bde6d9
Merge pull request #1658 from v0d1ch/1655_Replace-decodeFile-with-decodeFileEither
Replace decodeFile with decodeFileEither
2020-06-26 12:52:32 -04:00
Michael Snoyman
98afc13e92
Allow random 1.2 2020-06-24 10:34:43 +03:00
Michael Snoyman
d4a60baf77
Merge pull request #1680 from yesodweb/printBodyPreview
When statusIs fails, print a preview of the body
2020-06-22 08:59:32 +03:00
Maximilian Tagher
1d67e3a359 1.6.10 2020-06-21 20:27:35 -04:00
Maximilian Tagher
28e5b606b2 attempt to fix 8.2 2020-06-20 17:27:13 -04:00
Maximilian Tagher
4ddff42847 .. 2020-06-20 15:01:51 -04:00
Maximilian Tagher
f50d23ce49 .. 2020-06-20 15:01:26 -04:00
Maximilian Tagher
8f00e76257 .. 2020-06-20 14:56:19 -04:00
Maximilian Tagher
34927e3401 .. 2020-06-20 14:54:31 -04:00
Maximilian Tagher
2ddc63e66a When statusIs fails, print a preview of the body
My team makes frequent use of `statusIs`, but in virtually all cases where `statusIs` fails, we need to add a call to `printBody` to do further debugging.

Following in the footsteps of `requireJSONResponse`, this PR automatically prints a portion of the body when `statusIs` fails, assuming the body looks like a text-based response (e.g. not a JPEG).

I've found that a status code alone is often very misleading and leads people on a wild good chase, because e.g. a 403 could be triggered for many different reasons.

I'm opening this PR as a draft to confirm people like the idea of doing this. If so I'll do a closer review of the code (this is my first draft basically), and also write some tests + test the code works in all cases.
2020-06-17 17:31:00 -04:00
Maximilian Tagher
e7cf662af7 Update yesod-test cabal file for distribution
Hackage is now requiring a higher cabal file version, and with that comes a requirement to specify the language of each module
2020-06-01 14:54:39 -04:00
Maximilian Tagher
d03c095b63 Add bumped GHC dependency in yesod-test changelog 2020-06-01 11:53:03 -04:00
Maximilian Tagher
b94da055c0
Merge pull request #1676 from yesodweb/documentYesodTest
Add more documentation to yesod-test
2020-06-01 11:29:12 -04:00
Maximilian Tagher
5c33dcb518 .. 2020-05-31 16:56:09 -04:00
Maximilian Tagher
8e89ec0e40 .. 2020-05-31 16:38:48 -04:00
Maximilian Tagher
ab8a994a34 .. 2020-05-31 16:38:09 -04:00
Maximilian Tagher
c3fa2adddd Add more documentation to yesod-test
This adds high-level documentation to yesod-test, plus some function documentation
2020-05-31 16:35:27 -04:00
Michael Snoyman
074865bca9
Merge pull request #1674 from ericdeansanchez/fix-typo
Fix small typo in documentation
2020-05-23 21:37:16 +03:00
eric
d382d67769
Fix small typo in documentation
This PR seeks to correct a small typo in the word _continuously_.
2020-05-23 11:29:06 -07:00
Michael Snoyman
2b5bf7b9b9
Merge pull request #1672 from amkhlv/master
increase the size of CSRF token
2020-05-01 13:35:16 +03:00
Andrei Mikhailov
c39b165ff3 increase the size of CSRF token 2020-05-01 00:40:11 -03:00
Michael Snoyman
7f37d2b6fa
Merge pull request #1664 from RyanGlScott/master
Use DeriveLift to generate yesod-core's Lift instances
2020-03-31 16:21:23 +03:00
Ryan Scott
29a08425e9 Use DeriveLift to generate yesod-core's Lift instances
GHC 8.0 and later come with the `DeriveLift` extension for deriving
instances of `Language.Haskell.TH.Syntax.Lift`. `yesod-core` supports
GHC 8.2 and up, so it is able to make use of this. Not only does
`DeriveLift` make for much shorter code, but it also fixes warnings
that you get when compiling `yesod-core` with GHC 8.10 or later:

```
[20 of 31] Compiling Yesod.Routes.TH.Types ( src/Yesod/Routes/TH/Types.hs, interpreted )

src/Yesod/Routes/TH/Types.hs:34:10: warning: [-Wmissing-methods]
    • No explicit implementation for
        ‘liftTyped’
    • In the instance declaration for ‘Lift (ResourceTree t)’
   |
34 | instance Lift t => Lift (ResourceTree t) where
   |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/Yesod/Routes/TH/Types.hs:49:10: warning: [-Wmissing-methods]
    • No explicit implementation for
        ‘liftTyped’
    • In the instance declaration for ‘Lift (Resource t)’
   |
49 | instance Lift t => Lift (Resource t) where
   |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/Yesod/Routes/TH/Types.hs:59:10: warning: [-Wmissing-methods]
    • No explicit implementation for
        ‘liftTyped’
    • In the instance declaration for ‘Lift (Piece t)’
   |
59 | instance Lift t => Lift (Piece t) where
   |          ^^^^^^^^^^^^^^^^^^^^^^^^

src/Yesod/Routes/TH/Types.hs:78:10: warning: [-Wmissing-methods]
    • No explicit implementation for
        ‘liftTyped’
    • In the instance declaration for ‘Lift (Dispatch t)’
   |
78 | instance Lift t => Lift (Dispatch t) where
   |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
```

This is because `DeriveLift` fills in implementations of `liftTyped`,
a method that was introduced to `Lift` in `template-haskell-2.16.0.0`
(bundled with GHC 8.10).
2020-03-31 08:41:00 -04:00
Jezen Thomas
59f601a34c
Add functions for setting description and OG meta (#1663)
* Add functions for setting description and OG meta

It's common that a website author will want to add a specific
description and Open Graph image to a given page in their website. These
functions are simple conveniences to add these meta tags to the document
head.

I decided against simply adding all possible meta tags, because not all
of them are useful, and even in the case of Open Graph tags, many of
them should be set only once and they should use the same value for the
entire website. In those cases, it's probably better for the website
author to add those tags in their layout template.

Closes https://github.com/yesodweb/yesod/issues/1659
2020-03-30 19:00:24 +07:00
Michael Snoyman
4a4dd06df8
Azure matrix/stack.yaml update 2020-03-24 12:20:19 +02:00
Michael Snoyman
179296c568
Merge pull request #1662 from charukiewicz/master
Yesod.Auth.Email: Fixed incorrect confirmation message, enabled customizing 'forgot password' email
2020-03-24 07:15:56 +02:00
charukiewicz
c5e76faf4d adjusted indentation of if/then/else to be more compact 2020-03-21 12:49:18 -05:00
charukiewicz
ff8ad9717f added link to PR in changelog entry 2020-03-21 02:27:52 -05:00
charukiewicz
cef6fc42ef bumped yesod-auth to 1.6.10 and updated ChangeLog 2020-03-21 02:16:40 -05:00
charukiewicz
61f1e5eeae added sendForgotPasswordEmail to YesodAuthEmail typeclass and incorporated into defaultRegisterHelper 2020-03-21 02:15:27 -05:00
charukiewicz
f80ec711ff updated AuthMessage to accommodate user registration flow with password: added EmailVerified and EmailVerifiedChangePass, deprecated AddressVerified 2020-03-20 22:22:13 -05:00
Michael Snoyman
9d0c9180b9
unliftio-core 0.2 2020-03-01 11:00:36 +02:00
Michael Snoyman
b4c613f766
Merge pull request #1660 from charukiewicz/register-helper
Add methods to YesodAuthEmail that allow custom flow after registration/password reset
2020-02-11 08:44:30 +02:00
charukiewicz
4f62e39fb1 added pull request link to ChangeLog entry 2020-02-09 17:03:51 -06:00
charukiewicz
16bf146887 version bump to 1.6.9 and changelog update 2020-02-05 23:49:16 -06:00
charukiewicz
c35c2fddc2 added passwordResetHelper method, exposed defaultRegisterHelper 2020-02-05 23:45:02 -06:00
charukiewicz
abdd844279 added registerHandler method to YesodAuthEmail class to enable override 2020-02-05 01:21:56 -06:00
Sasha Bogicevic
cfaf517f54 Replace decodeFile with decodeFileEither 2020-01-28 09:18:59 +01:00
Michael Snoyman
5943ee527d
Version bump 2020-01-27 17:52:24 +02:00
Michael Snoyman
6c9279c146
Merge pull request #1657 from simonmichael/master
support template-haskell 2.16, build with GHC 8.10
2020-01-27 17:51:35 +02:00
Simon Michael
dd649bf238 support template-haskell 2.16, build with GHC 8.10 2020-01-27 06:11:48 -08:00
Maximilian Tagher
873bee0cfa
Merge pull request #1654 from juanpaucar/remove_typeable
Remove unnecessary Typeable deriving, Solves #1653
2020-01-25 14:03:07 -08:00
Juan Paucar
6e38a3b99d Bump version properly 2020-01-20 11:06:35 -05:00
Juan Paucar
eb159b6fd5 Bump versions 2020-01-17 14:03:59 -05:00
Juan Paucar
c279547962 Remove unnecesary Typeable deriving 2020-01-17 11:48:58 -05:00
Michael Snoyman
804b114d91
Drop LTS 9 2020-01-07 13:36:58 +02:00
Michael Snoyman
dc16761492
Merge pull request #1649 from yesodweb/yesodPersistentCompatibility
Add extensions for yesod-persistent tests to be compatible with lates…
2020-01-03 07:38:07 +02:00
Maximilian Tagher
a8a7b6c7a5 .. 2020-01-02 22:51:54 -05:00
Maximilian Tagher
367d77a8c3 .. 2020-01-02 22:00:13 -05:00
Maximilian Tagher
cf365d18a2 Add extensions for yesod-persistent tests to be compatible with latest persistent-template
The upcoming version of persistent-template will require these yesodweb/persistent#1002
2020-01-02 21:57:00 -05:00
Maximilian Tagher
4f51153b09 Require latest yesod-core for yesod-test
(This was missing from #1646)
2019-12-01 08:06:10 -05:00
Maximilian Tagher
3fac351583
Merge pull request #1646 from yesodweb/requireJSONResponse
[yesod-test] Adds requireJSONResponse function
2019-12-01 08:04:21 -05:00
Maximilian Tagher
8ee771896c .. 2019-11-29 10:46:25 -05:00
Maximilian Tagher
561adc2e17 .. 2019-11-29 10:44:49 -05:00
Maximilian Tagher
42d41f77de .. 2019-11-29 10:43:11 -05:00
Maximilian Tagher
0025226af6 Print preview of JSON body in case of parse failure 2019-11-28 22:33:00 -05:00
Maximilian Tagher
91b75741dd .. 2019-11-24 16:11:50 -05:00
Maximilian Tagher
92afb1150a .. 2019-11-24 15:56:42 -05:00
Maximilian Tagher
596db81d7a .. 2019-11-24 15:55:58 -05:00
Maximilian Tagher
6d0b723eb1 [yesod-test] Adds requireJSONResponse function
This function checks that a response body is JSON, and parses it into a Haskell value. Having something like this function is pretty essential to using Yesod as a JSON API server, so I think it's a good addition. You can use it to parse a Haskell record directly (usually by adding FromJSON classes to your response types), or parse a Value and pull out individual fields, maybe using something like `aeson-lens` (though probably a testing-specific library would be better).

I debated over these things:

1. The name. I was thinking of something like [assert/require/decode/parse]JSON[Response/Body]. I ultimately went with requireJSONResponse:
	- decode/parse sound like the aeson functions that return Either or Maybe, and I wanted this function to throw an error if it failed
	- I'm open to using `assertJSONResponse`—it matches the other functions (`assertEq`) better—but I think it reads less like English.
	- I chose Response over Body because (a) It also checks the content-type header, which is not in the body (b) "Body" felt slightly in-the-weeds of HTTP; I think "response" is more approachable.
2. Should it require the JSON content type? You can definitely have a server that returns JSON without JSON content types, but I think that's a such a bad idea, it's more likely requiring it helps people if they accidentally don't add the header.
3. Should it take a String parameter to add to the error message? This would match `assertEq`, but other functions like `statusIs` don't take a message. Ultimately I went without it, because the messages felt like I was repeating myself: `(comment :: Comment) <- requireJSONResponse "the response has a comment"`
2019-11-24 15:31:05 -05:00
Michael Snoyman
463fd54c5a
Drop rio dep (fixes #1645) 2019-11-22 09:16:52 +02:00
Maximilian Tagher
d5f6fbba8b
Merge pull request #1642 from yesodweb/testModifySite
Add testModifySite
2019-11-20 08:41:08 -08:00
Maximilian Tagher
b0c07ea3cd .. 2019-11-19 23:13:11 -08:00
Maximilian Tagher
cbef19fae9 [yesod-test] Add testModifySite 2019-11-19 23:11:13 -08:00
Maximilian Tagher
a2d200c182 .. 2019-11-17 12:43:24 -08:00
Maximilian Tagher
e39eaeef92 WIP - Add testModifySite 2019-11-17 12:42:20 -08:00
Michael Snoyman
0d4c435e42
Reenable yesod-auth on nightly 2019-11-16 21:18:18 +05:30
Michael Snoyman
bce08f6d86
Merge pull request #1640 from alexeyzab/mention-db-rollback
Add a warning about DB actions getting rolled back
2019-11-14 14:01:22 +05:30
Alexey Zabelin
19f4b26e1f
Add a warning about DB actions getting rolled back 2019-11-13 20:55:47 -08:00
Michael Snoyman
e333735176
Merge pull request #1638 from chrisdone/add-getting-started-code-sample
Add Getting Started to READMEs
2019-11-11 16:38:39 +02:00
Chris Done
4a6aedf88a Add Getting Started to READMEs
* Adds to the README seen on Github.
* Adds to the README that will be seen on Stackage/Hackage.
2019-11-11 13:46:27 +01:00
Michael Snoyman
347ea6775b
Support for Cabal 3.0 2019-11-11 09:47:05 +02:00
Michael Snoyman
6d21107549
Merge pull request #1636 from yesodweb/1635-use-get-stmt-conn
Replace call to connPrepare with getStmtConn (fixes #1635)
2019-10-30 05:49:01 +02:00
Michael Snoyman
7839de4dbd
Replace call to connPrepare with getStmtConn (fixes #1635) 2019-10-29 13:25:53 +02:00
Michael Snoyman
eb9432c01d
Simplify CI 2019-10-27 07:40:39 +02:00
Michael Snoyman
9b93e97a80
Merge pull request #1634 from betlgtu/master
Translated message "CurrentPassword" for russian language.
2019-10-27 07:35:29 +02:00
Виталий Котляров
ddc71e665b Translated message "CurrentPassword" for russian language. 2019-10-26 23:08:38 +03:00
Michael Snoyman
b5fb6caca0
Merge branch 'master' of github.com:yesodweb/yesod 2019-10-10 06:44:12 +03:00
Michael Snoyman
5fb58470fe
Merge pull request #1632 from yesodweb/addBasicAuthToYesodTest
Add Basic Auth support to yesod-test
2019-10-10 06:44:00 +03:00
Michael Snoyman
b788310519
Not compatible with nightly right now 2019-10-10 06:43:51 +03:00
Maximilian Tagher
e4c493d199 .. 2019-10-09 16:11:54 -07:00
Maximilian Tagher
ffd5ba0474 Add Basic Auth support to yesod-test
This allows setting username/password for HTTP basic auth, similar to the --user flag of curl.
2019-10-09 16:08:37 -07:00
Michael Snoyman
c8aeb61ace
Merge pull request #1631 from yogsototh/rss-2.0
Support categories for Atom and RSS newsfeed
2019-10-02 13:37:54 +03:00
Yann Esposito (Yogsototh)
3a7bff1537
Feedback fixes 2019-10-02 09:07:55 +02:00
Yann Esposito (Yogsototh)
a0d35dfe4c
add support for RSS categories 2019-09-30 22:12:27 +02:00
Michael Snoyman
2a71af250f
Merge pull request #1628 from sestrella/areq_and_wreq_custom_error_message
Customize `areq` and `wreq` error message
2019-09-10 11:24:45 +03:00
Sebastián Estrella
32ecbd056d Customize areq and wreq error message 2019-09-10 00:42:21 -05:00
Michael Snoyman
f054bac0e0
Version bump 2019-09-08 09:45:29 +03:00
Michael Snoyman
904644c577
Merge pull request #1627 from DanBurton/yesod-core-th-2-15-fix
Add new CPP branch for template-haskell >= 2.15
2019-09-08 08:58:27 +03:00
Dan Burton
ed69d69347 Add new CPP branch for template-haskell >= 2.15 2019-09-06 13:04:21 -04:00
Michael Snoyman
ba1e48308c
Merge pull request #1623 from jezen/master
Increase CI timeout
2019-08-27 14:54:46 +03:00
Jezen Thomas
d82baf83b6
Increase CI timeout
The build on Azure DevOps is currently failing as the build-time is
exceeding 120 minutes. Hopefully 180 minutes should be sufficient.
2019-08-27 12:19:29 +02:00
Michael Snoyman
50a3242507
Merge pull request #1622 from jezen/master
Add jsAttributesHandler
2019-08-26 16:25:46 +03:00
Jezen Thomas
46af7bfb76
Cleanup 2019-08-26 13:49:57 +02:00
Jezen Thomas
d1e4fd485b
Make jsAttributesHandler use jsAttributes
This addresses this comment:

https://github.com/yesodweb/yesod/pull/1622#discussion_r317467498
2019-08-26 12:05:30 +02:00
Jezen Thomas
59988f46a1
Add jsAttributesHandler
This adds `jsAttributesHandler` to run arbitrary Handler code before
building the attributes map for the script tag generated by `widgetFile`.
This is useful if you need to add a randomised nonce value to that tag.

Closes https://github.com/yesodweb/yesod/issues/1621
2019-08-23 21:57:48 +02:00
Michael Snoyman
2c2531c499
Merge pull request #1619 from 3v0k4/auth-dummy-json
Dummy: Add support for JSON submissions
2019-08-23 09:10:30 +03:00
3v0k4
baa6bfb3a8 Dummy: Check for JSON first 2019-08-23 00:48:17 +02:00
Michael Snoyman
d7a29977bf
Merge pull request #1617 from league/url-encode
URL-encode POST parameters in yesod-test
2019-08-20 09:10:21 +03:00
Michael Snoyman
56e85572d4
Merge pull request #1620 from jezen/master
Move JavaScript form submission to script block
2019-08-20 09:08:55 +03:00
Christopher League
fa90ab19ca Update changelog 2019-08-19 15:57:15 -04:00
Jezen Thomas
d385ada853
Move JavaScript form submission to script block
If someone wants their website to score a good grade on a security
vulnerability scanner like Mozilla Observatory, they will need to enable
the Content Security Policy header. When using CSP, it is possible to
explicitly allow inline JavaScript in `<script>` tags by specifying the
sha256 of the snippet. However the same is _not_ true of any JavaScript
included in a HTML attribute like `onload`.

This changes moves the JavaScript form submission out of the `onload`
HTML attribute and into a `<script>` tag so the user can add the hash of
this script to their explicitly-allowed `script-src` list, and they can
avoid using undesirable CSP rules like `unsafe-inline`.

Without explicitly allowing this script when using CSP, the script would
fail and the user would have to click the button to continue.
2019-08-19 20:56:00 +02:00
3v0k4
657b790a3d Dummy: Add support for JSON submissions 2019-08-19 19:25:37 +02:00
James Burton
d8ebb95c96
Added Multi Input Form Functionality (#1601) 2019-08-16 04:30:20 +01:00
Christopher League
08a9632eba yesod-test: correction to PR for multipart 2019-08-13 11:58:11 -04:00
Christopher League
3f98190645 Bump version to 1.6.6.2 2019-08-13 10:39:44 -04:00
Christopher League
a79f73a040 yesod-test: url-encode addPostParam keys & values
Fixes #1616
2019-08-13 10:34:57 -04:00
Christopher League
ac66323394 yesod-test: failing tests for encoding errors
Related to issue #1616
2019-08-13 10:29:21 -04:00
Michael Snoyman
37c0df8dc1
Merge pull request #1613 from jezen/master
Add mreqMsg
2019-07-18 14:52:35 +03:00
Jezen Thomas
e5e39f353d
Implement mreq in terms of mreqMsg 2019-07-18 13:56:19 +03:00
Jezen Thomas
14ade1ad98
Add mreqMsg
When a form has multiple `mreq` fields and the user submits a form with
more than one of these values missing, they see an ambiguous collection
of "Value is required" messages. The `mreqMsg` function allows you to
provide your own MsgValueRequired message for a better UX.
2019-07-18 11:11:02 +03:00
Michael Snoyman
bc73850173
Merge pull request #1608 from leifmetcalf/ignore
Trivial: add stack.yaml.lock to .gitignore
2019-07-07 20:18:19 +03:00
Michael Snoyman
1af6f243f6
Merge pull request #1607 from leifmetcalf/patch-1
Trivial: use git clone --recurse-submodules instead of --recursive
2019-07-07 20:17:17 +03:00
Leif Metcalf
048148824c
Ignore stack.yaml.lock 2019-07-06 14:22:32 +12:00
Leif Metcalf
6eb597052a
Use git clone --recurse-submodules 2019-07-06 14:00:11 +12:00
Michael Snoyman
636f35b081
Merge pull request #1605 from mmilata/html-typo
Trivial: remove comma from <form> tag
2019-06-18 21:46:36 -07:00
Martin Milata
b4d3e01afb Remove comma from <form> tag 2019-06-18 01:56:32 +02:00
Michael Snoyman
af038b75f8
Merge pull request #1604 from jprider63/optional-labels
Optional labels
2019-06-16 06:28:08 -07:00
James Parker
0f8441eb73 Updated changelog. 2019-06-15 09:45:32 -04:00
James Parker
4424abe449 Hide bootstrap labels when empty 2019-06-11 14:09:54 -04:00
Steven Leiva
c90c50911c
Merge pull request #1598 from StevenXL/update-clearcreds
clearCreds redirect behavior depends on request type.
2019-05-24 10:20:55 -05:00
patrick brisbin
e470f1a3f8 Version bump 2019-05-21 12:10:03 -04:00
patrick brisbin
096049e0e3 sendClose and sendPing act in m ()
The previous type signature was attempting to read the Connection off of
the m in WebSocketsT m, rather than the WebSocketsT itself. This was
likely a typo that happened to type-check. The types for these now align
with the rest of the API, read the Connection off of WebSocketsT, and
make no demands of the m other than MonadIO.

Fixes #1599.
2019-05-21 12:10:03 -04:00
Steven Leiva
ceeeb16ae0 clearCreds redirect behavior depends on request type. 2019-05-14 13:20:34 +00:00
Michael Snoyman
006fa6cb9e
Update ChangeLog 2019-04-30 11:33:32 +03:00
Michael Snoyman
8c4b8e5094
Merge pull request #1595 from yesodweb/move-to-azure
Move to azure
2019-04-30 09:29:34 +03:00
Michael Snoyman
3647bf94b7 Strip CRs for Windows testing 2019-04-30 07:03:22 +03:00
Michael Snoyman
3b58652483
Compat with network 3 2019-04-30 05:13:10 +03:00
Michael Snoyman
3ba15fb8d3
Skip lts-9 on Windows (needs more extra-deps) 2019-04-30 04:53:14 +03:00
Michael Snoyman
5921a10ded
Increase Azure timeout 2019-04-30 04:47:30 +03:00
Michael Snoyman
5fe5e24eb0
Add missing rio dependency
Travis was handling this via the solver, which we don't want to be using
2019-04-29 19:21:27 +03:00
Michael Snoyman
5acc62b5e2
Updated badge for Azure 2019-04-29 18:48:37 +03:00
Michael Snoyman
772324e8cb
Azure config 2019-04-29 18:44:47 +03:00
Michael Snoyman
c7bb2d22af
Remove Travis config 2019-04-29 18:44:26 +03:00
Michael Snoyman
d9d4863fc1
Remove appveyor 2019-04-29 18:37:18 +03:00
Michael Snoyman
abdea8d157
Remove out-of-date ReleaseNotes.md 2019-04-29 18:37:00 +03:00
Michael Snoyman
3015a9a9f1
Remove out-of-date README 2019-04-29 18:36:35 +03:00
Michael Snoyman
b30a2a5b07
Remove sources.txt 2019-04-29 18:36:06 +03:00
Michael Snoyman
de209b3b94
Merge pull request #1594 from yesodweb/persistent-2-10
Test against persistent 2.10
2019-04-29 18:00:40 +03:00
Michael Snoyman
2a51e05448
Test against persistent 2.10 2019-04-29 16:03:39 +03:00
Michael Snoyman
ad6ed03aa4
Add support for persistent 2.10 2019-04-22 08:46:21 +03:00
Michael Snoyman
cc2d19a25d
Relax upper bound on persistent 2019-04-22 08:45:44 +03:00
Michael Snoyman
b5839420aa
Version bump 2019-04-13 22:01:17 +03:00
Michael Snoyman
42fbab9129
Merge pull request #1592 from StevenXL/add-jsonresponse-type
Introduce JSONResponse.
2019-04-13 22:00:23 +03:00
Steven Leiva
ab096c649c Introduce JSONResponse.
This data type allows us to return a domain type in our handlers, even
if we eventually want to send JSON to the client.

See: https://tech.freckle.com/2015/12/21/servant-style-handlers-for-yesod/
2019-04-12 16:13:53 -05:00
Michael Snoyman
6a7370a9e6
Merge pull request #1589 from geekingfrog/maximumContentLengthIO
maximumContentLengthIO
2019-03-17 11:11:45 +02:00
Grégoire Charvet 黑瓜
f1374c9140 add doc for maximumContentLength override 2019-03-17 09:10:07 +00:00
Grégoire Charvet 黑瓜
a691f49258 update changelog 2019-03-15 20:37:46 +00:00
Grégoire Charvet 黑瓜
48bfe0d573 maximumContentLengthIO 2019-03-15 20:35:39 +00:00
Michael Snoyman
4b760a027e
Merge pull request #1586 from yesodweb/documentRunDB
Document runDB
2019-03-07 04:24:28 +02:00
Maximilian Tagher
837b898b35 Document runDB
My coworker who is new to Haskell was pointing out that for such an important function to Yesod, this one is lacking any documentation. It's slightly hard to document because people could provide various implementations for it, but I think this description captures the essence pretty well, and notes the important implicit behavior of opening a transaction.
2019-03-06 11:31:38 -08:00
Michael Snoyman
c67c89007c
src subdir for yesod-core 2019-02-19 04:02:21 +02:00
Michael Snoyman
e5cc9987ae
Move from byteable to memory 2019-02-19 03:58:31 +02:00
Michael Snoyman
b1e718397b
Deprecate GoogleEmail2 (fixes #1579) 2019-02-12 18:52:47 +02:00
Michael Snoyman
90fa4d9eae
Merge pull request #1581 from nytopop/no-multi-session-cookies
Use at most one valid session cookie per request
2019-02-11 19:16:05 +02:00
nytopop
70b730cc4e
Use at most one valid session cookie per request
Makes `loadClientSession` ignore all sessions in a request if more than
a single session cookie decodes successfully. The prior behavior was to
merge all valid session cookies' values.

Bumps version to 1.6.12
2019-02-10 08:42:37 -08:00
Michael Snoyman
9ccdc38b78
Merge pull request #1576 from eborden/eborden/deprecate-insecure-json-body-functions
Deprecate insecure JSON body functions
2019-01-30 09:21:29 +02:00
Evan Rutledge Borden
da9e72b82f Add minor version bump to 1.6.11
JSON parsing function deprecations warrant a minor version bump.
2019-01-29 15:31:35 -06:00
Jonathan Lamothe
6fe7ee6e0d Documentation fix (#1577)
* fixed documentation

* bumped version

* updated ChangeLog
2019-01-26 12:53:04 +05:30
Evan Rutledge Borden
b50ca99566 Deprecate insecure JSON body functions
`parseJsonBody` and `requireJsonBody` do not require a mime type when
parsing `JSON` content. This leaves them open to CSRF. They are now
deprecated and `insecure` versions are added in their place. Consumers
are now given a proper choice between secure and insecure functions.

There is a potential attack vector in that the browser does not trigger
CORS requests for "simple requests", which includes POST requests that
are form or text content-types. An attacker can craft a form whose body
is valid JSON, and when a user visits attacker.com and submits that
form, it can be submitted to bank.com and bypass CORS.

Checking the content-type is application/json prevents this, because if
the content-type was set to application/json, then the browser would
send a CORS request—a preflight OPTIONS request to the server asking if
the current domain (and some other values) are whitelisted to send
requests to that server. If the server doesn't say attacker.com is
whitelisted, the browser will not send the real request to the server.
2019-01-24 09:12:48 -06:00
Michael Snoyman
874a711d47
Merge pull request #1574 from yesodweb/more-ltses
More LTSes are tested
2019-01-23 08:26:41 +02:00
Michael Snoyman
5f597494b5
More LTSes are tested 2019-01-22 20:09:05 +02:00
Michael Snoyman
c7e4dd0a1c
Fix test suite compilation on GHC 8.6.3 commercialhaskell/stackage#4319 2019-01-22 18:40:31 +02:00
Michael Snoyman
9ff1f18a4a
Merge pull request #1573 from yesodweb/getSetCache
Add functions to get and set values in the per-request caches
2019-01-22 09:35:37 +02:00
Maximilian Tagher
c8974d81f9 Add functions to get and set values in the per-request caches
Closes #1572
2019-01-21 10:47:27 -08:00
Sibi
09c4587393
Merge pull request #1571 from jlamothe/FormResult
Make FormResult instances of Eq and Monad
2019-01-20 22:59:18 +05:30
Jonathan Lamothe
92e4e48353 updated ChangeLog 2019-01-19 13:12:29 -05:00
Jonathan Lamothe
fd141d56b7 incremented version number 2019-01-18 18:53:04 -05:00
Jonathan Lamothe
429f78859c make FormResult an instance od Eq 2019-01-18 12:48:36 -05:00
Maximilian Tagher
673db5f6ff
Merge pull request #1570 from yesodweb/cookieHelpers
[yesod-test] Add utility functions to modify cookies
2019-01-15 08:04:30 -08:00
Maximilian Tagher
bedec86c74 [yesod-test] Add utility functions to modify cookies 2019-01-14 16:12:32 -08:00
Michael Snoyman
72c6187a22
Merge pull request #1568 from stevehartdata/master
Eliminate deprecation warnings when building websockets sample.hs
2019-01-09 08:49:51 +02:00
Steve Hart
e1a33248b0 Eliminate deprecation warnings when building websockets sample.hs 2019-01-07 20:12:12 -05:00
Sibi
c5268e3581
Merge pull request #1567 from gabebw/gbw-fix-typo
Fix typo in deprecation message
2018-12-28 10:41:12 +05:30
Gabe Berke-Williams
9720363117 Fix typo in deprecation message
The message recommended using `authTwitterUsingUserID` (note that the
`ID` at the end of the method name is all capitalized).

However, the actual method name is `authTwitterUsingUserId` (note the `Id` at the
end).
2018-12-27 17:31:58 -08:00
Michael Snoyman
f7f356b32e
Relax upper bound (fixes #1566) 2018-12-19 08:28:07 +02:00
Michael Snoyman
7a2c5367e7
Merge pull request #1565 from StevenXL/add-send-response-no-content
Add sendResponseNoContent.
2018-12-03 09:22:06 +02:00
Steven Leiva
2a9bef34c0 Add sendResponseNoContent. 2018-11-30 14:27:21 -06:00
Michael Snoyman
6eb91bdb77
Add missing test file (fixes #1563) 2018-10-15 16:21:17 +03:00
Michael Snoyman
f7e177d5f2
Version bump 2018-10-14 11:10:13 +03:00
Michael Snoyman
ab0ac8b1a2
Fix extra-deps 2018-10-14 10:49:12 +03:00
Michael Snoyman
aed169b43f
Merge branch 'update-persistent' of https://github.com/DanBurton/yesod 2018-10-14 10:47:23 +03:00
Michael Snoyman
b16084ed34
Configuration for persistent 2.9 2018-10-14 10:45:45 +03:00
Michael Snoyman
7f07325dc4
Merge branch 'master' of https://github.com/iand675/yesod 2018-10-14 10:44:18 +03:00
Dan Burton
bff8200ae4
Updated changelogs and versions for #1561 2018-10-11 14:21:17 -04:00
Dan Burton
132abccff2
Compile with ghc 8.6 by pushing MonadFail usage into IO 2018-10-11 13:53:35 -04:00
Dan Burton
90423f5bc7
Downgrade yesod-persistent version bump to patch level 2018-10-11 12:56:49 -04:00
Dan Burton
49dcfe02af
Merge branch 'master' of https://github.com/iand675/yesod into update-persistent 2018-10-11 12:54:52 -04:00
Michael Snoyman
84f77fe34a
Merge pull request #1558 from whittle/routes-file-line-continuations
In the route syntax, allow trailing backslashes to indicate line continuation.
2018-10-09 05:24:15 +03:00
Jason Whittle
ee260e24cb Update changelog with a link to PR #1558. 2018-10-08 18:04:16 -04:00
Jason Whittle
ca602d11bf Bump minor version. 2018-10-08 16:56:20 -04:00
Jason Whittle
4e4efd1627 In the route syntax, allow trailing backslashes to indicate line continuation. 2018-10-08 16:47:06 -04:00
Michael Snoyman
6a9bcc292d
Remove unneeded version bumps 2018-10-08 10:20:49 +03:00
Michael Snoyman
55e0ca4bc3
Add PrimMonad instances
Pointed out at: https://stackoverflow.com/q/52692508/369198
2018-10-08 08:19:32 +03:00
Michael Snoyman
1c2cb0c717
Merge pull request #1554 from oddvars/oddvars-typo-patch
minor typos
2018-09-14 08:29:19 +03:00
oddvars
41101b20dd
minor typos
fixed typo and escaped backslash for haddock
2018-09-13 16:42:52 +02:00
Michael Snoyman
2af5d9c64c
Relax yaml upper bound 2018-08-20 10:11:42 +03:00
Michael Snoyman
67c223d76b
Minor cabal file improvements 2018-08-20 10:11:42 +03:00
Steven Leiva
3ebd8f91a5
Merge pull request #1550 from StevenXL/set-x-xss-protection
Set X-XSS-Protection to 1; mode=block.
2018-08-06 15:46:31 -05:00
Steven Leiva
4015ef2919 Set X-XSS-Protection to 1; mode=block. 2018-08-03 14:17:11 -05:00
Chris Allen
826a607571
Merge pull request #1548 from yesodweb/MaxGabriel-patch-1
Explain how requireCheckJsonBody can prevent CSRF
2018-08-02 10:30:41 -05:00
Maximilian Tagher
1f05d2c72f
Explain how requireCheckJsonBody can prevent CSRF 2018-07-31 21:22:39 -07:00
Michael Snoyman
6f76b5ff91
Merge pull request #1544 from nmk/master
Do not lose selected value in `selectFieldHelper` when validation fails
2018-07-29 10:21:35 +03:00
Nickolay Kolev
073c9fabd4 Do not lose selected value in selectFieldHelper when validation fails 2018-07-26 20:44:26 +02:00
Steven Leiva
db1ff95520
Merge pull request #1540 from StevenXL/error-406
Fix Improper 406 Responses
2018-07-24 07:36:16 -05:00
Steven Leiva
266c436f18 selectRep chooses first rep if no matches found.
The `selectRep` documentation indicates that it choose the first
representation provided if no representation matches.

This was only partially correct, as `selectRep` required that no
representation matched **and** that the `Content-Type` header of the
response was empty.

This led to a problem because `defaultErrorhandler` relies on
`selectRep`, and when `selectRep` was unable to find a suitable
representation, it would "swallow" the original error that resulted in
`defaultErrorhandler` being called, and set a status 406 for all cases.
2018-07-19 21:32:02 -05:00
Michael Snoyman
1c51a93a45
Relax upper bounds 2018-07-11 08:20:20 +03:00
Michael Snoyman
04393855e5
Merge branch 'master' of github.com:yesodweb/yesod 2018-07-10 11:56:46 +03:00
Michael Snoyman
b7a3385a89
Merge pull request #1537 from kikaiteam/fix_forgot_pass_endpoint
AuthEmail: Fix forgot-password endpoint
2018-07-10 11:56:28 +03:00
Michael Snoyman
6fb09cfa5a
Merge pull request #1538 from kikaiteam/improve_auth_email_doc
AuthEmail: no-op, improve doc format
2018-07-10 11:55:46 +03:00
Michael Snoyman
074dc11678
Merge pull request #1539 from h-3-0/patch-1
Fix typo
2018-07-10 02:13:38 +03:00
Henri Jones
c221aa3aaa
Fix typo 2018-07-09 22:47:48 +01:00
hainq
72ad3082ce AuthEmail: no-op, improve doc format 2018-07-09 18:24:11 +07:00
hainq
d38affbe6d yesod-auth: update changelog & bump version 2018-07-09 17:52:07 +07:00
hainq
0c136f14eb AuthEmail: Fix forgot-password endpoint
This is a quick fix for PR#1524.
Currently, defining `emailPreviouslyRegisteredResponse` will prevent
`sendConfirmationEmail` from happening, even when `registerHelper` is
called from `postForgotPasswordR`.
2018-07-09 17:34:15 +07:00
Michael Snoyman
c1344a577f
Fix version bump 2018-07-09 13:12:40 +03:00
Michael Snoyman
71d951c09b
Correct the version bump (previous unreleased changes) 2018-07-09 13:10:55 +03:00
Michael Snoyman
e125795de3
Merge pull request #1536 from kikaiteam/support_more_email_register_flows
AuthEmail: Immediately register with a password
2018-07-09 12:55:08 +03:00
hainq
bd9d0f9922 yesod-auth: Bump version & Update Changelog 2018-07-09 14:06:53 +07:00
hainq
6a64debfa0 Redirect to afterVerificationWithPass when account was registered with a password 2018-07-09 14:02:10 +07:00
hainq
54b1d3d3ff AuthEmail: Immediately register with a password
Register endpoint: Support an optional "password" param that can be used
to set new accounts' password immediately.
2018-07-09 14:02:10 +07:00
Michael Snoyman
ea182bb464
Merge pull request #1534 from yesodweb/reduce-deps
Reduce deps
2018-07-04 09:34:31 +03:00
Michael Snoyman
182abd89bf
Drop some deps 2018-07-03 19:01:58 +03:00
Michael Snoyman
867e7c32dc
Clean up some CPP 2018-07-03 18:57:23 +03:00
Chris Allen
df5ad82a90
Merge pull request #1530 from pythonissam/expose-selectFieldHelper
Expose select field helper
2018-06-24 13:24:20 -05:00
Michael Snoyman
d134c20dab
Merge pull request #1524 from StevenXL/fix-email-registration
Fix email registration
2018-06-24 11:39:59 +03:00
Steven Leiva
8d58a56577 Make behavior of registerHelper configurable.
The behavior of `registerHelper` when an email that is already-verified
tries to register is now configurable via the
`emailPreviouslyRegisteredResponse` method of the `YesodAuthEmail`
typeclass.
2018-06-23 09:56:20 -05:00
pythonissam
01802e984b update the ChangeLog 2018-06-23 05:12:08 +00:00
Michael Snoyman
840f8faaaa
Merge pull request #1528 from ncaq/clean-appveyor
cleaned: appveyor: Easier to detect bugs
2018-06-20 06:22:38 +03:00
ncaq
6187c3cf09 cleaned: appveyor: Easier to detect bugs
* appveyor.yml conf file to simple from offcial reference
* Make the cache easier to use by commenting out
* fixed clone directory, from stack to yesod
* curl check https
* stack URL
* split build and test, So we can easy detect build or test error
* test job to single thread, So we can easy find bug of test
2018-06-20 10:49:28 +09:00
Michael Snoyman
a43e5a1cbb
Merge pull request #1526 from yesodweb/1523-fix-stalled-tests
1523 fix stalled tests
2018-06-19 11:24:12 +03:00
Michael Snoyman
d38d00f114 Skip RawResponse tests on Windows #1523
These tests stall on Windows starting with network-2.6.3.4. I haven't
yet figured out why exactly that's the case, or a minimum repro.
2018-06-19 10:37:20 +03:00
Michael Snoyman
12a2bb58e9 Add timeouts so stalling is more obvious 2018-06-19 09:52:20 +03:00
pythonissam
b5def68be2 Version bump 2018-06-17 08:46:52 +00:00
pythonissam
0b261f5073 Exposed 'selectFieldHelper' 2018-06-17 08:40:55 +00:00
Michael Snoyman
0437ace264
Merge pull request #1525 from StevenXL/bodyequals
bodyEquals prints actual body.
2018-06-14 09:17:51 -07:00
Steven Leiva
0a089c8cb0 bodyEquals prints actual body. 2018-06-14 09:00:48 -05:00
Michael Snoyman
cae2a9159a
Merge pull request #1520 from StevenXL/text-plain-error
defaultErrorHandler handles text/plain request.
2018-06-12 21:29:27 -07:00
Ian Duncan
bf97821b68 Fix merge conflict 2018-06-13 13:21:23 +09:00
Ian Duncan
2d14cdbf1a Update changelogs for yesod-persistent and yesod-auth 2018-06-13 13:12:01 +09:00
Steven Leiva
a63bf16a68 defaultErrorHandler handles text/plain request. 2018-06-12 21:08:55 -05:00
Ian Duncan
3036573f57 Update yesod-auth and yesod-persistent to persistent-2.9 2018-06-13 09:21:45 +09:00
Michael Snoyman
c88c2019ee
Merge pull request #1522 from ncaq/deleted-unneed-build-depends
deleted: unneed cabal build-depends by weeder
2018-06-12 07:53:12 -07:00
ncaq
708648798e deleted: unneed cabal build-depends by weeder
[weeder: Detect dead code](https://hackage.haskell.org/package/weeder)

deleted depends is

* mime-mail
* wai-eventsource

I sort build-depends, because duplicate depend some exist, to sort is detect to easy.
2018-06-09 13:15:21 +09:00
Michael Snoyman
c3a2a6afac
Merge pull request #1518 from psibi/update-issue-template
Update issue template slightly
2018-06-07 07:46:55 -06:00
Sibi Prabakaran
d15080ac4e
stack list-dependencies is deprecated 2018-06-06 20:39:56 +05:30
Michael Snoyman
74e43462cb
Merge pull request #1515 from yesodweb/multiple-stack-yamls
Multiple stack yamls
2018-06-04 06:40:03 -06:00
Michael Snoyman
908a758167 unliftio extra-deps 2018-06-03 14:54:21 -06:00
Michael Snoyman
a77b509bb6 Add warp to extra-deps 2018-06-03 14:35:50 -06:00
Michael Snoyman
3c2de1a763 Add persistent-sqlite extra-dep 2018-06-03 13:14:43 -06:00
Michael Snoyman
cdba6c1678 Fix CABALVER 2018-06-03 13:13:38 -06:00
Michael Snoyman
2cb60c8513 Multiple stack.yaml files 2018-06-03 11:42:44 -06:00
Michael Snoyman
d73f7b579f Travis update 2018-06-03 10:35:09 -06:00
Michael Snoyman
f21140ecf0
Merge pull request #1514 from pythonissam/isstring-textarea-instance
Make Textarea derive IsString
2018-06-03 06:29:09 -06:00
pythonissam
22197d1215 Update ChangeLog 2018-06-03 08:27:57 +00:00
pythonissam
b101276dcb version bump 2018-06-03 08:22:09 +00:00
pythonissam
67d215d2f2 Make Textarea derive IsString 2018-06-03 08:18:31 +00:00
Michael Snoyman
4444c47d39 Relax an upper bound 2018-05-29 06:43:14 +03:00
Michael Snoyman
1cf2f56918
Merge pull request #1510 from bsima/form-fns
Move 'addClass' to Yesod.Form.Functions and add 'removeClass'
2018-05-16 06:51:41 +03:00
Ben Sima
1d95f8315b Remove unnecessary type annotation 2018-05-15 12:51:14 -07:00
Ben Sima
e906768ee9 Replace addClass/removeClass examples with ghci-driven examples 2018-05-15 12:50:39 -07:00
Ben Sima
e8a145ae88 Add examples to addClass and removeClass 2018-05-14 08:45:09 -07:00
Michael Snoyman
e041ff4da9
Cabal 2.2 support in yesod-bin (fixes #1511) 2018-05-13 15:14:04 +03:00
Ben Sima
c163a0841a Add PR link to Changelog 2018-05-11 13:36:10 -07:00
Ben Sima
6334e77515 Update changelog 2018-05-11 13:35:12 -07:00
Ben Sima
c57ba49472 Add @since documentation 2018-05-11 13:31:25 -07:00
Ben Sima
0dffa0e29a Bump version 1.6.2 2018-05-11 13:31:25 -07:00
Ben Sima
56ca6d7914 Move 'addClass' to Yesod.Form.Functions and add 'removeClass'
'addClass' is more general than just Bootstrap forms. In particular, it is
copied into the yesod-form-bootstrap4 project and I found myself using it in my
custom forms. It would be useful to have it exported for use elsewhere.

I added 'removeClass' because I needed it while creating a custom 'readonly'
input in a form and thought it might be generally useful.
2018-05-11 13:23:31 -07:00
Michael Snoyman
5861357923
Merge pull request #1503 from ncaq/add-file-source-bytes
added: fileSourceByteString
2018-05-04 08:45:20 +03:00
ncaq
a8df3c48c2 modified: use sinkLazy and toStrict
Because performance problem.
2018-05-01 17:15:13 +09:00
Michael Snoyman
4cd29ae298
Merge pull request #1485 from NorfairKing/with-generator
yesodSpecWithSiteGenerator with an argument
2018-04-30 17:03:13 +03:00
Michael Snoyman
bc4ecd7dc8
Fix broken http-reverse-proxy < 0.6 support 2018-04-26 12:17:00 +03:00
Tom Sydney Kerckhove
0aa1765b6c Updated according to review 2018-04-26 11:00:48 +02:00
Tom Sydney Kerckhove
a8f5418b22 yesodSpecWithSiteGenerator with an argument 2018-04-26 10:50:51 +02:00
Michael Snoyman
07df43f207
Merge branch 'master' of github.com:yesodweb/yesod 2018-04-26 11:20:26 +03:00
Michael Snoyman
e87c9b5bf0
Support for http-reverse-proxy 0.6.0 2018-04-26 11:20:04 +03:00
ncaq
e664ae2e0e changed: use foldC 2018-04-24 12:55:55 +09:00
ncaq
74ce4c57ff Merge branch 'master' into add-file-source-bytes 2018-04-24 12:36:36 +09:00
Michael Snoyman
b92b2a0871
Merge pull request #1504 from ncaq/add-addContentDispositionFileName
added: addContentDispositionFileName
2018-04-18 09:22:10 +03:00
ncaq
f5855c8397 Merge branch 'master' into add-file-source-bytes 2018-04-17 18:58:09 +09:00
ncaq
33b5171b75 modified: fileSourceByteString: use sinkLazy 2018-04-17 18:54:18 +09:00
ncaq
fc7884f7f2 Merge branch 'master' into add-addContentDispositionFileName 2018-04-17 18:49:53 +09:00
ncaq
a59ee6b62e added: ChangeLog 1.6.4 2018-04-17 18:47:54 +09:00
ncaq
eb220c936a added: addContentDispositionFileName: document comment
I wrote battle of multibyte from code review.
2018-04-17 18:44:19 +09:00
Michael Snoyman
df6ca6e59c
Merge pull request #1506 from ncaq/fix-appveyor
fixed: see th-lift-instances-0.1.11
2018-04-17 12:39:56 +03:00
ncaq
2c1a6c609f Merge branch 'master' into add-addContentDispositionFileName 2018-04-17 18:05:46 +09:00
ncaq
1e89f4d4c3 cleaned: fileSourceByteString: document comment
from code review.
2018-04-17 18:01:36 +09:00
ncaq
11159f3a75 cleaned: use runConduit and .| instead of connect
from code review.
2018-04-17 17:58:49 +09:00
ncaq
1eb553f92c Merge branch 'master' into add-file-source-bytes 2018-04-17 17:52:20 +09:00
ncaq
4d7679775a fixed: see th-lift-instances-0.1.11
th-lift-instances-0.1.11 build is Simple.
2018-04-17 17:49:34 +09:00
Michael Snoyman
cf1073d760
Merge pull request #1502 from pythonissam/general-request-method
add performMethod
2018-04-17 10:31:44 +03:00
ncaq
712e8bb475 added: addContentDispositionFileName 2018-04-17 14:33:38 +09:00
ncaq
955b21d7ea added: ChangeLog 1.6.4 2018-04-17 14:24:57 +09:00
ncaq
7e2ca33ed5 added: fileSourceByteString
This function is to get `FileInfo` raw body.
2018-04-17 13:58:15 +09:00
pythonissam
860ef4127a Change the method in the example of performMethod 2018-04-14 06:47:32 +00:00
pythonissam
a9030aa294 make get and post use performMethod 2018-04-14 06:46:38 +00:00
pythonissam
7ad28d227c Update ChangeLog.md 2018-04-14 06:10:59 +00:00
pythonissam
a7d42846b5 add performMethod 2018-04-14 06:08:15 +00:00
Michael Snoyman
06e0ffb48b
Merge pull request #1501 from rnons/getPerson-signature
generalize type signature of GoogleEmail2.getPerson
2018-04-09 16:38:31 +03:00
Ping Chen
fa1248389d bump version and update ChangeLog 2018-04-09 20:48:57 +09:00
Ping Chen
468fba2226 generalize type signature of GoogleEmail2.getPerson 2018-04-09 14:21:48 +09:00
Michael Snoyman
778cf2cf0b
Add missing SubHandlerFor export 2018-04-04 12:11:27 +03:00
Michael Snoyman
ff5618bd15
Merge pull request #1493 from agreif/patch-1
minor doc change
2018-03-05 17:07:27 +02:00
Alex Greif
760b947ed4
minor doc change 2018-03-05 14:09:38 +00:00
Michael Snoyman
e894239563
Add missing version bump 2018-03-05 11:21:53 +02:00
Michael Snoyman
cb229cf84c
Merge pull request #1492 from yesodweb/showRoutes
Derive Show instances for route data structures
2018-03-05 10:17:39 +02:00
Maximilian Tagher
08ef0e26dc Derive Show instances for route data structures
* It's very helpful to have a Show instance for debugging and development
* Currently third party packages are deriving this instance themselves which is not ideal.
    * http://hackage.haskell.org/package/yesod-routes-flow-2.0/docs/src/Yesod-Routes-Flow-Generator.html
    * http://hackage.haskell.org/package/yesod-routes-typescript-0.3.0.0/docs/src/Yesod-Routes-Typescript-Generator.html
    * This change would break those packages, which isn't great
         * At least the typescript one is broken anyway
2018-03-04 15:59:54 -08:00
Michael Snoyman
bdcb4272cd
Merge pull request #1490 from psibi/issue-1489
Remove MINIMAL pragma for authHttpManager
2018-03-04 14:33:47 +02:00
Sibi Prabakaran
ff043db45b
Update changelog 2018-03-04 13:39:31 +05:30
Sibi Prabakaran
c04d6f9ac7
Remove MINIMAL pragma for authHttpManager
We now have a default implementation for it. See this for more
information:
https://github.com/yesodweb/yesod/issues/1489#issuecomment-370200663

Helps in preventing warnings like this:

```
serverside.hs:40:10: warning: [-Wmissing-methods]
    • No explicit implementation for
        ‘authHttpManager’
    • In the instance declaration for ‘YesodAuth App’
   |
40 | instance YesodAuth App where
   |          ^^^^^^^^^^^^^
```
2018-03-04 13:20:21 +05:30
Michael Snoyman
a3f130233b
Relax a number of type signatures #1488 2018-02-20 13:51:36 +02:00
Michael Snoyman
63006970c6
Remove duplicate description field 2018-02-20 13:51:36 +02:00
Maximilian Tagher
f2b651b695
Merge pull request #1482 from pythonissam/bylabel-contain
Bylabel contain
2018-02-10 18:49:13 -08:00
Maximilian Tagher
a0963e77b2
Merge branch 'master' into bylabel-contain 2018-02-09 22:20:02 -08:00
pythonissam
b8f93e6203 Update the version to 1.6.2 2018-02-10 04:16:07 +00:00
kotaro
acf956443d Updated deprecation warnings accordingly 2018-02-10 08:28:24 +09:00
Michael Snoyman
1e9b7ee664
Comment out lts-7 for OS X 2018-02-05 16:14:19 +02:00
Michael Snoyman
7d60a57e5c
Merge branch 'RyanGlScott-master' 2018-02-05 15:38:12 +02:00
Michael Snoyman
8387ba3e23
More extra-deps for lts-7 2018-02-05 14:21:53 +02:00
Michael Snoyman
3014d8028c
Fix compilation in #1484
Pinging @RyanGlScott, these changes were necessary for older versions of
dependencies. Is there any problem with using this for GHC 8.4?
2018-02-05 12:14:54 +02:00
Ryan Scott
3408e1e630 Adapt to Semigroup changes in base-4.11 2018-02-04 20:09:37 -05:00
pythonissam
54614dd241 Update ChangeLog 2018-02-03 08:40:38 +00:00
pythonissam
88a23129fd Version bump 2018-02-03 08:40:38 +00:00
pythonissam
d03e92ff9b Add new fileByLabel-related functions 2018-02-03 08:40:29 +00:00
pythonissam
ed9306323c Add missing fileByLabelWithMatch and make existing fileByLabel-related functions to use it 2018-02-03 08:39:52 +00:00
pythonissam
064f41d9e9 created new byLabel-related functions 2018-02-03 08:39:40 +00:00
Michael Snoyman
450573ac35
Use newer simple-sendfile for Windows compat 2018-02-02 14:33:46 +02:00
Michael Snoyman
ce0c697659
Merge pull request #1464 from yesodweb/better-monads
Better monads
2018-02-02 11:27:06 +02:00
Michael Snoyman
6b660412e9
memory extra-dep 2018-02-02 10:07:45 +02:00
Michael Snoyman
2317e07851
Add foundation as an extra-dep 2018-02-02 09:45:00 +02:00
Michael Snoyman
3ff2f17b2c
cabal builds: comment out longer test part 2018-02-02 09:41:08 +02:00
Michael Snoyman
42e73e0bfd
Add gauge and basement to extra-deps 2018-02-02 00:36:57 +02:00
Michael Snoyman
c2f9dec1e6
Tighten base lower bound
Technically unnecessary since it's inherited from conduit, but this is
more explicit.
2018-02-02 00:35:30 +02:00
Michael Snoyman
5d49a85f40
Travis update 2018-02-02 00:35:21 +02:00
Michael Snoyman
6ad81f6d15
Merge remote-tracking branch 'origin/master' into better-monads 2018-02-02 00:17:37 +02:00
Michael Snoyman
7f78e81cc1
Lower bounds and missing extra-deps 2018-02-02 00:15:24 +02:00
Michael Snoyman
70d606c820
Updated stack.yaml 2018-02-02 00:04:15 +02:00
Michael Snoyman
fe233dd958
Merge pull request #1478 from jprider63/master
Update `mkYesodWith` and refactor so that `mkYesod` uses the context parser
2018-01-29 14:57:44 +02:00
James Parker
8796310eef More documentation for mkYesod and mkYesodWith 2018-01-24 23:55:57 -05:00
Maximilian Tagher
4901d66a52 Add .DS_Store to .gitignore file 2018-01-24 08:33:46 -08:00
Maximilian Tagher
70ecad3829
Merge pull request #1477 from yesodweb/tooLargeResponseErrorMessage
Give more detail in the error message for too large request bodies.
2018-01-24 08:32:58 -08:00
Michael Snoyman
fa8e1ac00f
Switch to SubHandlerFor
This is much more consistent than suddenly using a ReaderT for subsites.
Thanks to @jprider63 for the inspiration for this, I think it cleans
things up a lot!
2018-01-24 13:01:26 +02:00
James Parker
b71bfae261 Refactor so that mkYesod and mkYesodDispatch use the context parser 2018-01-22 00:45:44 -05:00
James Parker
18910b516b Change mkYesodWith to accept separate lists for contexts and type
arguments
2018-01-22 00:19:04 -05:00
Michael Snoyman
0f09393c34
Merge branch 'simple-content-type' of https://github.com/JaSpa/yesod into better-monads 2018-01-21 11:13:05 +02:00
Maximilian Tagher
6b22a0b9be Give more detail in the error message for too large request bodies.
* Just to be helpful to developers, give the maximum body length and their body length
* Also point developers to the function to change that value

(I don't think this leaks any sensitive info, because you can always binary search with different request body sizes to find the maximum allowable)
2018-01-18 18:30:34 -08:00
Janek Spaderna
492102537f [yesod] Bump version & add changelog entry 2018-01-18 12:11:43 +01:00
Janek Spaderna
7f6f1821e8 [yesod] Fix comment for contentTypeTypes & simpler implementation
In the implementation of contentTypeTypes make use of simpleContentType.
2018-01-18 12:00:46 +01:00
Michael Snoyman
6830a9840c
Merge branch 'better-monads' into no-transformers 2018-01-17 06:43:52 +02:00
Michael Snoyman
2047efd00a
Bump persistent version 2018-01-16 20:21:48 +02:00
Michael Snoyman
ad35ef9431
Deal with another sneaky exception 2018-01-16 16:10:23 +02:00
Michael Snoyman
3956110876
Fix yesod-websockets 2018-01-15 21:07:54 +02:00
Michael Snoyman
f2926e60f0
Remove some deprecated methods from the Yesod class 2018-01-15 20:52:33 +02:00
Michael Snoyman
e3bb03f9af
Missing import 2018-01-15 17:56:20 +02:00
Michael Snoyman
dff7f2372e
Switch to SIO 2018-01-15 17:38:36 +02:00
Michael Snoyman
a210ce59d7
Get it all compiling again 2018-01-15 17:08:55 +02:00
Michael Snoyman
915d9e2fa6
Finish switching header key to a CI
Fixes #1418
2018-01-15 16:47:49 +02:00
Michael Snoyman
25acc5799b
Version bumps and changelog updates 2018-01-15 15:57:36 +02:00
Michael Snoyman
89be12c147
Strictify a bunch of fields 2018-01-15 15:18:09 +02:00
Michael Snoyman
60f65ed267
Cleanup warnings 2018-01-15 15:09:07 +02:00
Michael Snoyman
1f7a2a287b
Switch to gauge 2018-01-15 11:46:38 +02:00
Michael Snoyman
8c96b4e36c
Fix benchmark compile 2018-01-15 10:48:50 +02:00
Michael Snoyman
1a1cb8a45f
Drop mwc-random 2018-01-15 10:18:16 +02:00
Michael Snoyman
aa5b80d9f8
Merge branch 'addTypeTime2' of https://github.com/MaxGabriel/yesod into better-monads 2018-01-12 00:19:54 +02:00
Michael Snoyman
6a715c06c3
Merge remote-tracking branch 'origin/guess-approot-default' into better-monads 2018-01-12 00:18:37 +02:00
Michael Snoyman
3bb654857c
Ditch ResumableSource 2018-01-12 00:09:54 +02:00
Michael Snoyman
3e06942449
Simplify YesodSubDispatch 2018-01-11 23:13:32 +02:00
Michael Snoyman
fbccfe2306
Merge branch 'better-monads' into no-transformers 2018-01-11 22:49:02 +02:00
Michael Snoyman
103c098cf8
Catch up with Data.Conduit.Combinators 2018-01-10 12:16:31 -08:00
Michael Snoyman
a16e75249a
More moving over to unliftio 2017-12-31 09:20:02 +02:00
Michael Snoyman
e2b0a5c454
Merge pull request #1474 from yesodweb/documentCustomizingCSRFByRoute
Document whitelisting certain routes to not need CSRF protection
2017-12-31 06:24:39 +02:00
Michael Snoyman
eac95935e6
Switch over to WIP conduit 1.3 2017-12-30 22:47:56 +02:00
Michael Snoyman
8a30e487b0
Merge remote-tracking branch 'origin/master' into better-monads 2017-12-30 20:41:28 +02:00
Michael Snoyman
f9a87f4022
Merge pull request #1473 from yesodweb/fix1459
Fix Haddock syntax error and test failures introduced by #1459
2017-12-30 18:13:41 +02:00
Michael Snoyman
65093b6b24
Merge branch 'master' into fix1459 2017-12-30 18:13:32 +02:00
Michael Snoyman
ed40b136ea
Fix broken Haddocks 2017-12-30 18:06:45 +02:00
Maximilian Tagher
5cdc0a39ac Document whitelisting certain routes to not need CSRF protection
This question came up on the #yesod Slack channel and I think it's moderately common; I've seen it elsewhere.
2017-12-29 23:44:08 -05:00
Maximilian Tagher
51bdb66252 Fix Haddock syntax error and test failures introduced by #1459 2017-12-29 20:20:18 -05:00
Maximilian Tagher
3bf6a89595
Update PULL_REQUEST_TEMPLATE.md 2017-12-29 20:17:48 -05:00
Maximilian Tagher
5af7fe95ec
Merge pull request #1470 from csi-adziahel/patch-1
Fix typo breaking some parsers
2017-12-28 15:23:40 -08:00
Michael Snoyman
3df82600b8
Merge pull request #1459 from pythonissam/bylabel-exact
Bylabel exact
2017-12-27 13:02:42 +02:00
kotaro
daa953ed1f Add PR link into the deprecated pragmas 2017-12-27 09:47:57 +09:00
Andrey Dyagel
8a0778a58a
Fix typo breaking some parsers 2017-12-22 16:15:13 +03:00
Michael Snoyman
5a5cd81276
Support typed-process-0.2.0.0 (fixes #1467) 2017-12-19 11:53:41 +02:00
Michael Snoyman
1b22e6a908
Further transformer cleanup 2017-12-18 17:06:46 +02:00
Michael Snoyman
8e265f6ebc
It all compiles 2017-12-18 15:04:45 +02:00
kotaro
8e52b490fe Insert deprecated pragmas for byLabel and fileByLabel 2017-12-18 14:10:12 +09:00
kotaro
8cf44ff7c8 Small fix of haddock 2017-12-18 13:34:16 +09:00
pythonissam
31903c34f8 fileByLabelExact: Created the exact version of fileByLabel 2017-12-17 08:50:48 +00:00
Michael Snoyman
aed10fc84a
WIP 2017-12-13 14:39:59 +02:00
Michael Snoyman
61c887f501
Start converting yesod-auth over 2017-12-13 13:44:59 +02:00
Michael Snoyman
47ee7384ea
Be gone with ye HandlerT! 2017-12-13 09:53:14 +02:00
Maximilian Tagher
96758a4d58
Merge pull request #1465 from psibi/unsafe-haddock
Fix haddock doc for the Yesod.Core.Unsafe module
2017-12-12 15:14:21 -08:00
Sibi Prabakaran
323d7f4322
Fix haddock doc for the Yesod.Core.Unsafe module 2017-12-13 02:33:37 +05:30
Michael Snoyman
1c2914eded
MonadUnliftIO instances 2017-12-12 12:46:49 +02:00
Michael Snoyman
5c8b1b542a
WidgetT uses IORef 2017-12-12 12:46:35 +02:00
Michael Snoyman
c5ac821115
Remove some conditionals for old versions 2017-12-12 12:08:06 +02:00
Michael Snoyman
64b5bdb347
Merge pull request #1460 from yesodweb/updated-coc
Switch CoC to Contributor Covenant
2017-12-10 18:22:46 +02:00
Michael Snoyman
09ac889376
Merge pull request #1462 from psibi/master
Fixed exposed version number and also haddock syntax for Yesod.Auth module
2017-12-08 12:07:28 +02:00
Sibi Prabakaran
aff72a7365
Fix since markup 2017-12-08 15:33:15 +05:30
Sibi Prabakaran
663220f334
Fix exposed version number and also haddock syntax 2017-12-08 15:30:32 +05:30
Michael Snoyman
c122af25ad
Merge pull request #1461 from LiveViewTech/redirect_to_current
Redirect to current
2017-12-08 09:02:59 +02:00
Casey Allred
e40178a854 adding link to the PR in changelog.md 2017-12-07 14:24:48 -07:00
Casey Allred
108c0c3984 merged master 2017-12-07 14:22:28 -07:00
Casey Allred
30ccfc8089 didn't mean to change this signature 2017-12-07 14:01:36 -07:00
Casey Allred
f82d08b32a add a way to control redirection to current location when redirectLogin is called 2017-12-07 13:56:53 -07:00
Michael Snoyman
f7f2c1edbd
Switch CoC to Contributor Covenant 2017-12-06 16:02:01 +02:00
kotaro
baf30d0c9d Improve comments 2017-12-04 17:12:51 +09:00
pythonissam
699203f5af Update the Changelog 2017-12-02 10:14:24 +00:00
pythonissam
e5c04a0b8e Version bump 2017-12-02 09:57:40 +00:00
pythonissam
db87b76816 Add version info 2017-12-02 09:56:56 +00:00
pythonissam
8f218307be Improve the function name 2017-12-02 09:46:41 +00:00
pythonissam
57e25eaf39 Improve the document 2017-12-02 09:44:49 +00:00
pythonissam
8693c72c41 Remove the original nameFromLabel 2017-12-02 08:05:59 +00:00
pythonissam
70ec8c6823 new function genericNameFromLabel which abstracts the match methods 2017-12-02 08:00:31 +00:00
Maximilian Tagher
c81ad91cd1
Merge pull request #1455 from yesodweb/csrfBetterErrors
Give better error messages when CSRF validation fails
2017-11-26 10:41:02 -05:00
Maximilian Tagher
1275cce1af Give better error messages when CSRF validation fails
* This is important because historically these errors have tripped people up
* Making security as easy as possible is important so that it doesn't just get turned off
* Giving clear directions about where to get the CSRF token (a cookie) and where to send it (a header/param) is especially helpful to frontend developers not necessarily familiar with the backend codebase
2017-11-26 09:00:30 -05:00
Michael Snoyman
18de949b03
Merge pull request #1457 from bermanjosh/langFix
Fix docs on `languages` set and `getMessageRender` to use it (#1325)
2017-11-26 12:40:56 +02:00
Josh Berman
6d6afcf826 point changelog to PR not issue 2017-11-26 12:09:17 +02:00
Josh Berman
79ab662a80 Fix docs on languages set and getMessageRender to use it (#1325) 2017-11-26 11:52:37 +02:00
pythonissam
80aa45cf18 Simply, create the exact version of byLabel 2017-11-26 07:22:25 +00:00
pythonissam
cab78b65c2 Add a failure test case for byLabel 2017-11-26 04:45:02 +00:00
Maximilian Tagher
c21e77947c
Merge pull request #1456 from eborden/eborden/fix-constraints-on-get404
Fix constraints on get404 and getBy404
2017-11-17 14:13:33 -08:00
Evan Rutledge Borden
cfb8fd9b21 Version bump for get404 and getBy404 constraint changes. 2017-11-17 14:41:57 -05:00
Evan Rutledge Borden
33d3200399 Fix constraints on get404 and getBy404
The constraints on `get404` and `getBy404` were overly powerful. They were
constrained by `PersistStore` and `PersistStoreUnique`, which is an alias for
`PersistStoreWrite...`. These only need `PersistStoreRead...` to accomplish
their job.
2017-11-17 14:28:20 -05:00
Maximilian Tagher
d848a7123f
Merge pull request #1451 from yesodweb/githubTemplates
Add Github issue and PR templates, plus contributing guidelines
2017-11-16 09:28:22 -08:00
Maximilian Tagher
8208e3deac
Fix typo in Haddocks of assertEq 2017-11-15 11:32:59 -08:00
Maximilian Tagher
3247237c44 Respond to @psibi's comments 2017-11-08 22:43:51 -08:00
Maximilian Tagher
7a4b2812c1 Update contributing guidelines based of Snoyberg's "How to Send Me a PR" post 2017-11-08 22:32:15 -08:00
Alex Greif
2c59cb7dcd extend docs of defaultMaybeAuthId (#1453)
* extend docs of defaultMaybeAuthId

make more explicite that on each call a database access is done. This can be of relevance and sometimes redundant with other Handler functionality

* Update Auth.hs
2017-11-08 12:36:39 +00:00
Michael Snoyman
abc50deffe
Drop an upper bound 2017-11-07 06:03:59 +02:00
Maximilian Tagher
42b94f5066 Add Github issue and PR templates, plus contributing guidelines
* Closes #1450
2017-11-02 20:27:24 -07:00
Sibi
299d0569af Merge pull request #1446 from bigs/extensible-password-hashing
Extend `YesodAuthEmail` to support extensible password hashing
2017-10-01 22:31:16 +05:30
Cole Brown
600d307310 Extend YesodAuthEmail to support extensible password hashing.
This change introduces `hashAndSaltPassword` and `verifyPassword` to the
`YesodAuthEmail` type class, allowing users to implement their own hashing
schemes (i.e. to provide compatibility with an existing database). It also
updates the default handlers to use these new functions when appropriate. The
functions have default implementation such that behavior for legacy applications
should not change.
2017-09-28 14:37:21 -04:00
Michael Snoyman
4f6b07c2fb Merge pull request #1444 from iand675/weak-etag
Add support to yesod-core for weak etags
2017-09-10 14:53:52 +03:00
Ian Duncan
05b2193e9f
Code review fixes for #1444 2017-09-08 09:00:12 +09:00
Michael Snoyman
c4ef7e1410
yesod-form version bump 2017-09-06 18:28:00 +03:00
Ian Duncan
fd872cff40
Add support to yesod-core for weak etags 2017-09-06 10:08:45 +09:00
Michael Snoyman
d6e4499c54 Merge pull request #1439 from binarysunrise-io/login-vs-log-in
Correct Yesod-Auth's usage of "log in" vs "login" in English.
2017-08-31 07:58:52 +03:00
Jesse Kempf
9edca8e3b5 Correct Yesod-Auth's usage of "log in" vs "login" in English.
"Log in" (two words) is a verb, indicating the action of, well, logging
in. "Login" (one word) is a noun, indicating the credentials used to log
in.
2017-08-30 20:40:29 -07:00
Sibi
498d373e2d Merge pull request #1437 from paul-rouse/master
Expose Yesod.Auth.Util.PasswordStore
2017-08-30 07:57:58 +05:30
Paul Rouse
3c53acdad8 Add "@since" comments for newly exposed Yesod.Auth.Util.PasswordStore 2017-08-29 18:49:21 +01:00
Paul Rouse
464b055568 Expose Yesod.Auth.Util.PasswordStore 2017-08-29 13:40:32 +01:00
Paul Rouse
59f073a41f Pure move of Yesod.PasswordStore to Yesod.Auth.Util.PasswordStore 2017-08-29 13:34:20 +01:00
Sibi
c7736db69a Merge pull request #1435 from Ephemera/translation
Add Korean translation
2017-08-26 14:04:33 +05:30
GyuYong Jung
1569af55c7 Add Korean translation 2017-08-26 05:27:53 +09:00
Michael Snoyman
a1c7fc5281 Merge pull request #1433 from binarysunrise-io/form-result-instantiate-alternative
Give FormResult an Alternative instance
2017-08-23 08:44:59 +03:00
Jesse Kempf
f08944d888 Give FormResult an Alternative instance 2017-08-22 22:00:42 -07:00
Michael Snoyman
4f14b9b82d
Add a stricter lower bound 2017-08-22 11:25:51 +03:00
Michael Snoyman
1e9427baee
Version bump 2017-08-22 11:24:35 +03:00
Michael Snoyman
469c1c2d01 Merge pull request #1432 from stackbuilders/reduce_verbosity_using_monadic_forms
Reduce verbosity using Monadic Forms
2017-08-22 10:41:00 +03:00
Sebastián Estrella
0f28604cfe Reduce verbosity using Monadic Forms 2017-08-22 02:24:26 -05:00
Michael Snoyman
f65d88d8c5 Merge pull request #1427 from alx741/fix-spanish-trans
Fix auth messages Spanish translation
2017-08-08 19:16:58 +03:00
Daniel Campoverde
e3041aa17b Fix auth messages Spanish translation 2017-08-08 11:03:09 -05:00
Michael Snoyman
896ee9c644
Version bump and close #1413 2017-08-04 16:30:58 +03:00
GyuYong Jung
854f823059 add src/ to file path if Haskell source files in src
Fixes #1413
2017-08-04 15:40:28 +09:00
Michael Snoyman
3b8ca1d3d1
Bad CPP 2017-08-04 08:12:55 +03:00
Michael Snoyman
a4eee30930
Cabal 2.0 support 2017-07-31 09:55:19 +03:00
Sibi
e027652494 Merge pull request #1417 from psibi/header-yesod
Add replaceOrAddHeader function to Yesod.Core.Handler module
2017-07-28 18:35:23 +05:30
Sibi Prabakaran
7cfefdf3fa
Merge remote-tracking branch 'origin/master' into header-yesod
Conflicts resolved in:
	yesod-core/ChangeLog.md
	yesod-core/yesod-core.cabal
2017-07-28 17:01:03 +05:30
Sibi Prabakaran
19ff5c2006
Fix warning in test code 2017-07-28 16:58:11 +05:30
Michael Snoyman
a17779b12d
Fix persistent < 2.5 code 2017-07-23 16:53:12 +03:00
Michael Snoyman
ada76a9636
Revert "Always use solver on Travis"
This reverts commit 5b18bf0c09.
2017-07-23 16:45:47 +03:00
Michael Snoyman
5b18bf0c09
Always use solver on Travis 2017-07-23 16:28:58 +03:00
Michael Snoyman
fff8f8ff5f
Reduce extra-deps, drop LTS 2 and 3 2017-07-23 13:04:40 +03:00
Michael Snoyman
4b34fe9c72
Fix deprecation warning for LTS 8 2017-07-23 12:25:29 +03:00
Michael Snoyman
626719ce28
Fix some version issues 2017-07-23 11:10:47 +03:00
Michael Snoyman
8e367bda3d
Bump to LTS 8 2017-07-23 10:31:51 +03:00
Michael Snoyman
fefe8e0219
Attempt to get Travis building again 2017-07-23 09:34:15 +03:00
Michael Snoyman
42112add3c
Version bump 2017-07-23 07:27:14 +03:00
Michael Snoyman
39c0e0977b
Merge branch 'master' of github.com:yesodweb/yesod 2017-07-23 07:13:24 +03:00
Michael Snoyman
c05c2ddde6 Merge pull request #1424 from QuLogic/yesod-static-cryptonite
Convert yesod-static to cryptonite.
2017-07-23 07:12:22 +03:00
Elliott Sales de Andrade
087f4d2092 Convert yesod-static to cryptonite. 2017-07-22 22:58:23 -04:00
Michael Snoyman
06ca675bb6
Version bump 2017-07-20 13:58:15 +03:00
Michael Snoyman
eb3c570c93 Merge pull request #1421 from sestrella/add_has_call_stack_to_assertions
Add implicit param HasCallStack to assertions
2017-07-20 13:41:37 +03:00
Sebastián Estrella
a58a4d88cd Add implicit param HasCallStack to assertions 2017-07-19 22:47:00 -05:00
Sibi Prabakaran
617591aa4e
Do case insensitive equality on header name 2017-07-14 13:44:21 +05:30
Sibi Prabakaran
89fc6c46e2
Fix ordering logic in replaceHeader function 2017-07-13 16:29:08 +05:30
Sibi Prabakaran
f3ed12ed81
Add additional test to make sure that header value is not lost 2017-07-13 12:43:16 +05:30
Sibi Prabakaran
18951b0de7
Update the replace logic to obey proper ordering 2017-07-13 12:42:30 +05:30
Sibi Prabakaran
8416bb6569
Add Haddock documentation for the added function 2017-07-13 11:27:03 +05:30
Sibi Prabakaran
a31c270893
Update Changelog and do verion bump of the package 2017-07-13 11:24:57 +05:30
Sibi Prabakaran
3cec499c85
ScopedTypeVariables is also needed 2017-07-13 11:17:03 +05:30
Sibi Prabakaran
4e0b084df2
Enable test in YesodCoreTest 2017-07-13 11:16:47 +05:30
Sibi Prabakaran
839b56b032
Implement replaceOrAddHeader function 2017-07-13 11:10:54 +05:30
Sibi Prabakaran
301f4bc630
Expose YesodCoreTest.Header module 2017-07-13 11:07:13 +05:30
Sibi Prabakaran
051339f3dc
Add test code for HTTP headers properties 2017-07-13 11:05:57 +05:30
Michael Snoyman
7038ae6317 Merge pull request #1414 from bermanjosh/th-ghc-8.2.1-rc2
Work with TH from GHC 8.2.1-rc2
2017-07-04 08:58:58 +03:00
Josh Berman
ec85ef735c Work with TH from GHC 8.2.1-rc2 2017-07-03 06:44:25 -04:00
Michael Snoyman
432c31a652 Merge pull request #1412 from ncaq/master
fixed: yesod-form: textareaField: writeHtmlEscapedChar: convert "\r\n" to "<br>" closed #1354
2017-06-25 08:34:50 +03:00
ncaq
e19d220f61 fixed: import Data.Monoid for old ghc 2017-06-23 12:14:28 +09:00
ncaq
33471cbb2f add changelog and version number 2017-06-22 16:32:50 +09:00
ncaq
d5eb1ce026 fixed: yesod-form: textareaField: writeHtmlEscapedChar: convert "\r\n" to "<br>" 2017-06-22 10:05:39 +09:00
Maximilian Tagher
0223c0a586 Merge pull request #1408 from mwotton/master
add clickOn function (closes #1405)
2017-06-21 15:50:12 -07:00
Mark Wotton
c40d39dc5a one more since 2017-06-21 15:12:03 -04:00
Mark Wotton
7cd37db7c6 address review comments 2017-06-15 15:46:25 -04:00
Mark Wotton
1bc30deee7 import Control.Applicative for 7.8.4 2017-06-15 13:30:58 -04:00
Mark Wotton
2a112b5516 -Werror fixes 2017-06-15 12:17:49 -04:00
Mark Wotton
ee9ef1eac5 add clickOn function (closes #1406) 2017-06-14 13:40:44 -04:00
Michael Snoyman
2ade837223 Merge pull request #1404 from iand675/master
Add support to for mapping static unfingerprinted files to their fingerprinted equivalents
2017-06-07 16:01:48 +03:00
Ian Duncan
274b5445a1
Code review fixes for #1404 2017-06-07 20:13:04 +09:00
Ian Duncan
ded136513c
Add support to yesod-static for mapping unfingerprinted files to their fingerprinted equivalents 2017-06-06 15:21:25 +09:00
Michael Snoyman
0b1a4b114c Merge pull request #1366 from jprider63/dev.jp
Contexts can be parsed and included in instances. Standalone deriving…
2017-06-05 11:33:11 +03:00
James Parker
70f643b7e9 Merge branch 'master' of https://github.com/yesodweb/yesod into dev.jp 2017-06-01 11:24:54 -04:00
Sibi
6630c05937 Merge pull request #1399 from psibi/cryptonite
Move yesod-auth to Cryptonite (from cryptohash)
2017-05-26 01:07:45 +05:30
Sibi Prabakaran
ec90f48d88
Fix lts-2 related errors 2017-05-21 19:53:28 +05:30
Sibi Prabakaran
37452896d2
Try fixing travis error 2017-05-18 19:17:55 +05:30
Sibi Prabakaran
635470f750
Change cabal install version 2017-05-18 13:32:35 +05:30
Sibi Prabakaran
36a98bc4ab
Add memory to stack yaml for lts-2 2017-05-18 12:06:36 +05:30
Sibi Prabakaran
4ba2fc8494
Add foundation to stack.yaml 2017-05-18 09:50:47 +05:30
Sibi Prabakaran
d56485c3d3
Cryptonite 2017-05-18 09:46:44 +05:30
Sibi Prabakaran
cc1fa42192
Update travis to use ghc-8.0.2 instead of 8.0.1 2017-05-18 09:46:04 +05:30
Sibi Prabakaran
8f5b0bc238
Do version bump and add Changelog
Partially addresses #1397
2017-05-18 08:43:29 +05:30
Sibi Prabakaran
f1fb571427
Make relevant changes to cabal file for yesod-auth 2017-05-18 08:18:53 +05:30
Sibi Prabakaran
92849d863c
Port to cryptonite 2017-05-18 08:18:39 +05:30
Michael Snoyman
5721f65ebf
Version bumps 2017-05-14 00:24:12 +03:00
Michael Snoyman
602d1ff06a Merge pull request #1394 from mchaver/add-waisubsitewithauth
Add WaiSubsiteWithAuth
2017-05-12 08:25:56 +03:00
James Haver II
5ee51262de Update ChangeLog and Hackage comments 2017-05-12 01:04:13 +08:00
James Haver II
56b09eef93 Add WaiSubsiteWithAuth 2017-05-12 00:13:07 +08:00
Sibi
aeec20592c Merge pull request #1387 from steshaw/static-files-list-haddock-tweak
Fix Haddock formatting for staticFilesList
2017-05-05 05:40:47 +05:30
Steven Shaw
13cea1e3f7 Fix Haddock formatting for staticFilesList 2017-05-04 11:54:17 +10:00
Sibi
b9e57a1a60 Merge pull request #1381 from psibi/yesod-deadlock-2
Fixing race condition in yesod-bin
2017-04-27 20:13:47 +05:30
Sibi Prabakaran
5bb5e8948f
Revert back yesod version 2017-04-27 18:03:39 +05:30
Sibi Prabakaran
3350ca3d9a
Remove flag conditional 2017-04-27 17:49:21 +05:30
Sibi Prabakaran
10b5d4f8e2
Remove debug option 2017-04-27 17:40:32 +05:30
Sibi Prabakaran
67eb728703
Make updateAppPort as a single STM transaction 2017-04-27 17:08:12 +05:30
Sibi Prabakaran
35e0095590
Add releavant flag in yesod-bin 2017-04-26 20:57:13 +05:30
Sibi Prabakaran
37c9d25990
Add Debug flag 2017-04-26 20:56:58 +05:30
Sibi Prabakaran
706de89156
Change logic to use TVar 2017-04-26 19:37:59 +05:30
Sibi Prabakaran
62d7a19149
Fix warnings 2017-04-24 21:51:13 +05:30
Sibi Prabakaran
c37283e300
Update Changelog and do version bump 2017-04-24 20:39:20 +05:30
Sibi Prabakaran
878534a272
Fix race condition in yesod-bin
Stack build process emittles line even after successful build process
which leads to the overwriting of the appPortVar with -1. This leads
it to a compile mode again. Pressing Return Key and rebuilding it
again makes it go, but that's just a workaround I have to do every now
and then to solve the actual issue.

I'm using a `MVar` based locking solution for fixing the race
condition introduced.
2017-04-24 20:33:52 +05:30
Michael Snoyman
bc3054bfa2 Merge pull request #1378 from dawei-dev/patch-1
Fix minor doc typo
2017-04-17 20:17:42 +03:00
Dawei LIU
fcb1b7f6b4 Fix minor doc typo 2017-04-17 15:25:03 +02:00
Michael Snoyman
abf1c1ac5f Merge pull request #1376 from alanz/patch-1
GHC 7.6 not supported
2017-04-13 08:18:49 +03:00
Alan Zimmerman
01d5f02cee GHC 7.6 not supported 2017-04-12 19:31:40 +02:00
Michael Snoyman
3229b7ad93
persistent 2.7 2017-04-12 11:02:27 +03:00
Sibi
0d5b8b884f Merge pull request #1375 from amitaibu/assertNotEq
Add assertNotEq
2017-04-12 09:03:29 +05:30
Amitai Burstein
b8d2647a6a Add assertNotEq 2017-04-11 20:46:49 +03:00
rkaminsk
d8919c2c2d remove value attribute from password field (#1374)
remove value attribute from password field

Fixes https://github.com/yesodweb/yesod/issues/1373
2017-04-09 06:14:39 +05:30
Sibi
5a37a52080 Merge pull request #1371 from dfordivam/master
Japanese message for Current password
2017-04-05 07:34:47 +05:30
Divam
c1fa2645c0 Japanese message for Current password 2017-04-05 10:07:09 +09:00
Sibi
6b4139672e Merge pull request #1369 from mingyuguo/master
Added Yesod.Form.I18n.Chinese, also cleaned up chineseMessage in Yesod.Auth.Message
2017-03-28 17:30:07 +05:30
mingyu guo
db9b51cdf4 Added Yesod.Form.I18n.Chinese 2017-03-28 20:59:48 +10:30
mingyu guo
757514c536 Completed chineseMessage in Yesod.Auth.Message. Previously, most of the
messages are using simplified characters, but the google translated parts are
using traditional characters. I have fixed this as well.
2017-03-28 20:40:05 +10:30
JP
db8bbcd8b5 Merge branch 'master' into dev.jp 2017-03-27 12:10:04 -04:00
James Parker
6b000ecfb4 Version bump and fix for old versions of TH. 2017-03-27 12:06:44 -04:00
James Parker
997714f4c2 Accept multiple argument types inside brackets 2017-03-27 02:42:47 -04:00
James Parker
adf89bcf84 Contexts can be parsed and included in instances. Standalone deriving is used when
a context is provided. Type variables can be included in routes/TH.
2017-03-27 00:10:32 -04:00
Michael Snoyman
de9f5bc4c9
Version bump for #1363 2017-03-26 18:14:40 +03:00
Michael Snoyman
5b5e411cb5 Merge pull request #1363 from jprider63/master
Adds curly brackets to route parser.
2017-03-26 18:13:48 +03:00
Michael Snoyman
52d4a32217
Add curl for AppVeyor 2017-03-23 11:40:27 +02:00
James Parker
6c7a40ea5b Adds curly brackets to route parser. 2017-03-22 18:30:08 -04:00
Michael Snoyman
039046e355
Another Nix workaround (fixes #1359) 2017-03-15 06:42:12 +02:00
Michael Snoyman
c91f92a829 Merge pull request #1360 from dfordivam/master
Fix yesod-websockets/sample.hs example
2017-03-15 06:29:29 +02:00
Divam
85496411f2 Fix yesod-websockets/sample.hs example 2017-03-15 11:54:45 +09:00
Michael Snoyman
182b87e2d4
Version bump 2017-03-07 11:15:11 +02:00
Michael Snoyman
4f30dfca1e
Use --no-nix-pure #1357 2017-03-05 19:12:14 +02:00
Michael Snoyman
55623b76f6 Improve ChangeLog 2017-03-01 08:53:13 +02:00
Michael Snoyman
44675b3664 Merge pull request #1356 from LightAndLight/yesod-form/convertField-docs
Fixed some spelling issues in `Yesod.Form.Functions.convertField` documentation
2017-02-28 10:36:48 +02:00
Isaac Elliott
b76d9c3090 Fixed spelling and wording for Yesod.Form.Functions.convertField's docs 2017-02-28 17:50:20 +10:00
Michael Snoyman
3f9cbf2ff9 Switch to copyright year range #617 2017-02-27 09:47:45 +02:00
Michael Snoyman
40d3b5d2d4 Merge pull request #1355 from madnight/patch-1
Update license to 2017
2017-02-26 10:46:46 +02:00
Fabian Beuke
ab7428b1be Update license to 2017 2017-02-25 21:33:28 +01:00
Sibi
a0088c598b Merge pull request #1346 from alx741/email
Allow for a  custom Email login widget
2017-02-23 19:07:51 +05:30
Daniel Campoverde [alx741]
9014192c66 Update changelog 2017-02-18 18:31:05 -05:00
Daniel Campoverde [alx741]
ea5e1cca26 Update emailLoginHandler 'since' version 2017-02-18 18:28:53 -05:00
Daniel Campoverde [alx741]
c5ddf55937 Update emailLoginHandler 'since' version 2017-02-18 15:14:45 -05:00
Daniel Campoverde [alx741]
c78ae95b3a Fix email auth module 2017-02-18 15:14:45 -05:00
Daniel Campoverde [alx741]
311f7927bb Merge branch 'master' of https://github.com/yesodweb/yesod 2017-02-18 15:14:31 -05:00
Michael Snoyman
1cc30efe41 Merge pull request #1353 from psibi/add-post-function
Add getPostParams function in Yesod.Core.Handler
2017-02-17 08:00:49 +02:00
Sibi Prabakaran
6d7ba59e4b
Update changelog 2017-02-17 00:22:57 +05:30
Sibi Prabakaran
470858f81c
Better Haddock rendering. Since -> @since 2017-02-17 00:21:31 +05:30
Sibi Prabakaran
797278243e
Add and export getPostParams function 2017-02-17 00:18:17 +05:30
Michael Snoyman
4327dac8a7 For nightly, build cabal-install 2017-02-08 13:35:31 +02:00
Michael Snoyman
e032785af9 Another missing --install-ghc 2017-02-08 11:46:08 +02:00
Michael Snoyman
cdc6c8ae04 Version bumps/changelog updates 2017-02-08 11:20:31 +02:00
Michael Snoyman
86411d25f2 Silly typo 2017-02-08 09:08:10 +02:00
Michael Snoyman
305931f322 Not pedantic on OS X (since it applies to deps too) 2017-02-08 08:13:35 +02:00
Michael Snoyman
e83d018002 Add missing --install-ghc 2017-02-08 07:01:17 +02:00
Michael Snoyman
fc9d45aa33 Nightly: use solver --update-config 2017-02-07 21:05:44 +02:00
Michael Snoyman
58119d90cc Another build speed-up attempt
* Don't do the pre-build
* Apply --fast to dependencies on OS X
2017-02-07 21:02:26 +02:00
Michael Snoyman
b55b919800 Revert "Allow latest nightly"
This reverts commit 9ee3c37074.
2017-02-07 20:48:43 +02:00
Michael Snoyman
16924f6603 Merge branch 'allow-latest-nightly' 2017-02-07 20:48:12 +02:00
Michael Snoyman
a53d2cecf5 Try using cabal-head to work around haskell/cabal#4298 2017-02-07 19:00:48 +02:00
Michael Snoyman
9ee3c37074 Allow latest nightly 2017-02-07 17:18:21 +02:00
Michael Snoyman
4920ca11eb Merge pull request #1342 from yesodweb/appveyor
Add appveyor.yml
2017-02-07 17:17:20 +02:00
Michael Snoyman
1bc1ef5a35 Fix a CR test failure 2017-02-07 16:19:08 +02:00
Michael Snoyman
954f813569 Fix route parsing for CRLF line endings 2017-02-07 15:49:23 +02:00
Michael Snoyman
e90b31bb4a Add appveyor.yml 2017-02-07 15:49:23 +02:00
Michael Snoyman
958bc58153 Merge pull request #1345 from psibi/export-pid
Export plugin identifier for GoogleEmail2 module
2017-02-07 14:21:59 +02:00
Daniel Campoverde [alx741]
276a9f1321 Add and export defaultEmailLoginHandler 2017-02-06 16:15:38 -05:00
Sibi Prabakaran
d1ec382fc6
Better haddock rendering: Since -> @since 2017-02-07 01:01:05 +05:30
Sibi Prabakaran
854e0e45e7
Update relevant changelog 2017-02-07 01:00:19 +05:30
Sibi Prabakaran
dddae24786
Export plugin identifier for GoogleEmail2 module 2017-02-07 01:00:00 +05:30
Michael Snoyman
01378311f8 Merge pull request #1343 from psibi/show-creds
Add Show Instance For Creds type
2017-02-06 10:14:57 +02:00
Sibi Prabakaran
6f1356f2a1
Update changelog 2017-02-05 20:27:00 +05:30
Sibi Prabakaran
0c3e1d2299
Derive Show for Creds type
Useful for doing liftIO $ print inside Yesod handlers like
authenticate.
2017-02-05 20:25:23 +05:30
Michael Snoyman
52f67fb04b Merge pull request #1341 from yesodweb/pedantic
Compile with -Wall -Werror
2017-02-05 14:37:19 +02:00
Michael Snoyman
aefd074efa Cleanup GHC 8 redundant constraints 2017-02-05 13:35:12 +02:00
Michael Snoyman
3dc2d10b30 Compile with -Wall -Werror 2017-02-05 12:09:18 +02:00
Michael Snoyman
07147f42c2 Try to speed up OS X builds 2017-02-03 13:05:06 +02:00
Michael Snoyman
1920604d67 Merge pull request #1340 from jprider63/master
Fix for bug in identifyForm with empty forms.
2017-02-02 09:49:04 +02:00
James Parker
d59344b78b housekeeping 2017-02-02 01:55:00 -05:00
Michael Snoyman
64ed0792bc Check mime-type for JSON bodies #1330 2017-02-02 08:10:19 +02:00
Michael Snoyman
db883f19b8 Fix some whitespace 2017-02-02 07:43:55 +02:00
James Parker
ef22b131f1 Fix for bug in identifyForm with empty forms. #1072 2017-01-31 16:06:40 -05:00
Michael Snoyman
5e84a6c063 Merge pull request #1338 from tolysz/websockets-options
yesod-websockets: add `webSocketsOptions` `webSocketsOptionsWith`
2017-01-19 15:54:21 +02:00
Marcin Tolysz
e7e2caeacf yesod-websockets: add webSocketsOptions webSocketsOptionsWith 2017-01-19 11:13:34 +00:00
Michael Snoyman
6d03e6beed Merge pull request #1336 from LightAndLight/master
Fixed misspelling of 'utilities'
2017-01-15 11:06:03 +02:00
Isaac Elliott
2d98587cce Fixed misspelling of 'utilities' 2017-01-15 18:34:16 +10:00
Michael Snoyman
33f58e2bd1 Allow vector 0.12 2017-01-09 00:10:45 +02:00
Michael Snoyman
42e0e9aab9 Merge pull request #1329 from ocharles/master
yesod-core: Build with template-haskell-2.12.0
2017-01-04 16:18:13 +02:00
Ollie Charles
57a9420d99 yesod-core: Build with template-haskell-2.12.0 2017-01-04 13:08:09 +00:00
Michael Snoyman
5469e38d43 Travis: switch language to generic 2017-01-03 20:46:34 +02:00
Michael Snoyman
38fec7f8b8 Reduce dependencies 2017-01-03 12:45:11 +02:00
Michael Snoyman
6d3c530ab8 Merge pull request #1326 from psibi/verkey
Change the type signature from Text to Verkey
2017-01-02 09:40:56 +02:00
Sibi Prabakaran
4330461033
Change the type signature from Text to Verkey
Since the other type signatures of the typeclass has VerKey instead of
Text, it would be better to use VerKey here also to maintain
consistency. Also, IMO this signature is more easy to follow ( I had to
look at source to see how the verification key was generated. )
2016-12-30 18:06:40 +05:30
Michael Snoyman
705b52f7eb Add --host option to yesod devel (fixes #975) 2016-12-21 14:27:52 +02:00
Michael Snoyman
9dbbe030de Fix compatibility with older persistent #1324 2016-12-20 15:21:36 +02:00
Michael Snoyman
8d85ad1ab5 Merge pull request #1321 from whittle/insert400
Add insert400 and insert400_
2016-12-12 19:06:54 +02:00
Jason Whittle
2e284bbe64 Add notes to changelog for yesod-persistent 1.4.1.0. 2016-12-12 08:23:16 -05:00
Jason Whittle
d526658c7b Implement the changes requested by @snoyberg. 2016-12-12 08:18:25 -05:00
Jason Whittle
c573f02d9d Add insert400 and insert400_, which check for violated uniqueness constraints. 2016-12-12 01:54:27 -05:00
Michael Snoyman
b9ece6f242 Merge pull request #1319 from psibi/auth-json-doc
Add documentation for JSON endpoints for Yesod.Auth.Email module
2016-12-08 07:00:08 -05:00
Sibi Prabakaran
08f994103a
Add documentation for JSON endpoints for Yesod.Auth.Email module 2016-12-08 14:25:08 +05:30
Michael Snoyman
9a484f9163 defaultMessageWidget 2016-12-07 20:08:47 -05:00
Michael Snoyman
706a995b67 blaze-markup in extra-deps 2016-12-07 09:42:26 -05:00
Michael Snoyman
98854b4de3 Version bump for #1317 2016-12-07 09:23:53 -05:00
Michael Snoyman
d7be78f82e Merge pull request #1317 from psibi/json-auth
JSON endpoints for Auth.Email, haddock, and i18n fix
2016-12-07 09:23:00 -05:00
Michael Snoyman
03c1ee4807 Compilation fix for GHC 7.8 2016-12-07 08:54:53 -05:00
Michael Snoyman
ae7dfd2408 Changelog for #1310 2016-12-07 08:52:55 -05:00
Michael Snoyman
f54b924137 Merge pull request #1318 from s9gf4ult/master
Exports some internals and fix version bounds
2016-12-07 08:50:52 -05:00
Aleksey Uimanov
80f0b3cd70 Add comments and bump minor version to 1.4.29 2016-12-07 14:04:51 +05:00
Sibi Prabakaran
60f66b4c3a
Add relevant changelog 2016-12-07 14:09:01 +05:30
Sibi Prabakaran
8f8c99db88
Do parseJsonBody only when form data is not found 2016-12-07 14:08:37 +05:30
Sibi Prabakaran
0255f93c22
Export croatianMessage 2016-12-06 18:44:46 +05:30
Sibi Prabakaran
47b2877c79
More Haddock fixes 2016-12-06 18:44:38 +05:30
Sibi Prabakaran
75df4e0468
Use @since for proper haddock rendering 2016-12-06 18:21:36 +05:30
Sibi Prabakaran
83575e92a0
Fix typo: /s/interoprate/interoperate 2016-12-06 18:20:18 +05:30
Sibi Prabakaran
85bd15d109
Add json support for postPasswordR 2016-12-06 18:17:19 +05:30
Sibi Prabakaran
b6cd72f49f
Implement Login via JSON endpoint
Add additional handling of JSON endpoint in addition to the HTML form
method.
2016-12-06 15:20:51 +05:30
Aleksey Uimanov
47ef36012d export getGetMaxExpires 2016-12-05 19:33:04 +05:00
Sibi Prabakaran
19840cdc89
Add json support for postRegisterR 2016-12-05 19:32:23 +05:30
Aleksey Uimanov
2bd3a936c9 fix blaze-markup version bounds 2016-12-02 16:26:19 +05:00
Aleksey Uimanov
d1697a3fde export toWaiAppYre 2016-12-02 15:55:09 +05:00
Michael Snoyman
9c38a4b08e Version bump for #1314 2016-12-01 06:53:41 +02:00
Jason Whittle
7b12f61a91 yesod-test: add getLocation test helper. 2016-11-30 18:05:48 -05:00
Michael Snoyman
fbdaa2f675 Add since lines 2016-11-30 19:36:29 +02:00
Michael Snoyman
312adc40d5 Version bump for #1310 2016-11-30 13:40:46 +02:00
Michael Snoyman
51a5641435 Merge pull request #1310 from yesodweb/text_toWidget
Add ToWidget instances for strict text, lazy text, and text builder
2016-11-30 13:39:59 +02:00
Michael Snoyman
a337bf6d58 websockets 0.10 support 2016-11-30 06:42:15 +02:00
Michael Snoyman
58407c292e Fix a build failure 2016-11-29 13:51:02 +02:00
Michael Snoyman
2c4e19e0b6 Version bump for #1309 2016-11-29 13:48:42 +02:00
Michael Snoyman
00cf852216 Version bump for #1308 2016-11-29 13:47:33 +02:00
Michael Snoyman
a921d6cb31 Add caveat about possible Docker integration issues 2016-11-29 13:44:46 +02:00
Michael Snoyman
784f04ae7a Merge branch '1304-stack-based-devel' 2016-11-29 13:43:01 +02:00
Michael Snoyman
3883063ec2 Devel server indicates when recompilation is occurring
Pinging @amitaibu
2016-11-28 09:58:48 +02:00
Andrew Martin
1781699cab Add ToWidget instances for strict text, lazy text, and text builder 2016-11-27 15:27:54 -05:00
Michael Snoyman
ed87ded970 Merge pull request #1308 from sbditto85/default_attrs_julius
added jsAttributes for the script tag generated by julius files
2016-11-27 05:45:48 +02:00
Michael Snoyman
3159745ee8 Merge pull request #1309 from filipg/master
remove invalid Google OpenID link
2016-11-27 05:44:26 +02:00
Casey Allred
9458e57a58 adjusted to use *{..} syntax 2016-11-26 12:07:49 -07:00
Filip Gralinski
a3929aa9bb remove invalid Google OpenID link 2016-11-26 19:39:24 +01:00
Michael Snoyman
b1f1e4e222 Revert to runghc 2016-11-26 17:57:32 +02:00
Casey Allred
cec6f42a99 added jsAttributes for the script tag generated by julius files 2016-11-25 21:36:51 -07:00
Michael Snoyman
f3fc735a25 README.md, and some minor code cleanups 2016-11-24 07:51:54 +02:00
Michael Snoyman
ab4d6540ca Workaround for compatibility with older fsnotify 2016-11-23 15:59:58 +02:00
Michael Snoyman
6048a2c9bf Got my logic backwards :( 2016-11-23 15:34:14 +02:00
Michael Snoyman
db3beff4f3 Some CPP for Cabal API changes 2016-11-23 15:19:27 +02:00
Michael Snoyman
03307a8cc8 Fix dependency problems for older snapshots 2016-11-23 15:05:41 +02:00
Michael Snoyman
83d3a12a23 Rewrite yesod devel based on Stack #1304
Please see ChangeLog for explanation.
2016-11-23 13:59:56 +02:00
Maximilian Tagher
54cc4205d8 Merge pull request #1302 from psibi/csrf-fix
yesod-auth: Fix CSRF security vulnerability in registerHelper function
2016-11-22 10:49:26 -08:00
Sibi Prabakaran
696faa3fd0
req is not needed. 2016-11-20 13:43:01 +05:30
Sibi Prabakaran
10850f5cee
Use checkCsrfHeaderOrParam instead of manual check 2016-11-20 13:32:15 +05:30
Sibi Prabakaran
7f17d829b3
Fix CSRF security vulnerability in registerHelper function
Return a 403 status code if the csrf tokens are matched. This currently
affects two endpoints: During registration and during password reset
forms.

This curl request demonstrates how this can be exploited to register new
email:

curl -i --header "Accept: application/json" --request POST -F
"email=sibi@psibi.in" http://localhost:3005/auth/page/email/register

With the patch applied, it will respond with this:

{"message":"Permission Denied. A valid CSRF token wasn't present in HTTP
headers or POST parameters. Because the request could have been forged,
it's been rejected altogether. Check the Yesod.Core.Handler docs of the
yesod-core package for details on CSRF protection."}
2016-11-20 03:59:32 +05:30
Michael Snoyman
10a751cdbc Version bump for #1296 2016-11-14 07:04:36 +02:00
Andrew Martin
2d6e5cea02 Added a ToValue instance for Enctype 2016-11-13 14:59:21 -05:00
Michael Snoyman
cc395c2ecf Another extra-dep 2016-11-11 07:05:07 +02:00
Michael Snoyman
b09866c9ad conduit-extra extra-dep 2016-11-11 06:53:48 +02:00
Michael Snoyman
253beb3107 Merge branch 'master' of https://github.com/paul-rouse/yesod into paul-rouse-master 2016-11-11 06:52:42 +02:00
Paul Rouse
a46dcbedc2 Revised don't keep partial autogen file when exception occurs 2016-11-10 22:07:20 +00:00
Michael Snoyman
fec96bc57c Merge pull request #1290 from yesodweb/languages-checks-setLanguage
languages reflects setLanguage
2016-11-10 11:31:33 +02:00
Paul Rouse
4ab830c4d9 Don't keep partial autogen file when exception occurs 2016-11-09 09:31:28 +00:00
Michael Snoyman
b074279832 Fix test suite compilation 2016-11-06 12:08:05 +02:00
Michael Snoyman
cc15bc6580 Version bump and close #1286 2016-11-06 06:40:46 +02:00
Michael Snoyman
036b020c8c Merge branch '1286-yesod-static-apply-middleware' 2016-11-06 06:40:01 +02:00
Michael Snoyman
bbca01ce71 languages reflects setLanguage 2016-11-04 11:10:26 +02:00
Michael Snoyman
f9927530b4 Updated resolver 2016-10-31 12:47:50 +02:00
Michael Snoyman
e92c1f0c3e yesod-static applies Yesod middlewares #1286 2016-10-31 12:47:14 +02:00
Michael Snoyman
e2e546df4d Travis update 2016-10-24 19:43:36 +03:00
Michael Snoyman
14ef94b8d1 Version bump for #1287 2016-10-24 19:42:09 +03:00
Michael Snoyman
d43783e978 Merge pull request #1287 from lamg/master
Added Yesod.Form.I18n.Spanish
2016-10-24 19:41:21 +03:00
Luis Ángel Méndez Gort
e593cd04c8 Merge branch 'master' of https://github.com/lamg/yesod 2016-10-23 15:58:46 -04:00
Luis Ángel Méndez Gort
161f771904 Merge branch 'master' of https://github.com/lamg/yesod 2016-10-23 15:56:35 -04:00
Luis Ángel Méndez Gort
cef7566d08 Merge branch 'master' of https://github.com/lamg/yesod 2016-10-23 15:49:53 -04:00
Luis Ángel Méndez Gort
e1d3f0ab79 Yesod.Form.I18n.Spanish added 2016-10-23 15:49:21 -04:00
Luis Ángel Méndez Gort
b1cfb3bda4 Yesod.Form.I18n.Spanish added 2016-10-21 19:08:27 -04:00
Michael Snoyman
a28d4b16f5 Version bump and close #149 2016-10-14 13:59:57 +03:00
Michael Snoyman
6228ccc351 Don't use lazy I/O in embedDirAt #149 2016-10-14 05:53:07 +03:00
Michael Snoyman
1aed870e0b Proper version bump for #1284 2016-10-07 17:03:54 +03:00
Michael Snoyman
c86efd3294 Merge branch '1284-yesod-bin-ghc-8' 2016-10-07 17:03:15 +03:00
Michael Snoyman
1753569e95 Version bump and close #1284 2016-10-06 14:38:09 +03:00
Michael Snoyman
69f07111c0 Do not pass a local package ID for GHC 8 #1284 2016-10-06 13:24:21 +03:00
Michael Snoyman
25bba1add1 Merge pull request #1283 from chreekat/comment-for-unsafe
Comment on unsafePerformIO, close #1245
2016-10-05 03:35:04 +03:00
Bryan Richter
add9d4393a
Comment on unsafePerformIO, close #1245 2016-10-03 09:08:22 -07:00
Michael Snoyman
57d0dab991 Version bump for #1282 2016-09-28 09:59:58 +03:00
Michael Snoyman
8014208382 Merge pull request #1282 from erikd/master
yesod-bin: Make it build with latest optparse-applicative
2016-09-28 09:59:16 +03:00
Erik de Castro Lopo
c736b309bb yesod-bin: Make it build with latest optparse-applicative
Done with CPP hackery so the lower bound can remain unchanged.
2016-09-28 07:59:04 +10:00
Michael Snoyman
977b0e1485 Fix Travis for LTS 7 2016-09-26 18:02:13 +03:00
Michael Snoyman
ec7b62c5dc Travis: add GHC 8.0.1 2016-09-26 16:06:45 +03:00
Michael Snoyman
1029cc4e8e Version bump for #1281 2016-09-26 14:45:01 +03:00
Michael Snoyman
7151b63a4d Merge pull request #1281 from sru-systems/openbsd-wxneeded
Link yesod-bin with wxneeded on OpenBSD.
2016-09-26 14:43:26 +03:00
Martijn Rijkeboer
0017b4441b Link yesod-bin with wxneeded on OpenBSD. 2016-09-26 13:40:28 +02:00
Michael Snoyman
856e60eb9b Version bump 2016-09-25 14:34:38 +03:00
Michael Snoyman
06a6fbd127 Merge pull request #1278 from Dridus/except-instances
Add instance of MonadHandler and MonadWidget for ExceptT
2016-09-25 14:33:43 +03:00
Ross MacLeod
09c37eb916 Use #if MIN_VERSION_transformers(0,4,0) instead of __GLASGOW_HASKELL__ >= 710 2016-09-22 13:27:25 -04:00
Ross MacLeod
6de5d8f829 missed making the import of ExceptT conditional on GHC version as well 2016-09-22 13:23:10 -04:00
Ross MacLeod
58fb977276 Only emit MonadHandler and MonadWidget instance for ExceptT when GHC version >= 7.10, since that's the first version tied to transformers-0.4.0.0 which introduced ExceptT 2016-09-22 13:00:09 -04:00
Ross MacLeod
ee100d7be0 Add instance of MonadHandler and MonadWidget for ExceptT 2016-09-21 14:41:30 -04:00
Michael Snoyman
d1495bad85 Fix add-handler (fixes #1273) 2016-09-04 08:55:10 +03:00
Michael Snoyman
a04d2b25ba Version bump 2016-09-02 12:39:01 +03:00
Michael Snoyman
8ac7cd5e50 Merge branch 'master' of github.com:yesodweb/yesod 2016-09-02 12:38:08 +03:00
Michael Snoyman
ba740608d6 Version bump 2016-09-02 12:31:30 +03:00
Maximilian Tagher
85f6a64180 Merge pull request #1272 from amitaibu/travis-badge
Add travis badge to README
2016-09-01 15:54:29 -07:00
Amitai Burstein
e4ec72aa34 Add travis badge to README
Also change the header to H1
2016-09-01 19:54:18 +03:00
Michael Snoyman
33fd9de0b1 Merge pull request #1271 from amitaibu/bodyNotContains
Add bodyNotContains function
2016-09-01 16:35:03 +03:00
Amitaibu
827040f279 Fix error 2016-09-01 15:22:25 +03:00
Amitaibu
6ddfd07032 Add since tag 2016-09-01 14:20:29 +03:00
Amitaibu
ac0229dff0 Bump cabal version and export function 2016-09-01 14:19:38 +03:00
Amitaibu
21e0ef11ba Add bodyNotContains function 2016-09-01 14:09:10 +03:00
Michael Snoyman
92c3a08eb1 Merge pull request #1270 from kevin147147/patch-1
Translation bug in german message
2016-09-01 12:59:51 +03:00
kevin147147
e27cebb8a5 Translation bug in german message
missing space
2016-09-01 11:55:44 +02:00
Michael Snoyman
87afb38635 Version bump for #1268 2016-08-29 07:04:34 +03:00
Michael Snoyman
0881364f93 Merge pull request #1268 from CthulhuDen/issue-1266
cached and cachedBy will not overwrite global state changes
2016-08-29 07:03:48 +03:00
Cthulhu
fbaf502858 cached and cachedBy will not overwrite global state changes 2016-08-28 19:02:11 +03:00
Michael Snoyman
e5b3cf6dc7 Version bump 2016-08-28 14:59:55 +03:00
Michael Snoyman
4a5f4ab0e9 Merge pull request #1267 from hotwirestudios/master
Added support for aeson's toEncoding function (>= 0.11) to sendStatusJSON
2016-08-28 07:40:50 +03:00
Alexander Lippling
8822fa37a8 Added support for aeson's toEncoding function (>= 0.11) to sendStatusJSON 2016-08-28 01:06:23 +02:00
Bryan Richter
111b017f58 Explain what sslOnlyMiddleware really does (#1262)
Doc updated per
<https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security>.

I was tipped off to the discrepancy when my site worked totally fine over
http, in spite of the claim, "This middleware makes a site functionally
inaccessible over vanilla http in all standard browsers."
2016-08-24 08:24:32 -07:00
Maximilian Tagher
2ec13368f5 Merge pull request #1248 from yesodweb/fixCsrfPath
Default CSRF tokens to the root path "/"
2016-08-16 07:27:14 -07:00
Maximilian Tagher
e6287362ad Default CSRF tokens to the root path "/"
* The default path of cookies is the current path making the request
  * e.g. an AJAX request made from http://example.com/foo/bar would be /foo
  * This causes multiple CSRF tokens to build up as you navigate a site
  * This will cause errors if the CSRF tokens have different values, and an invalid token is sent.
* Closes #1247
2016-08-16 07:25:41 -07:00
Michael Snoyman
d2482bf178 Version bump 2016-08-14 15:44:53 +03:00
Michael Snoyman
10b8ee70e7 Merge branch 'master' of github.com:yesodweb/yesod 2016-08-14 15:43:55 +03:00
Michael Snoyman
24ffaf90d4 Version bump 2016-08-14 15:42:01 +03:00
Michael Snoyman
25cb163e11 Relax upper bounds for persistent 2.6 2016-08-14 15:41:17 +03:00
Maximilian Tagher
9fb876e383 Merge pull request #1258 from bitemyapp/master
What I did to avoid the duplicate cookie problem
2016-08-13 21:18:49 -04:00
Michael Snoyman
cc6cc2939e Fix ChangeLog and @since comments 2016-08-10 15:18:41 +03:00
Michael Snoyman
f6891b0373 Merge branch 'BL/samesite' of https://github.com/bobjflong/yesod into bobjflong-BL/samesite 2016-08-10 15:17:25 +03:00
Michael Snoyman
dae1a34d4c Version bump for #1259 2016-08-10 08:48:57 +03:00
Michael Snoyman
f4b4602500 Merge branch 'add-pretty-assert' of https://github.com/bitemyapp/yesod 2016-08-10 08:42:09 +03:00
Michael Snoyman
629d4c49a4 Version bump for #1257 2016-08-10 08:42:04 +03:00
Michael Snoyman
159da2e953 Merge pull request #1257 from ran-lasgalen/urlParamRenderOverride
urlParamRenderOverride method for Yesod class
2016-08-10 08:38:56 +03:00
Chris Allen
13d9f58db7 Added assertEq, deprecated assertEqual
use assertEq instead
2016-08-10 00:08:24 -05:00
Artem Chuprina
83299bf1be urlParamRenderOverride method for Yesod class
this method replaces urlRenderOverride because the latter lacks support for query string
2016-08-09 22:54:24 +03:00
Chris Allen
a3f4974750 Merge branch 'master' of git://github.com/yesodweb/yesod 2016-07-22 10:50:22 -05:00
Michael Snoyman
9ce2770813 Merge pull request #1250 from MaxGabriel/documentCsrfMiddlewareUsage
Document recommended usage of the CSRF middleware
2016-07-14 18:05:45 +03:00
Maximilian Tagher
0eb8ab3050 Document recommended usage of the CSRF middleware
* Closes #1246
2016-07-14 07:56:31 -07:00
Sibi
65433b2fa4 Merge pull request #1249 from Vlix/patch-1
Updated some Dutch translations.
2016-07-13 00:26:04 +05:30
Felix Paulusma
76726063e4 Updated some Dutch translations. 2016-07-12 17:19:09 +02:00
Chris Allen
5e4cefc9ad path, not value 2016-07-08 14:25:47 -05:00
Chris Allen
4a0caeb05c deleting cookie before adding to avoid duplicates for a test 2016-07-08 13:38:39 -05:00
Michael Snoyman
8bbe91cbfe Merge pull request #1243 from mschristiansen/master
Cleanup of yesod-core code
2016-06-28 11:13:50 +03:00
Mikkel Christiansen
50c4138a5c Take hlint suggestions. 2016-06-28 08:28:23 +02:00
Mikkel Christiansen
cc134b93de Remove compiler warnings for unused var and unused imports. 2016-06-27 19:47:55 +02:00
Michael Snoyman
6595a707d0 Version bump 2016-06-27 10:46:19 +03:00
Michael Snoyman
1036550d00 Add missing Monoid import 2016-06-23 08:15:53 +03:00
Michael Snoyman
c24d0e7f80 Allow deepseq 1.3 2016-06-22 23:01:44 +03:00
Michael Snoyman
90ecc1ebe3 Significant cleanup of runHandler
@nh2 This hopefully makes the logic much clearer to avoid exceptional
cases slipping through.

@gregwebs Maybe you'd like to review this?

For yesod-core 1.5: we should make as many datatypes strict-fielded as
possible in Yesod.Core.Types to make for less corner cases. Also, the
idea of an exception value itself being partial is _really_ terrifying.
2016-06-22 20:28:42 +03:00
Michael Snoyman
33ea980dba Simplify away from returnDeepSessionMap 2016-06-22 18:45:46 +03:00
Michael Snoyman
a3d9a13abe Proper handling of impure exceptions within HandlerError values 2016-06-22 18:24:18 +03:00
Michael Snoyman
85e7fd7e33 Version bump for #1241 2016-06-20 17:30:28 +03:00
Alexander Lippling
18cd7834d6 Added support for aeson's toEncoding function (>= 0.11) 2016-06-20 13:19:11 +02:00
Sibi
2a01710f4b Remove outdated instruction for jsLoader (#1238) 2016-06-05 11:28:22 -07:00
Michael Snoyman
3a2a71537e Merge pull request #1237 from bergmark/patch-3
yesod-core needs bytestring >= 0.10
2016-06-04 21:29:54 +03:00
Adam Bergmark
7f9f8b450e yesod-core needs bytestring >= 0.10 2016-06-04 18:55:35 +02:00
Michael Snoyman
a64dd5ebbd Disable 7.8.4 OS X build (no hfsevents) 2016-05-25 11:47:41 +03:00
Michael Snoyman
bec401d081 Don't install from sdist tarballs 2016-05-25 11:47:30 +03:00
Michael Snoyman
a4554b1163 Disable 7.6.3 build 2016-05-25 09:26:27 +03:00
Michael Snoyman
44c78058fe Switch to newer Travis config 2016-05-25 08:55:20 +03:00
Michael Snoyman
b5ea4326f9 Work around optparse-applicative behavior change 2016-05-25 08:44:36 +03:00
Michael Snoyman
e39be76191 Merge branch 'master' of github.com:yesodweb/yesod 2016-05-25 08:40:49 +03:00
Michael Snoyman
af816e7690 Merge pull request #1234 from agreif/patch-1
fix typos
2016-05-17 18:27:28 +03:00
Alex Greif
b85ffbaf52 fix typos 2016-05-17 17:21:03 +02:00
Bryan Richter
5342f891f3 Add key reuse warning (#1222) (#1233) 2016-05-14 15:40:07 -07:00
Bob Long
294ef285a3 remove redundant paren 2016-05-03 16:24:12 +01:00
Bob Long
6746c1c94f fixup whitespace in docs 2016-05-03 16:23:57 +01:00
Bob Long
1834d255e6 replace pure with Just for backwards compat 2016-05-03 15:18:45 +01:00
Bob Long
9b0caaf2cf expand documentation on lax & strict 2016-05-03 15:17:46 +01:00
Bob Long
bc7ff2f552 Add version information 2016-05-01 17:23:10 +01:00
Bob Long
aed1e27cb7 Bump cookie version in cabal file 2016-05-01 17:21:33 +01:00
Bob Long
a797c2e5d4 Add laxSameSiteSessions and strictSameSiteSessions 2016-05-01 16:31:01 +01:00
Bob Long
2cbe60c53d Add latest Cookie version 2016-05-01 16:30:22 +01:00
Michael Snoyman
cad058a758 Version bump 2016-04-25 18:22:28 +03:00
Michael Snoyman
465210d131 Version bump 2016-04-25 18:20:33 +03:00
Michael Snoyman
e6216fa289 Version bump 2016-04-25 18:19:26 +03:00
Michael Snoyman
bd1ea59cbd Version bump 2016-04-25 18:17:13 +03:00
Michael Snoyman
bf0ca2bc10 Version bump 2016-04-25 16:57:40 +03:00
Michael Snoyman
18993caf3a Merge pull request #1223 from erikd/master
yesod-core: Fix for a *very* late change in ghc-8.0 TH api
2016-04-24 08:23:28 +03:00
Erik de Castro Lopo
96af1e7f39 yesod-core: Fix for a *very* late change in ghc-8.0 TH api 2016-04-23 10:54:41 +10:00
Michael Snoyman
b00d372c76 Fix benchmark compilation of yesod-core 2016-04-21 20:17:05 +03:00
Michael Snoyman
120c236fc5 More changelog updates 2016-04-20 20:12:30 +03:00
Michael Snoyman
8cbfb100fb Update changelog 2016-04-20 20:12:03 +03:00
Michael Snoyman
0761cd7087 Merge pull request #1219 from bermanjosh/yesod-keter-no-stack
error handling when checking for stack binary
2016-04-20 20:11:27 +03:00
Josh Berman
580eb46563 narrower exception type for stack check; only a patch number bump 2016-04-20 19:48:23 +03:00
Josh Berman
1038fc0125 error handling when checking for stack binary 2016-04-20 16:43:06 +03:00
Michael Snoyman
d44f8539ab Merge pull request #1213 from erikd/master
Fixes for ghc-8.0 and persistent 2.5
2016-04-20 13:18:44 +03:00
Erik de Castro Lopo
21d27626b2 yesod-core: Fix for ghc-7.8 2016-04-19 15:18:46 +10:00
Erik de Castro Lopo
833e74e797 yesod-bin: Fixes for ghc-8.0 2016-04-19 15:18:46 +10:00
Erik de Castro Lopo
bd9197fc1e yesod-auth-oauth: Allow transformers == 0.5* 2016-04-19 15:18:46 +10:00
Erik de Castro Lopo
34e0c8b638 yesod-auth: Fixes for persistent 2.5 2016-04-19 15:18:46 +10:00
Erik de Castro Lopo
d101c8eebe yesod-persistent: Make it work with persistent 2.5 2016-04-19 15:18:46 +10:00
Erik de Castro Lopo
226c381baa yesod-core: Make it work with ghc-8.0
Use CPP hackery to make it compile with ghc-8.0 and ghc 7.10. If
ghc-7.10 works, I assume earlier supported versions of GHC also
work. All tests pass with both GHC versions.

Unfortunately, the TH changes force changes in the type signature
of Yesod.Routes.TH.RenderRoute.mkRouteCons from:

    mkRouteCons :: [ResourceTree Type] -> ([Con], [Dec])

to

    mkRouteCons :: [ResourceTree Type] -> Q ([Con], [Dec])

and I can't see a way around that.
2016-04-19 14:52:03 +10:00
Michael Snoyman
1b5477bc78 Merge pull request #1157 from pseudonom/master
Adjustments for split read and write DB
2016-04-19 07:40:00 +03:00
Maximilian Tagher
f9bde33547 Merge pull request #1216 from erikd/init-msg
yesod-bin: Improve the 'use stack' message
2016-04-18 16:21:06 -07:00
Erik de Castro Lopo
04944de436 yesod-bin: Improve the 'use stack' message
Use `putStrLn` instead of `error` because ghc-8.0 prints call stack
info for `error` calls.
2016-04-19 08:59:38 +10:00
Eric Easley
d99de61554 Use CPP to maintain backward compat 2016-04-18 10:03:39 -07:00
Eric Easley
8e71f766b5 Use PersistRecordBackend constraint synonym 2016-04-15 21:25:40 -07:00
Eric Easley
bf3a9c9dd4 Switch to released persistent-2.5 2016-04-14 15:14:56 -07:00
Maximilian Tagher
d19e3763ec Merge pull request #1209 from maxigit/fix-addToken_needing-trailing-space
Fix addToken_ needing a trailing space to work.
2016-04-13 06:46:19 -07:00
Maxime Bourget
6addf3923d Changes spec name and bump version to 1.5.1.1 2016-04-12 21:42:33 +01:00
Michael Snoyman
210f846af5 Merge pull request #1145 from ajnsit/hierarchical-subsites-args
Pass hierarchical route arguments to subsites
2016-04-12 07:27:47 +03:00
Maxime Bourget
3fecebd5ba Allows more that one space between css selector.
This is needed to support addToken_ workaround before the fix.
Before the fix, an extra space was needed in the selector like this

example:

    addToken "form.foo "

With the fix adding the missing space, code already adding a space
will end up with two spaces between the scope selector and the input one :

    form.foo  input[name=token_]
2016-04-11 21:58:50 +01:00
Maxime Bourget
62fc67a444 Fix addToken_ needing a trailing space to work.
The fix can add spaces in place where none or only one where expected.
The css parser has been modified to remove trailing or multiple spaces.
This might be a bit more lax that official CSS spec.
2016-04-11 21:15:27 +01:00
Eric Easley
f7494260b0 Merge remote-tracking branch 'upstream/master' 2016-04-11 09:16:06 -07:00
Michael Snoyman
4d6448b0dd Use Data.Yaml.Config module to decrease code duplication 2016-04-11 15:08:40 +03:00
Eric Easley
8a9a78bd4c Generalize defaultGetDBRunner 2016-04-10 23:38:44 -07:00
Maximilian Tagher
93039dfc7c Merge pull request #1205 from league/master
Provide CSRF token in Dummy login form
2016-04-03 11:21:19 -07:00
Christopher League
85a62ab074 Bump yesod-auth version for CSRF support (#1205) 2016-04-03 12:43:15 -04:00
Christopher League
fd870c95f9 Provide CSRF token in Dummy login form 2016-04-02 23:04:58 -04:00
Eric Easley
329735e815 Fix http-api-data version for lts 2 2016-03-31 13:38:32 -07:00
Eric Easley
02dcb99cad Merge remote-tracking branch 'upstream/master' 2016-03-31 13:03:47 -07:00
Eric Easley
3b387b7149 Used HTTPS instead of ssh 2016-03-31 01:06:39 -07:00
Eric Easley
641f4a8de4 Trigger travis rebuild 2016-03-30 20:27:27 -07:00
Eric Easley
8ce9a6b088 Update to finalized (?) persistent 2016-03-30 16:20:44 -07:00
Maximilian Tagher
09087c934e Merge pull request #1200 from MaxGabriel/logCSRFErrors
Log a warning when a CSRF error occurs
2016-03-29 10:14:41 -07:00
Michael Snoyman
f35c0c6f5c Merge pull request #1201 from geraldus/gman/translation-fix
Minor improve of Russian translation
2016-03-29 17:18:31 +03:00
Arthur Fayzrakhmanov (Артур Файзрахманов)
ecdee7f51a Tidy up imports 2016-03-29 19:14:40 +05:00
Arthur Fayzrakhmanov (Артур Файзрахманов)
5febecf812 Improve Russian translation for ConfirmPass message 2016-03-29 19:14:27 +05:00
Maximilian Tagher
5a5cfd6c7a Bump version for CSRF logging changes, and improve error message. 2016-03-28 23:36:31 -07:00
Maximilian Tagher
28fbaae268 Log a warning when a CSRF error occurs
* Closes #1192
2016-03-28 23:35:27 -07:00
Michael Snoyman
063cef70ee Version bump 2016-03-29 09:21:03 +03:00
Michael Snoyman
88a77f88b3 Version bump 2016-03-29 09:20:11 +03:00
Michael Snoyman
aa6714e4b0 Undo minor bump that was not needed 2016-03-29 09:16:33 +03:00
Michael Snoyman
31d07481f1 Version bump 2016-03-29 09:15:57 +03:00
Michael Snoyman
da4948592d Version bump 2016-03-29 09:14:02 +03:00
Maximilian Tagher
3b9e782988 Fix W3 multiple attribute link 2016-03-28 12:33:25 -07:00
Michael Snoyman
fd1681d2ce Version bump 2016-03-28 20:40:11 +03:00
Michael Snoyman
814ad379b6 Disable yesod test for Stack (fixes #1198) 2016-03-28 20:26:42 +03:00
Maximilian Tagher
8ce201faca Merge pull request #1194 from mwotton/add_followRedirect_to_yesodtest
followRedirect as discussed in https://github.com/yesodweb/yesod/issues/1190
2016-03-23 08:50:34 -07:00
Sibi
957930babd Merge pull request #1196 from kokotchY/master
Add French translation for CurrentPassword
2016-03-23 14:04:50 +05:30
Sebastien Canart
36bc175f50 Add French translation for CurrentPassword 2016-03-23 08:26:44 +01:00
Mark Wotton
94109d9406 duplicated typesig 2016-03-21 17:46:28 -04:00
Mark Wotton
23278d651e documentation fixes & formatting #3 2016-03-21 17:41:25 -04:00
Mark Wotton
b21e64637f documentation fixes #2 2016-03-21 17:21:14 -04:00
Mark Wotton
f2341355c1 documentation fixes 2016-03-21 17:20:02 -04:00
Mark Wotton
ef00ddd80b test result value, return URL in Right branch, document meaning in haddocks 2016-03-21 17:16:28 -04:00
Mark Wotton
92f24a73dc better error messages for followRedirect 2016-03-21 13:44:26 -04:00
Mark Wotton
f381c69449 expand range of acceptable redirection codes 2016-03-21 13:43:36 -04:00
Mark Wotton
29c335af56 use Either rather than throwing an exception 2016-03-21 13:39:49 -04:00
Mark Wotton
62961ef931 fix exception test 2016-03-21 12:34:38 -04:00
Mark Wotton
df6834a335 add followRedirect 2016-03-21 12:13:23 -04:00
Michael Snoyman
89e39464a1 Changelog for #1191 2016-03-21 12:57:52 +02:00
Michael Snoyman
5cf7694fd0 Merge pull request #1191 from bitemyapp/master
Better error provenance for stuff invoking withResponse'
2016-03-21 12:57:08 +02:00
Michael Snoyman
6ad3274261 Merge pull request #1193 from asjo/master
Add translation to Danish.
2016-03-21 08:42:54 +02:00
Adam Sjøgren
04a7c12b65 Add translation to Danish. 2016-03-20 21:16:14 +01:00
Chris Allen
289471d122 appropriate version bump 2016-03-20 12:50:17 -05:00
Michael Snoyman
c11bd93616 Merge pull request #1187 from sir-murray/master
Multiple session messages.
2016-03-20 18:36:03 +02:00
Murray
9dbcc95c3f remove single message deprecated directives 2016-03-18 09:17:57 +00:00
Chris Allen
776007ffa3 better wording 2016-03-17 14:35:15 -05:00
Chris Allen
7e10d87492 better error formatting, bumping version 2016-03-17 14:33:15 -05:00
Chris Allen
57b7ad8eda better error provenance for stuff invoking withResponse' 2016-03-17 14:18:38 -05:00
Murray
a15070709d allow more than one session message and add statuses 2016-03-16 18:14:40 +00:00
Michael Snoyman
e7c6d06d3d Newer LTS release 2016-03-13 08:26:31 +02:00
Michael Snoyman
406694cd29 Version bump for #1182 2016-03-13 08:26:24 +02:00
Michael Snoyman
292270f36a Merge pull request #1182 from mrkkrp/master
Allow lines of dashes in route files
2016-03-13 08:24:57 +02:00
Michael Snoyman
27a9faa91f Merge pull request #1183 from lethjakman/auth_forgot_password_csrf
Fixed forgot password CSRF with form helper
2016-03-13 08:11:16 +02:00
Alex Kardos
d76aa1a16e Converted runFormPosts to generateFormPost
This is a cleaner way to generate forms without ignoring one of the
variables.
2016-03-12 18:29:05 -07:00
Alex Kardos
9fb3f61ac8 Moved settings to functions to clean up the form 2016-03-12 18:29:05 -07:00
Alex Kardos
2f0a7fbcc5 Wrapped email login form with an id 2016-03-12 18:29:05 -07:00
Alex Kardos
0c0cb12a10 Used form helper for forgot password form
* Removed unused idents
* Isolated form logic
* Added an id around forgot password for styling purposes
2016-03-12 18:28:49 -07:00
mrkkrp
3640d75c99 Allow lines of dashes in route files
See #1180.
2016-03-11 14:09:57 +06:00
Michael Snoyman
8df56ecaa1 Merge pull request #1176 from lethjakman/auth_set_password_csrf
Auth password handler CSRF
2016-03-10 10:55:17 +02:00
Alex Kardos
dee130ac9f Made spacing consistent with the rest of the file 2016-03-09 19:47:52 -07:00
Alex Kardos
7faecc8952 Added translations and dummy data for current password
German and Spanish provided by Erin Eichenberger.
2016-03-09 19:22:36 -07:00
Michael Snoyman
936fe84cdd Deprecate BrowserId #1173 2016-03-08 16:27:21 +02:00
Alex Kardos
e3aa310c84 Used monadic form helper for password handler
This needed to happen in order to automatically get CSRF protection

Several changes happened while switching over:
* Relied on built in names for inputs
* Cleaned up naming
* Created password helpers for each field
* Added a translation for current password
2016-03-07 16:44:05 -07:00
Michael Snoyman
4ed1e7e486 Merge pull request #1174 from lethjakman/auth_main_page_csrf
Fixed CSRF token for login page
2016-03-07 10:03:30 +02:00
Sibi
1bc843c0ce Merge pull request #1175 from sajith/patch-1
Minor doc patch - sendStatusJSON is since 1.4.18
2016-03-07 06:00:40 +05:30
Sajith Sasidharan
93da4f060e Minor doc patch - sendStatusJSON is since 1.4.18
I'm sure this is trivially obvious. :-)

Commit 6a60dac introduced `sendStatusJSON` on Nov 25, 2015; yesod-core 1.4.18 was uploaded to hackage on Dec 17.
2016-03-06 18:22:51 -05:00
Michael Snoyman
d922bdd272 Merge pull request #1158 from geraldus/gman/summernote
Add Summernote WYSIWYG html field
2016-03-06 11:53:52 +02:00
Alex Kardos
4b78c4d60a Moved emailLoginHandler out of authEmail
The authEmail function was getting large so I moved the
emailLoginHandler out into its own function.
2016-03-05 16:59:02 -07:00
Alex Kardos
d42d38990d Added translated label to default register handler
This was removed on accident.
2016-03-05 16:58:34 -07:00
Arthur Fayzrakhmanov (Артур Файзрахманов)
a38564df43 Fix line ending 2016-03-04 22:07:18 +05:00
Arthur Fayzrakhmanov (Артур Файзрахманов)
fe2b6844b6 Add notice about Summernote 2016-03-04 22:07:06 +05:00
Alex Kardos
4963f562fe Converted yesod login screen to monadic form
The form helpers weren't being used which caused the CSRF tokens to not
be present. This also allows for a bit more flexability and
cleans up the code as well.
2016-03-03 20:52:08 -07:00
Michael Snoyman
64cb8980db Version bump 2016-03-02 11:08:15 +02:00
Michael Snoyman
169b3a6b44 Merge branch 'fix/oauth-twitter-id' of https://github.com/kakkun61/yesod 2016-03-02 11:05:25 +02:00
Michael Snoyman
5709040dcd Add some docs for MassInput 2016-03-02 11:05:19 +02:00
Kazuki Okamoto
e1b70eb0f8 new twitter plugin 2016-03-02 10:59:43 +09:00
Sibi
3d8c91bae6 Merge pull request #1169 from bitemyapp/master
Trivial typo in haddocks bothering me
2016-03-02 03:58:20 +05:30
Chris Allen
7123b02500 typo 2016-03-01 15:13:34 -06:00
Kazuki Okamoto
8a66da1f24 Revert "add twitterId function"
This reverts commit 074b0c68e7.
2016-03-01 23:21:17 +09:00
Kazuki Okamoto
074b0c68e7 add twitterId function 2016-02-29 04:07:42 +09:00
Kazuki Okamoto
d46d754555 Revert "change Twitter ID screen_name → user_id"
This reverts commit 5a25e5e53b.
2016-02-29 00:00:42 +09:00
Kazuki Okamoto
5a25e5e53b change Twitter ID screen_name → user_id 2016-02-28 16:48:56 +09:00
Maximilian Tagher
aae32399f1 Merge pull request #1165 from lethjakman/auth_csrf
Fixed registerHandler CSRF issue
2016-02-23 14:54:50 +01:00
Maximilian Tagher
9dd48ab4b3 Merge pull request #1161 from MaxGabriel/yesodAuthHardodedUseCSRFToken
Have the yesod-auth login form use a CSRF token
2016-02-23 14:54:38 +01:00
Michael Snoyman
b09d029fb7 Merge pull request #1166 from luigy/master
[WIP] improve stack detection for yesod-bin
2016-02-21 15:51:43 +02:00
Alex Kardos
1cae0e38ab Moved login logic into a function
This is more clear and looks like the other authorization plugins.
2016-02-20 21:28:20 -07:00
Alex Kardos
456e93fb10 Added autofocus attribute to email input 2016-02-20 13:47:42 -07:00
Alex Kardos
27e1ec3be3 Used email field for input 2016-02-20 13:39:18 -07:00
Alex Kardos
c376146231 Removed whitespace 2016-02-20 13:38:48 -07:00
Alex Kardos
ed5037fa74 Used localized email label 2016-02-20 13:38:19 -07:00
Alex Kardos
3e37983f1c Added encoding type and removed unused variable 2016-02-20 13:37:43 -07:00
Luigy Leon
f576a8a435 only perform checks when it needs to build 2016-02-19 15:42:42 -05:00
Luigy Leon
d87499deb5 [yesod-bin] improve stack detection for 'stack keter'
The following will now use stack:

* `stack query` succeeds from current directory instead of searching that a `stack.yaml` exists
* `STACK_YAML` or `STACK_EXE`(set by `stack exec`) environment variables are set
2016-02-19 12:21:02 -05:00
Alex Kardos
76fc5887f9 Fixed registerHandler CSRF issue
The default register handler for email authentication didn't provide a
CSRF token. I provided one by using a monadic form helper.
2016-02-17 20:39:09 -07:00
Maximilian Tagher
d39ce44c21 Use defaultCsrfParamName instead of hard-coding its value
* Up version bounds so that `defaultCsrfParamName` is available.
* I didn't bump the yesod-form version. It seemed unnecessary to do a new release just for this.
2016-02-15 23:59:24 -08:00
Maximilian Tagher
a01051eaf6 Have the yesod-auth login form use a CSRF token
Closes #1159

Based on reading this [StackOverflow Post](http://stackoverflow.com/questions/6412813/do-login-forms-need-tokens-against-csrf-attacks) and skimming [this paper](http://seclab.stanford.edu/websec/csrf/csrf.pdf), using CSRF protection on login forms protects against a vulnerability where an attacker submits their own username/password in the login form. Later, the user uses the real site, but doesn't realize they're logged in as the attacker. This creates vulnerabilities like:

1. If the site logs the user's activity for them (e.g. recently watched videos on YouTube, previous searches on Google), the attacker can see this information by logging in.
2. The user adds sensitive information to the account, like credit card information, the attacker can login and potentially steal that information or use it on the site.

I don't think this vulnerability applies to the `Yesod.Auth.Hardcoded` plugin because the attacker couldn't create an account of their own.

However:

* If I understand the example in `Yesod.Auth.Hardcoded`, one use case is to share one login form that works for both the Hardcoded plugin as well as normal database-backed username/password login, in which case having a CSRF token makes sense
* I don't see a downside to having the CSRF token there
* It makes the Hardcoded plugin work with the CSRF middleware

Does this sound like the right solution?
2016-02-14 17:32:46 -08:00
Eric Easley
dbffca825c Update stack.yaml to point at modified persistent 2016-02-11 13:14:27 -08:00
Eric Easley
4bc4fc3b36 Adjust yesod-auth for split DB 2016-02-07 19:17:50 -08:00
Eric Easley
1dea0ef5b1 Adjust yesod-form for split DB 2016-02-07 19:15:57 -08:00
Eric Easley
7b35665d73 Adjust yesod-persistent for split DB 2016-02-07 19:11:41 -08:00
Michael Snoyman
d8414c3c20 Merge pull request #1155 from chreekat/enclosure-doc
Document feed entry enclosures
2016-02-03 09:27:41 +02:00
Bryan Richter
806dc5c629
Fuller docs + version bump 2016-02-02 08:59:01 -08:00
Bryan Richter
4d48ba71be
Document feed entry enclosures 2016-02-01 20:18:58 -08:00
Sibi
7ea1e004c9 Merge pull request #1153 from mrP0tat0Head/fix-auth-message-german-translation
Fix typo in auth german translation
2016-01-26 06:03:27 +05:30
Eugen
69b4751990 Fix typo in auth german translation 2016-01-26 00:12:26 +01:00
Michael Snoyman
cf5a390cad Add _token parameter to redirectToPost #1151 2016-01-24 14:37:44 +02:00
Michael Snoyman
be9d0a281d Better Travis caching 2016-01-21 14:15:24 +02:00
Michael Snoyman
aa36a22834 Version bump for yesod-core 2016-01-21 09:59:45 +02:00
Michael Snoyman
fff6449fa2 Newer wai-app-static to fix build against nightly 2016-01-21 09:09:03 +02:00
Michael Snoyman
df90bd43e2 Deprecate Yesod.Auth.GoogleEmail #1150 2016-01-21 09:00:50 +02:00
Michael Snoyman
607d23151a Merge pull request #1149 from vlatkoB/master
Croatian translation
2016-01-20 14:48:04 +02:00
vlatkoB
a6e11245cf Fix var name to croatianFormMessage 2016-01-20 09:47:28 +01:00
vlatkoB
1fca3ceea3 Croatian translation 2016-01-20 08:48:15 +01:00
Anupam Jain
38680c6568 Add test for hierarchical subsite with arguments
Note: Needed to enable ViewPatterns for this
2016-01-19 17:06:40 +05:30
Anupam Jain
9859fe1ddb Pass hierarchical route arguments to subsites 2016-01-19 15:21:15 +05:30
Michael Snoyman
d6cd13a423 Changelog for #1144 2016-01-14 09:34:43 +02:00
Michael Snoyman
8f2d92baab Merge pull request #1144 from ajnsit/hierarchical-subsites
Allow subsites within hierarchical routes
2016-01-14 09:34:00 +02:00
Anupam Jain
0d99f94e5a Add a testcase for nested subsites 2016-01-14 11:30:06 +05:30
Anupam Jain
a1df470d01 Allow subsites within hierarchical routes 2016-01-13 10:47:50 +05:30
Michael Snoyman
eae422ea0c Merge pull request #1143 from Dridus/properly-polymorphic-sendStatusJSON
#1142 make sendStatusJSON fully polymorphic in its return type, since it never returns
2016-01-12 19:24:07 +02:00
Ross MacLeod
1fb53dfa9e #1142 make sendStatusJSON fully polymorphic in its return type, since it never returns 2016-01-12 11:32:20 -05:00
Michael Snoyman
d4a907d4e8 tar 0.5 2016-01-10 17:23:06 +02:00
Michael Snoyman
3228b40843 Fully remove the yesod init command (fixes #1132) 2015-12-30 09:04:29 +02:00
Greg Weber
5dff4adf86 Merge pull request #1129 from silky/master
Add error class when help text is an error.
2015-12-28 20:18:43 -08:00
silky
6ec02a917f Add error class when help text is an error. 2015-12-23 16:00:37 +11:00
Michael Snoyman
d346b8361f Version bump (fixes #1128) 2015-12-19 20:08:17 +02:00
Michael Snoyman
bff65b7942 Version bump for #1122 2015-12-14 11:50:25 +02:00
Michael Snoyman
10709c4e26 Merge pull request #1122 from pseudonom/master
Add hook to apply arbitrary function to all handlers
2015-12-14 11:49:30 +02:00
Michael Snoyman
bde5a69914 Merge pull request #1124 from mrkkrp/master
Fix references to ‘Yesod.Core.Handler’
2015-12-12 21:16:00 +02:00
mrkkrp
15c1573538 ‘checkCsrfHeaderNamed’ → ‘checkCsrfParamNamed’
Also removed trailing whitespace. Actual typo fix is on line 1318.
2015-12-11 23:00:01 +06:00
mrkkrp
bb02d2b911 fix references to ‘Yesod.Core.Handler’ 2015-12-11 22:40:06 +06:00
Eric Easley
21e49c7710 Fix tests for unwrapping hook 2015-12-10 09:53:55 -08:00
Eric Easley
56c19a2cd3 Add hook to apply arbitrary function to all handlers 2015-12-09 11:29:13 -08:00
Greg Weber
b271978ccf Merge pull request #1105 from bitemyapp/master
JSON-specific sendResponseStatus
2015-12-07 16:04:07 -08:00
Greg Weber
2ecfec1b9a Merge pull request #1116 from lethjakman/auth_demo
Added an example with email auth and an ses mailer
2015-12-07 15:13:36 -08:00
Michael Snoyman
5c6a20d6c0 Merge pull request #1119 from mrkkrp/master
Fix a typo in Russian translation of form messages
2015-12-07 12:26:40 +02:00
mrkkrp
b8949f4970 Fix a typo in Russian translation of form messages 2015-12-07 15:54:40 +06:00
Michael Snoyman
1fb697ff0d Add a workaround for yesodweb/wai#478 2015-12-06 13:29:17 +02:00
Michael Snoyman
288c457cfa Version bump for yesodweb/yesod-scaffold#114 2015-12-06 12:55:59 +02:00
Michael Snoyman
32dbad23d3 s/127.0.0.1/localhost yesodweb/yesod-scaffold#114 2015-12-06 12:55:16 +02:00
Michael Snoyman
af00b76a18 Set X-Forwarded-Proto correctly yesodweb/yesod-scaffold#114 2015-12-06 12:54:36 +02:00
Alex Kardos
5ca0dd7468 Added an example with email auth and an ses mailer
This should help beginners get started with email authentication and
utilize Amazon SES for reliable mailing instead of sendmail because
sendmail is inherently unreliable with consumer based IP addresses.

Points of interest:
* Pulls SES authentication details from config/secrets.yaml to keep the
  secrets out of the source code
* Needs the from email address to be confirmed with Amazon SES
2015-12-05 20:21:38 -07:00
Michael Snoyman
de3818784a getApprootText 2015-12-04 14:40:50 +02:00
Michael Snoyman
ae04cca639 Merge pull request #1112 from mrkkrp/minor-auth-tweaks
Minor auth tweaks
2015-12-03 23:19:20 +02:00
Michael Snoyman
adc802d644 Version bump 2015-12-03 22:59:52 +02:00
Michael Snoyman
3dbf4b6fad Update changelog 2015-12-03 20:55:37 +02:00
mrkkrp
1976e90be9 Bump password strength to compensate 2 years
Computers are now faster than in 2013.
2015-12-03 00:08:51 +06:00
mrkkrp
2431100c8b Fix a typo 2015-12-03 00:08:40 +06:00
Greg Weber
dae434aa64 release Yesod.Auth.HardCoded 2015-11-29 17:27:41 -08:00
Greg Weber
f62dc646fc Merge pull request #1104 from geraldus/auth-hardcoded
Simple auth plugin for hardcoded auth entities
2015-11-29 17:22:21 -08:00
Arthur Fayzrakhmanov (Артур Файзрахманов)
4f2f49b5ee Update documention
More concrete module documentation.  Now it shows a way to combine
'AuthHardcoded' plugin with other plugins.

Fixed some typos.
2015-11-29 22:12:40 +05:00
Arthur Fayzrakhmanov (Артур Файзрахманов)
f524ce55ea Bump minor version of yesod-auth 2015-11-29 22:12:40 +05:00
Arthur Fayzrakhmanov (Артур Файзрахманов)
b024a7a540 Add module documentation 2015-11-29 22:12:40 +05:00
Arthur Fayzrakhmanov (Артур Файзрахманов)
9fbc3bc082 Initial module implementation 2015-11-29 22:12:40 +05:00
Chris Allen
ae1015b628 shorter name 2015-11-25 23:01:49 -06:00
Chris Allen
6a60dac366 JSON-specific sendResponseStatus 2015-11-25 14:49:53 -06:00
Greg Weber
77c614fa86 Merge pull request #1103 from yesodweb/travis-with-stack
Travis with stack
2015-11-24 09:04:47 -08:00
Michael Snoyman
2bce53a682 Add wai-app-static extra-dep 2015-11-24 12:27:44 +02:00
Michael Snoyman
bd5943135e Travis: switch to Stack (to avoid the file not found errors from cabal) 2015-11-24 11:22:50 +02:00
Michael Snoyman
8f19c63dec Merge pull request #1102 from geraldus/geraldus/translation-hotfix
Fix Czech UserName message
2015-11-24 10:36:30 +02:00
Arthur Fayzrakhmanov (Артур Файзрахманов)
ec3ec15a80 Fix Czech UserName message
Convert word "jméno" to lowercase.
See comment from
[`lubomir`](https://github.com/yesodweb/yesod/pull/1100#commitcomment-14580304)
2015-11-24 13:34:13 +05:00
Michael Snoyman
4c448e0346 Precompiled cabal-meta 2015-11-24 04:42:34 +02:00
Michael Snoyman
c19d9d4596 Merge pull request #1100 from geraldus/username-constructor
Add UserName message constructor
2015-11-24 03:32:43 +02:00
Arthur Fayzrakhmanov (Артур Файзрахманов)
a6494bf788 Bump minor version 2015-11-24 02:19:04 +05:00
Arthur Fayzrakhmanov (Артур Файзрахманов)
97d8bbba06 Introduce LogoutTitle message constructor
`LogoutTitle` is a replacement for `Logout` constructor, the latter is
inconsistent with `LoginTitle` constructor name.
Added `DEPRECATED` pragma to warn users about this change.
2015-11-24 02:15:03 +05:00
Arthur Fayzrakhmanov (Артур Файзрахманов)
45c0b44142 Update Travis build instructions
Follow "S3 Hackage mirror for Travis
builds" (http://www.yesodweb.com/blog/2015/07/s3-hackage-mirror-travis)
suggestions.
2015-11-23 17:10:13 +05:00
Arthur Fayzrakhmanov (Артур Файзрахманов)
11bedecdc0 Prettify imports (via Stylish Haskell) 2015-11-23 16:41:09 +05:00
Arthur Fayzrakhmanov (Артур Файзрахманов)
d1e92af79e Add UserName message constructor 2015-11-23 16:40:47 +05:00
Arthur Fayzrakhmanov (Артур Файзрахманов)
311f949f0e Extract "in"/"out" suffixes in Login/Logout words
Split "Login" and "Logout" words into two parts, e.g. "Log In" and "Log
Out".
2015-11-23 16:14:40 +05:00
Felipe Lessa
5e2fa9af82 Merge pull request #1099 from DaveCTurner/issue-1099
Have clientSessionDateCacher use auto-update
2015-11-13 13:49:45 -02:00
David Turner
badabaa1ca Update comment 2015-11-13 15:15:04 +00:00
David Turner
b9b2d0d609 Use AutoUpdate for session expiry date too 2015-11-13 13:40:19 +00:00
Michael Snoyman
6d0affcce7 Merge pull request #1095 from yesodweb/add_functor_instance_for_option
Add Functor instance for Option and OptionList
2015-10-27 20:46:49 +02:00
Greg Weber
7b19951f9a Merge pull request #1094 from paul-rouse/master
Example loginHandler override in haddock
2015-10-27 08:51:22 -07:00
Andrew Martin
a2f4cc41fd Add Functor instance for Option and OptionList 2015-10-27 11:28:40 -04:00
Paul Rouse
276e687ac5 Example loginHandler override in haddock 2015-10-27 11:50:27 +00:00
Greg Weber
3e84348aab Merge pull request #1091 from paul-rouse/master
Provide default loginHandler as separate function
2015-10-21 07:03:06 -07:00
Paul Rouse
a25153d86e Provide default loginHandler as separate function 2015-10-21 12:27:59 +01:00
Michael Snoyman
b51b57d445 Modify version bump for #1089 2015-10-20 05:28:06 +00:00
Andrew Martin
e22b81793e Add instance documentation and bump version number 2015-10-19 12:33:30 -04:00
Andrew Martin
a225d3d680 Add Foldable and Traversable instances for FormResult 2015-10-19 09:35:03 -04:00
Michael Snoyman
bc09ac2550 Merge pull request #1086 from paul-rouse/master
Add guessApprootOr function
2015-10-13 17:27:15 +03:00
Paul Rouse
e4503ded60 Remove unnecessary underscores in guessApprootOr 2015-10-13 15:22:30 +01:00
Paul Rouse
692773326a Add guessApprootOr function 2015-10-13 15:00:02 +01:00
Greg Weber
3f15e2a20e Merge branch 'master' of github.com:yesodweb/yesod
Conflicts:
	yesod-core/ChangeLog.md
	yesod-core/yesod-core.cabal
2015-10-13 06:39:26 -07:00
Michael Snoyman
79aefc694a Make guessApproot the default (for yesod-core1.5) 2015-10-13 10:59:01 +00:00
Michael Snoyman
8e7476cb7a Revert "Delete problematic test.hs"
This reverts commit e610f3b6f5.
2015-10-13 10:57:17 +00:00
Michael Snoyman
5d0a4567f3 Add the guessApproot function (pinging @gregwebs) 2015-10-13 10:32:25 +00:00
Michael Snoyman
e610f3b6f5 Delete problematic test.hs 2015-10-13 10:32:01 +00:00
Michael Snoyman
2179a8e30d GoogleEmail2: proper error message when permission denied 2015-10-13 08:02:19 +00:00
Michael Snoyman
e2e2edf270 Fix openid.hs 2015-10-13 07:41:49 +00:00
Michael Snoyman
cf46d5e519 Stack resolver bump 2015-10-13 06:12:33 +00:00
Greg Weber
3f2c550a06 version bump for neverExpires bug fix 2015-10-11 08:45:48 -07:00
Greg Weber
15d7bd458b Merge pull request #1083 from DaveCTurner/issue-1083
Thread leak when calling neverExpires
2015-10-11 08:39:43 -07:00
David Turner
ef8bbf5820 Make comment more precise 2015-10-11 07:39:48 +00:00
David Turner
8dc54fc921 Update maximum expiry once per day 2015-10-11 07:28:52 +00:00
David Turner
5b4d5ced3b Move auto-updater into YesodRunnerEnv 2015-10-10 15:58:39 +00:00
Michael Snoyman
4835f5c530 Merge pull request #1081 from yesodweb/yesod-auth/runHttpRequest
add a runHttpRequest typeclass method
2015-10-07 17:21:49 +03:00
Greg Weber
3f96cae289 yesod-auth: add a runHttpRequest typeclass method 2015-10-07 07:06:21 -07:00
Greg Weber
bb7f0afe34 CODE_OF_CONDUCT spacing and problem resolution 2015-10-07 06:18:03 -07:00
Greg Weber
18d4b452d7 Merge pull request #1078 from maxnordlund/add-code-of-conduct
Create CODE_OF_CONDUCT.md
2015-10-07 06:15:17 -07:00
Max Nordlund
e621acccf6 Update Code of Conduct 2015-10-05 21:19:28 +02:00
Greg Weber
107dd60205 yesod-newsfeed version bump 2015-10-05 11:07:26 -07:00
Greg Weber
c5533f8a6c Merge pull request #1079 from nek0/master
added support for feed logos and item enclosures
2015-10-01 20:45:27 -07:00
nek0
fea89a933f added Changelog and cleaned Yesod/Commen remnants 2015-09-30 15:24:56 +02:00
nek0
6be3ecf9a5 Merge branch 'master' of github.com:nek0/yesod 2015-09-30 05:21:48 +02:00
nek0
de6b1ab726 Merge branch 'master' of github.com:nek0/yesod
removed unneded file
2015-09-30 05:21:18 +02:00
nek0
d027f805ee Merge branch 'master' of github.com:nek0/yesod 2015-09-30 05:18:20 +02:00
nek0
f7dfeee9b1 added support for feed logos and item enclosures
forgot a file
2015-09-30 05:17:53 +02:00
nek0
288ceae4fd added support for feed logos and item enclosures 2015-09-30 03:09:21 +02:00
Max Nordlund
b4524bafc3 Create CODE_OF_CONDUCT.md 2015-09-28 23:20:45 +02:00
Christopher Reichert
ae71026e71 Merge pull request #1073 from yesodweb/yesod-auth-google-profile
yesod-auth: google sign-in ask for profile permission
2015-09-11 00:11:19 -05:00
Greg Weber
92870f8c47 version bump 2015-09-10 16:18:36 -07:00
Greg Weber
6a567f0ccd ask for profile permission
somehow we are able to read the profile
of most users without this
2015-09-10 15:57:01 -07:00
Michael Snoyman
ae0d0b12c4 Deprecate yesod init in favor of stack new 2015-09-07 10:06:53 +03:00
Michael Snoyman
d785094ec9 Version bump 2015-09-07 08:35:36 +03:00
Christopher Reichert
fbfa6bcb8c Merge pull request #1068 from creichert/master
Bump yesod-websockets version.
2015-08-28 19:53:02 -05:00
Christopher Reichert
ae0608bc21 Bump yesod-websockets version. 2015-08-28 19:30:32 -05:00
Christopher Reichert
b452007b1b Merge pull request #1067 from wuzzeb/master
yesod-websockets: accept websocket requests with a subprotocol
2015-08-28 17:32:25 -05:00
John Lenz
5443b38525 yesod-websockets: accept websocket requests with a subprotocol
The websockets library allows passing an AcceptRequest when
upgrading the request to websockets, which at the moment only
contains the subprotocol to use with the client.  The list of
subprotocols that the client is prepared to speak is in the
RequestHead.
2015-08-28 16:34:09 -05:00
Christopher Reichert
dcf77ea493 Merge pull request #1066 from mschristiansen/warnings
Warnings
2015-08-26 12:15:34 -05:00
Mikkel Christiansen
25bbda2087 Remove unused applicative. 2015-08-26 16:10:56 +02:00
Mikkel Christiansen
d556fc8844 Replace deprecated Connection type. 2015-08-26 15:26:35 +02:00
Mikkel Christiansen
04cb3730a0 Replace deprecated breakByte function. 2015-08-26 15:03:14 +02:00
Mikkel Christiansen
a47ceec445 GHC 7.10 import warnings removed from yesod-core. 2015-08-26 14:52:39 +02:00
Mikkel Christiansen
233fc03532 Ghc710 conditional import and remove unused toUpper. 2015-08-26 14:22:12 +02:00
Greg Weber
ac6e8f6195 version bump for 1.5.0.1 2015-08-25 23:17:56 -07:00
Maximilian Tagher
7579980deb Merge pull request #1064 from MaxGabriel/yesodTestContentType
yesod-test: have `request` not default to the form-urlencoded Content-Type
2015-08-24 20:45:10 -07:00
Maximilian Tagher
479a19e65a yesod-test: have request not default to the form-urlencoded Content-Type
* Only set the Content-Type to "application/x-www-form-urlencoded" if key-value pairs are added
* Previously the "application/x-www-form-urlencoded" Content-Type would be added even if you set a binary request body.
	* You could add your own Content-Type with addRequestHeader, but this resulted in multiple Content-Type headers.
* Closes #1063
2015-08-24 20:27:28 -07:00
Michael Snoyman
e06a8109d0 Do not parse string environment variables into numbers/booleans #1061 2015-08-24 11:55:41 +03:00
Greg Weber
1567145110 version bump yesod-core to 1.4.15 2015-08-23 17:20:42 -07:00
Greg Weber
65bc93a6d6 1.4.15 Changelog 2015-08-23 17:16:11 -07:00
Greg Weber
8da4effb03 Merge pull request #1065 from Daniel-Diaz/master
mkYesodGeneral: Assume type arity 0 when type is not in scope at splicing time
2015-08-23 16:40:34 -07:00
Daniel Díaz
5375bacf81 Placed App after mkYesod in the RawResponse test. 2015-08-23 22:53:13 +02:00
Daniel Díaz
e77f6bd709 Do not use reify unless the type name is in scope. Assume arity 0 when the type is not in scope. 2015-08-23 22:49:04 +02:00
Greg Weber
ad7326aaaa fix error from new HUnit export 2015-08-21 14:24:54 -07:00
Greg Weber
57f9bd6ff6 Merge pull request #1060 from Daniel-Diaz/master
changelog modification following #1059 discussion
2015-08-21 12:58:28 -07:00
Daniel Díaz
8130e2b7a9 Fixed mkYesodGeneral message in changelog, and added information about splicing breaking change. 2015-08-21 21:52:35 +02:00
Greg Weber
a28f4f3fa4 Changelog for yesod-test 1.5 2015-08-20 17:44:31 -07:00
Greg Weber
95e6084634 Merge branch 'test-middleware'
Conflicts:
	yesod-test/yesod-test.cabal
2015-08-20 17:38:30 -07:00
Greg Weber
80ea70c39e Merge remote-tracking branch 'MaxGabriel/removeDeprecatedNonces'
Conflicts:
	yesod-test/Yesod/Test.hs
2015-08-20 17:36:08 -07:00
Greg Weber
8b00b373b8 release yesod-test 1.4.4 2015-08-20 17:29:32 -07:00
Greg Weber
6d15e7c7ba Merge pull request #1058 from MaxGabriel/csrfMiddlewareYesodTest
Add functions to yesod-test to support the new CSRF middleware
2015-08-20 17:25:03 -07:00
Michael Snoyman
ce456d48c7 Correctly reverse package-db argument order (fixes #1057) 2015-08-20 08:49:28 +03:00
Maximilian Tagher
374195b4fa Add functions to yesod-test to support the new CSRF middleware 2015-08-19 22:18:30 -07:00
Michael Snoyman
0fcbbb7951 Version bump 2015-08-20 08:02:42 +03:00
Maximilian Tagher
0f55dcc158 Merge pull request #1017 from MaxGabriel/ajaxCsrfProtection
Adding CSRF protection for AJAX requests
2015-08-17 17:27:08 -07:00
Maximilian Tagher
33982b2112 Add CSRF protection functions/middleware that support AJAX requests 2015-08-17 16:52:39 -07:00
Christopher Reichert
3300b5ad16 Merge pull request #1056 from MaxGabriel/yesodCore1.4.13Changelog
Update yesod-core changelog for 1.4.13
2015-08-16 20:48:01 -05:00
Maximilian Tagher
949fa2d426 Slightly improve comment about constant time comparison 2015-08-16 20:50:29 -04:00
Maximilian Tagher
620440d2b6 Update yesod-core changelog for 1.4.13 2015-08-16 19:18:35 -04:00
Greg Weber
0fdb78a6f2 Merge pull request #1055 from Daniel-Diaz/master
mkYesodGeneral: Argument types can now be polymorphic
2015-08-16 11:51:13 -07:00
Michael Snoyman
6b3a5c1b11 Scaffolding update 2015-08-13 13:59:37 +03:00
Daniel Díaz
42ec7f53e9 Depend directly on template-haskell. 2015-08-11 22:10:12 +02:00
Daniel Díaz
4897c24d3f Use CPP to adapt to template-haskell changes according to the version of base used. 2015-08-11 22:07:28 +02:00
Michael Snoyman
128165c19c Merge pull request #1054 from chreekat/keter-build-args
Add build-args to keter subcommand
2015-08-11 18:54:45 +03:00
Bryan Richter
3cae60bb88
Add build-args option to keter subcommand 2015-08-11 08:22:51 -07:00
Michael Snoyman
09343872c4 Version bump 2015-08-11 07:50:24 +03:00
Michael Snoyman
7d85092da2 Version bump 2015-08-11 07:48:56 +03:00
Daniel Díaz
ea62a38464 mkYesodGeneral arguments can now be monomorphic or polymorphic types. It is possible to impose class instances to polymorphic type arguments. 2015-08-10 07:23:26 +02:00
Greg Weber
a938f977b5 version bump for middleware accessebility in yesod-test 2015-08-05 17:48:32 -07:00
Greg Weber
b92ae3093a configurable middleware 2015-08-05 17:48:27 -07:00
Daniel Díaz
366bfbd319 Allow Site types to have type parameters. 2015-08-06 00:35:48 +02:00
Daniel Díaz
9991e307e3 Attempt to add support for parametrized types in mkYesod. 2015-08-06 00:13:28 +02:00
Michael Snoyman
b5077abdd9 Version bump for scaffold 2015-08-04 16:48:11 +03:00
Michael Snoyman
a6fe8c444d Upgrade to newer LTS 2015-08-04 16:44:18 +03:00
Michael Snoyman
4c7dc5caaf Scaffolding update 2015-08-04 16:44:18 +03:00
Greg Weber
0bab753ada Merge pull request #1050 from mpietrzak/master
Fix parameter order for uglifyjs.
2015-08-02 09:28:58 -07:00
Maciej Pietrzak
d1b8ba0e8a Fix parameter order for uglifyjs. 2015-08-02 17:40:49 +02:00
Michael Snoyman
896d2f9236 Allow fsnotify 0.2 2015-07-26 21:49:57 +03:00
Greg Weber
5f58f7b2ed Merge pull request #1044 from hritchie/master
Change done.cg to refer to 'stack build'
2015-07-25 08:08:49 -07:00
Heath Ritchie
37b2c6e095 Change done.cg to refer to 'stack build'
Remove instruction to use cabal install.
Instead direct users to use 'stack build', as is suggested in the quickstart
guide.
2015-07-25 10:40:39 -04:00
Andrew Martin
48657022be Merge pull request #1042 from yesodweb/add_getsYesod_function
Added getsYesod
2015-07-23 13:58:33 -04:00
Andrew Martin
c4d154b512 Added getsYesod 2015-07-23 13:29:16 -04:00
Andrew Martin
81c996f29e Merge pull request #1038 from yesodweb/widget_isstring_instance
Add IsString instance for WidgetT site m ()
2015-07-23 13:21:10 -04:00
Michael Snoyman
8024173e05 Fix warning 2015-07-23 06:24:58 +03:00
Michael Snoyman
8893393ec9 Version bump 2015-07-23 06:18:37 +03:00
Michael Snoyman
e023c769ee Version bump 2015-07-23 06:16:01 +03:00
Michael Snoyman
2d33f90803 Version bump 2015-07-23 06:15:12 +03:00
Bryan Richter
0588bfd6de Merge pull request #1041 from chreekat/stack-keter
Enable stack with yesod keter
2015-07-22 17:32:05 -07:00
Bryan Richter
7851a660a7
Use stack only if stack.yaml exists 2015-07-22 16:45:36 -07:00
Bryan Richter
c6499bbe91
WIP for #1039
This works, but ignores previous cabal(-dev) options. I'll work to add them
back in now.
2015-07-22 13:16:18 -07:00
Bryan Richter
9fbfb62e68
Warning cleanup
Note that configCompilerEx was added in Cabal-1.18.0, not 1.22.
2015-07-22 13:10:50 -07:00
Bryan Richter
57c20d7d31 Extra dep needed for stack 2015-07-22 12:54:48 -07:00
Christopher Reichert
a5a627db58 Clarify IsString instance for Widget only works with Strings. 2015-07-21 13:19:00 -05:00
Christopher Reichert
66ed314866 Document IsString instance for WidgetT. 2015-07-21 12:24:33 -05:00
Andrew Martin
4e354c9e07 Improve type inference for WidgetT IsString instance 2015-07-21 11:37:09 -04:00
Andrew Martin
00635452b9 Add IsString instance for WidgetT site m () 2015-07-21 11:07:52 -04:00
Michael Snoyman
2ebf14aaba Merge pull request #1035 from tolysz/patch-2
Update WebSockets.hs
2015-07-19 15:53:32 -07:00
Marcin Tolysz
1420f627e3 Update WebSockets.hs
Add `send and  receive` `DataMessageE` so the whole WS API is mirrored
2015-07-19 23:49:35 +01:00
Michael Snoyman
46fbb1a615 Have to type quit to quit 2015-07-20 01:29:46 +03:00
Michael Snoyman
9cb48dfa7a Merge branch 'master' of github.com:yesodweb/yesod 2015-07-20 01:25:17 +03:00
Michael Snoyman
beabde14bf Update since/changelog #772 2015-07-20 01:25:09 +03:00
Michael Snoyman
704b904e1f Merge branch 'master' of https://github.com/tolysz/yesod
Conflicts:
	yesod-websockets/yesod-websockets.cabal
2015-07-20 01:23:59 +03:00
Michael Snoyman
d8a831162c Merge pull request #1032 from creichert/master
Fix compilation error in yesod-websockets/sample.hs.
2015-07-15 09:52:53 -07:00
Christopher Reichert
118d33d3b4 Fix compilation error in yesod-websockets/sample.hs. 2015-07-15 11:28:07 -05:00
Michael Snoyman
0b0341a280 vector 0.11 2015-07-15 19:10:17 +03:00
Michael Snoyman
335df65eb8 Merge pull request #1008 from nathankot/generate-spec
Is there a reason why add-handler doesn't generate a spec file?
2015-07-07 08:43:00 -07:00
Michael Snoyman
8de3e80c94 Simplify README based on stack #1021 2015-07-05 15:24:39 +03:00
Michael Snoyman
add408c535 Version bump 2015-07-02 18:53:47 +03:00
Michael Snoyman
56ad4b137b Merge pull request #1027 from andrewthad/master
Don't show source location for logs that don't have that information
2015-07-02 08:52:54 -07:00
Andrew
e37ccee3d7 Use a let binding for greater clarity 2015-06-30 18:30:24 -04:00
Andrew Martin
e327963912 Don't show source location for logs that don't have that information 2015-06-30 17:02:33 -04:00
Michael Snoyman
c2efc73e04 Merge pull request #1022 from bergmark/patch-2
yesod-bin needs directory >= 1.2.1 due to System.Directory.findFiles
2015-06-30 09:29:46 +03:00
Adam Bergmark
79d87f1fd6 yesod-bin needs directory >= 1.2.1 due to System.Directory.findFiles 2015-06-30 07:56:55 +02:00
Michael Snoyman
aff47075b2 Update changelog 2015-06-30 06:49:17 +03:00
Michael Snoyman
aa273c6092 Merge pull request #1011 from geraldus/email-nonce
Use nonce package to generate verification keys and CSRF tokens
2015-06-30 06:48:31 +03:00
Michael Snoyman
a7cccf2a7c yesod devel support for stack 2015-06-29 08:14:04 +03:00
Arthur Fayzrakhmanov (Артур Файзрахманов)
4ba82fad96 Version bump 2015-06-24 20:54:27 +05:00
Arthur Fayzrakhmanov (Артур Файзрахманов)
2074915962 Apply stylish-haskell, organize imports 2015-06-24 20:54:27 +05:00
Arthur Fayzrakhmanov (Артур Файзрахманов)
dfd14ea16d Remove redundant imports 2015-06-24 20:54:27 +05:00
Arthur Fayzrakhmanov (Артур Файзрахманов)
1891e573fc Use nonce package in Auth.GoogleEmail2
Generate CSRF tokens using `nonce` package
2015-06-24 20:54:20 +05:00
Arthur Fayzrakhmanov (Артур Файзрахманов)
4b05cd83f6 Use nonce package in Auth.Email
Generate verification keys using `nonce` package.
2015-06-24 20:54:11 +05:00
Michael Snoyman
bd7659017f Add missing ChangeLog #1019 2015-06-24 05:02:36 +03:00
Michael Snoyman
5168baa94a Scaffolding update 2015-06-14 14:23:51 +03:00
Michael Snoyman
524297dafc persistent 2.2 2015-06-14 13:32:40 +03:00
Nathan Kot
7cffdf5f6c Generate spec file 2015-06-10 03:09:24 +09:00
Michael Snoyman
fd9610a6a0 Merge pull request #1006 from pikajude/master
Add ConstrainedClassMethods to yesod-auth
2015-06-08 16:07:10 +03:00
Jude Taylor
886e6bdd2c add ConstrainedClassMethods 2015-06-08 00:30:16 -07:00
Greg Weber
0e24083749 Merge pull request #1005 from yesodweb/stack-build
add a stack.yaml file
2015-06-07 18:42:51 -07:00
Greg Weber
aa94e5e249 add a stack.yaml file 2015-06-07 21:41:18 -04:00
Michael Snoyman
9a0dbda44d Merge pull request #1003 from andrewthad/master
Make stripHandlerT and subHelper available for public use
2015-06-07 17:01:16 +03:00
Andrew Martin
edf7ada64c Export subHelper directly rather than doing a module export 2015-06-07 08:45:38 -04:00
Andrew Martin
b88295cf05 stop the module import cycle 2015-06-05 13:20:03 -04:00
Andrew Martin
92aa58dee5 Make stripHandlerT and subHelper available for public use 2015-06-05 08:07:37 -04:00
Michael Snoyman
b20c19d2c5 Version bump 2015-06-04 09:43:06 +03:00
Michael Snoyman
f2b435fa35 Merge pull request #1001 from ygale/exportLogFormatting
Export log formatting
2015-06-04 09:41:22 +03:00
Yitzchak Gale
f3d9bb2555 Unneeded import of Data.Maybe in Yesod.Core.Class.Yesod. 2015-06-03 11:48:02 +03:00
Yitzchak Gale
95c8d40010 Fix haddock about default log level. 2015-06-03 11:45:29 +03:00
Yitzchak Gale
bef07c5e12 Fix reference to default in haddock for shouldLog. 2015-06-03 11:18:33 +03:00
Yitzchak Gale
bd161ef5f7 Export defaults for logging methods of Yesod. 2015-06-03 11:16:43 +03:00
Greg Weber
b1bc30addd Merge pull request #1000 from yesodweb/add-Dockerfile
add a Dockerfile for haskell development
2015-05-27 20:47:04 -07:00
Greg Weber
82da9b0fe8 add a Dockerfile for haskell development 2015-05-27 11:43:16 -04:00
Michael Snoyman
10c029c230 Add README about yesod-scaffold 2015-05-27 14:04:35 +03:00
Michael Snoyman
848b1ab3e5 Collapse paths in keter bundle 2015-05-19 08:17:46 +03:00
Michael Snoyman
814157a018 Fix build for project-template < 0.2 2015-05-17 11:25:12 +03:00
Michael Snoyman
ef9322914e Version bump 2015-05-17 10:35:30 +03:00
Michael Snoyman
0927468580 Merge branch 'yesod_init_args' of https://github.com/triplepointfive/yesod 2015-05-17 10:33:10 +03:00
Michael Snoyman
2d8507cbee Be slightly more verbose for #992 2015-05-17 10:31:40 +03:00
Ilya Smelkov
3af8426567 Add Generic typeclass to BackendInput and Backend 2015-05-13 17:42:17 +03:00
Michael Snoyman
d9d085e945 Fix lower bound 2015-05-12 14:51:08 +03:00
Michael Snoyman
48a3bdeadb Drop system-filepath 2015-05-12 12:35:04 +03:00
Michael Snoyman
ae555aa6f0 Drop system-filepath 2015-05-12 12:01:50 +03:00
Ilya Smelkov
50f0859e13 Validate input params before processing 2015-05-11 14:50:56 +03:00
Ilya Smelkov
ce268e451d yesod init accepts database 2015-05-11 14:40:52 +03:00
Ilya Smelkov
067a21c60f yesod init accepts app name 2015-05-09 00:07:44 +03:00
Michael Snoyman
4fcabc073c GHC 7.10 support 2015-04-30 15:05:18 +03:00
Michael Snoyman
a9bf0bf7ea Version bump 2015-04-29 13:57:58 +03:00
Michael Snoyman
d82a828d89 Scaffolding updates, including #982 2015-04-29 13:55:50 +03:00
Michael Snoyman
3683961ac1 Travis: use 7.10 and not 7.6 2015-04-29 13:50:15 +03:00
Michael Snoyman
931caaa2c0 Allow lowercasing of scaffolded values #982 2015-04-29 13:29:40 +03:00
Michael Snoyman
fa0fbb4569 Version bump 2015-04-26 18:37:33 +03:00
Michael Snoyman
9db6ef3e69 Merge pull request #980 from rzetterberg/master
Adds export of email verify route
2015-04-26 18:36:24 +03:00
Richard Zetterberg
9e1516594e Fixes faulty type annotations 2015-04-26 15:28:45 +02:00
Richard Zetterberg
770a7a29d2 Adds export of verify route
This allows users of the library to easily render VerUrl to use in
verification emails to new users, if the user was created outside
of the regular register functionality.
2015-04-26 14:55:12 +02:00
Michael Snoyman
0b6035ffda Merge pull request #978 from wiz/patch-1
Provide a hint on how to use `loginHandler`.
2015-04-24 12:15:12 +03:00
Alexander Bondarenko
5cc440129d Provide a hint on how to use loginHandler. 2015-04-24 12:11:10 +03:00
Michael Snoyman
d0010b34aa Merge pull request #973 from srayuws/master
update warp-tls's version
2015-04-19 10:37:07 +03:00
srayuws
a54d8376f8 update warp-tls's version 2015-04-19 15:33:16 +08:00
Michael Snoyman
afaf458a9b Version bump 2015-04-17 12:01:04 +03:00
Michael Snoyman
1f19ca1752 Version bump 2015-04-17 11:59:49 +03:00
Michael Snoyman
3c898babfb Remove zlib upper bound 2015-04-16 19:06:44 +03:00
Michael Snoyman
067a96c85d Merge pull request #970 from wiz/master
Add `copy-to-args` section to keter.yaml which allows all kinds of options.
2015-04-16 17:48:41 +03:00
Alexander Bondarenko
31ae5fdee7 Add copy-to-args section to keter.yaml which allows all kinds of options. 2015-04-16 17:16:50 +03:00
Michael Snoyman
3fd99e77e7 Merge pull request #969 from urbanslug/master
Updated yesod-bin/Devel.hs
2015-04-16 10:08:23 +03:00
Njagi Mwaniki
58a07b0ea3
Added conditional compilation so that yesod-bin/Devel.hs can pass travis-ci tests.
Signed-off-by: Njagi Mwaniki <mwanikibusiness@gmail.com>
2015-04-15 18:50:05 +03:00
Njagi Mwaniki
c3a05d1f7b
Updated yesod-bin/Devel.hs
Replaced deprecated function `configCompiler` with `configCompilerEx`
  Removed unused argument "_opts" from function `lockFile`
  Added newline before guards which I think makes it more beginner friendly.

Signed-off-by: Njagi Mwaniki <mwanikibusiness@gmail.com>
2015-04-15 17:14:45 +03:00
Michael Snoyman
4bc0ad96fe Merge pull request #968 from rdesfo/master
updated deprecated settingsPort, settingsHost, settingsOnException
2015-04-13 21:09:32 +03:00
Ryan Desfosses
c62166e67b updated deprecated settingsPort, settingsHost, settingsOnException 2015-04-13 13:34:30 -04:00
Michael Snoyman
97b6857912 Version bump 2015-04-05 16:51:12 +03:00
Michael Snoyman
f0673d84ab Merge pull request #966 from Codas/ghc-7.10.1
Make yesod-bin build on 7.10.1
2015-04-05 12:02:30 +03:00
Arne Link
91829fc82a Add support for GHC 7.10.1 2015-04-03 16:34:08 +02:00
Michael Snoyman
882956255a Better support for multiple cookie headers 2015-04-02 16:40:14 +03:00
Michael Snoyman
c2e836bf3a Some user-facing TLS info (pinging @chrisdone @DanBurton) 2015-03-31 09:30:53 +03:00
Michael Snoyman
c430bf4a91 Merge pull request #964 from DanBurton/master
Add support for https on yesod devel
2015-03-31 09:19:13 +03:00
Dan Burton
85f16d0e9f Used race_ for clarity 2015-03-30 13:10:02 -07:00
Dan Burton
6562e6067c Second reverseproxy now handles incoming https requests 2015-03-30 12:57:07 -07:00
Michael Snoyman
8fd60482a0 Fix Travis script 2015-03-30 13:55:53 +03:00
Dan Burton
2e573f440a Add a second reverse proxy for tls 2015-03-26 13:41:50 -07:00
Michael Snoyman
56d4b8c3ee Version bump 2015-03-26 14:52:36 +02:00
Michael Snoyman
e50ce7ca1e Merge branch 'master' of https://github.com/s9gf4ult/yesod 2015-03-26 14:51:14 +02:00
Aleksey Uimanov
79dc6c33b9 add lookupBasicAuth and lookupBearerAuth functions 2015-03-26 17:19:53 +05:00
Michael Snoyman
e3e5cb80eb A bit more version bumping 2015-03-24 08:54:09 +02:00
patrick brisbin
cb27424083
Version bump to 1.4.4 2015-03-23 18:01:26 -04:00
patrick brisbin
3564e1f746
Add AuthenticationResult and authenticate function
- getAuthId returns Maybe AuthId with no useful information in the
  Nothing case.
- AuthenticationResult includes whether it was a User or Server error
  (with an accompanying message) in the failure case.
- User errors are displayed back to the user and have a 401 status in
  JSON responses. Server errors are logged and a generic error message
  is presented to the user, with a 500 status in JSON responses.

Resolves #956
2015-03-23 18:01:26 -04:00
Michael Snoyman
c7d41f2395 Scaffold updates 2015-03-22 14:05:37 +02:00
Michael Snoyman
3171e2f243 Merge pull request #957 from joom/master
Added command-line args option to yesod-bin add-handler
2015-03-20 07:36:03 +02:00
Joomy Korkut
54d1c2d8a0 Added command-line args option to yesod-bin add-handler (resolves #892) 2015-03-19 09:33:04 -04:00
Michael Snoyman
e85be6f118 Use 307 redirect for cleaning paths and non-GET requests #951 2015-03-15 11:45:32 +02:00
Michael Snoyman
70c51d29fc nocopyto switch (closes #952) 2015-03-12 09:15:49 +02:00
Michael Snoyman
f8847bd231 runFormPost: proper behavior for missing input #950 2015-03-11 07:25:53 +02:00
Michael Snoyman
376b6f9c0d Allow blaze-builder 0.4 2015-03-10 14:56:44 +02:00
Michael Snoyman
d83bcb62a1 Version bump 2015-03-06 07:30:45 +00:00
Michael Snoyman
9429d163b6 Merge pull request #947 from chreekat/keter-package-extra-files
Add and process Keter option 'extraFiles'
2015-03-06 09:15:38 +02:00
Bryan Richter
5b9e616ee2 Minor refactor of keter function 2015-03-04 09:55:03 -08:00
Bryan Richter
6b43e08f89 Add and process Keter option 'extraFiles' 2015-03-04 09:31:26 -08:00
Michael Snoyman
76ed92fe9f Update PATH 2015-03-01 14:34:51 +02:00
Michael Snoyman
29443a4c02 Travis fixes 2015-03-01 14:12:08 +02:00
Michael Snoyman
0fcd9b3c98 Attempted update to Travis config 2015-03-01 14:01:28 +02:00
Michael Snoyman
94b8842813 Version bump 2015-03-01 13:51:19 +02:00
Michael Snoyman
af600271bf Missing changes 2015-03-01 13:50:21 +02:00
Michael Snoyman
ed1d6ad6bb Version bump 2015-03-01 13:39:48 +02:00
Michael Snoyman
a2da368697 Merge pull request #945 from paul-rouse/master
Disregard proxy environment variables in yesod devel
2015-03-01 13:35:31 +02:00
Paul Rouse
5281d7aa3e Remain compatible with pre-0.4.7 http-client 2015-03-01 11:20:19 +00:00
Paul Rouse
e69ea760e1 Version bound on http-client 2015-03-01 08:17:20 +00:00
Paul Rouse
761e7dd374 Disregard proxy environment variables in yesod devel 2015-02-28 21:38:11 +00:00
Michael Snoyman
c7b4f1ddbe Version bump 2015-02-24 18:38:54 +02:00
Michael Snoyman
d1cfe481fd Scaffolding update: minimal uses yesod-core 2015-02-24 18:32:41 +02:00
Michael Snoyman
5c47486c86 Merge pull request #941 from joelteon/master
Add pragmas for GHC 7.10
2015-02-23 07:20:55 +02:00
Christopher Reichert
11fa46d8ba Merge pull request #940 from haroldl/master
Improve error message when "yesod devel" complains about the GHC version...
2015-02-22 22:19:18 -06:00
Joel Taylor
dbd5fbfea2 add pragmas 2015-02-22 17:18:13 -08:00
Harold Lee
f8fb6d3dc3 Improve error message when "yesod devel" complains about the GHC version.
I hit this problem and the fix was to reinstall yesod-bin (because I'd
upgraded my version of ghc):

    cabal install --reinstall yesod-bin

See issue #476.
2015-02-22 13:35:13 -08:00
Michael Snoyman
df0cf82f56 Allow path-pieces 0.2 2015-02-19 11:56:24 +02:00
Michael Snoyman
d82d3843b4 Version bump 2015-02-19 08:33:41 +02:00
Michael Snoyman
e60356bf9a Merge branch 'googleemail2-person' of https://github.com/zudov/yesod 2015-02-19 08:31:31 +02:00
Konstantin Zudov
18a8513e38 Save the access_token only from special handler 2015-02-16 14:16:26 +02:00
Michael Snoyman
a9ff4f44a6 Scaffolding update 2015-02-16 10:39:45 +02:00
Konstantin Zudov
7ed5d4ad39 Added means to fetch user's Google profile
The existing GoogleEmail2 auth did that:
  - Acquire user access token with offline access
  - Use token to acquire user's profile
  - Build `Creds` with user's email as `ident` and the other profile
    details as stringy key-value pairs in `credsExtra`

This wasn't enough for me, for several reasons:
  - Access token was not saved after authentication. If we request 'offline'
    token why not to have a way of using it later.
  - Stringy key-value profile is not nice and `credsExtra` can be accessed
    only from `getAuthId`
  - I might want to request the profile after authentication process

So I've added the needed features.
  - The access token is saved in a session
  - There is a `Person` type with `FromJSON` instance and `getPerson`
    can be used to acquire it from `HandlerT`
2015-02-16 09:44:13 +02:00
Michael Snoyman
a5583c75b2 Version bump 2015-02-09 07:25:40 +02:00
Michael Snoyman
6751d24d75 Version bumps 2015-02-09 07:25:08 +02:00
Michael Snoyman
0100b3e525 Merge pull request #927 from MaxGabriel/yesodTestReadmeExampleFix
Update the example in the yesod-test README
2015-02-09 07:21:19 +02:00
Michael Snoyman
e05f43218c Merge pull request #928 from yesodweb/widget-semigroup
Semigroup instance for WidgetT
2015-02-09 06:57:47 +02:00
Greg Weber
eda07c2bf3 Merge pull request #929 from MaxGabriel/moreSemigroups
Add more semigroups instances
2015-02-08 18:35:43 -08:00
Maximilian Tagher
e57b62235f Add more semigroups instances 2015-02-08 16:55:06 -08:00
Greg Weber
8086ca5d57 Semigroup instance for WidgetT 2015-02-08 14:09:10 -08:00
Michael Snoyman
7cc9700774 Updated scaffolding 2015-02-08 09:58:24 +02:00
Maximilian Tagher
b9246d26a1 Update the example in the yesod-test README
* Fixes a few typos/formatting issues as well
* Closes #920
2015-02-07 23:13:05 -08:00
Michael Snoyman
887d7e8004 Doc update 2015-02-08 07:18:56 +02:00
Michael Snoyman
f1103a2bd6 Version bump 2015-02-08 07:17:55 +02:00
Michael Snoyman
85d4477f96 Remove defunct reference to SpecialResponse (fixes #925) 2015-02-08 07:15:16 +02:00
Greg Weber
df304d6393 Merge pull request #923 from s9gf4ult/master
Perform `onLogout` before session cleaning
2015-02-04 14:20:12 -08:00
Aleksey Uimanov
e64773cd41 Perform onLogout before session cleaning 2015-02-05 00:21:14 +05:00
Michael Snoyman
c4824b9ceb Version bump 2015-02-04 18:52:29 +02:00
Michael Snoyman
f3fea0a7bd Merge pull request #922 from MaxGabriel/fixAddHandlerNewlines
Fix add-handler putting two routes on one line
2015-02-04 18:49:23 +02:00
Maximilian Tagher
54cd923ed5 Fix add-handler putting two routes on one line
* If there is a new line at the end of the file, add the route as normal
* If there isn't, add a newline character before the route
* Closes #921
2015-02-04 08:45:01 -08:00
Michael Snoyman
5a4c7e7fa0 Version bump 2015-02-04 17:46:07 +02:00
Maximilian Tagher
3de93e3197 Remove deprecated addNonce and addNonce_ 2015-01-28 08:42:50 -08:00
Michael Snoyman
5d431fbdb5 Merge pull request #917 from MaxGabriel/yesodTest-deprecateNonces
Move yesod-test to using the term "token" instead of nonce.
2015-01-28 08:37:30 -08:00
Maximilian Tagher
e26f6f5fbe Update API documentation to take the nonce/token switchover into account. 2015-01-27 20:01:06 -08:00
Maximilian Tagher
94af9c6bdd Move yesod-test to using the term "token" instead of nonce.
Addresses part #1 of #914
2015-01-27 19:50:06 -08:00
Michael Snoyman
70b081af8d Merge pull request #916 from MaxGabriel/documentYesodTest
Document much of yesod-test, especially the "Making Requests" section
2015-01-27 10:11:43 -08:00
Maximilian Tagher
cb4785cf28 Document much of yesod-test, especially the "Making Requests" section 2015-01-25 15:20:25 -08:00
Michael Snoyman
2fb7cccf15 Version bump 2015-01-21 23:43:40 +02:00
Michael Snoyman
a6a8b3fa68 More scaffolding updates 2015-01-21 23:42:55 +02:00
Greg Weber
b5648f8756 Merge pull request #911 from MaxGabriel/patch-3
Fix pluralization in template loading error message
2015-01-18 09:23:49 -08:00
Maximilian Tagher
e2bcad6209 Fix pluralization in template loading error message 2015-01-17 22:41:55 -08:00
Michael Snoyman
f9ee741b92 Scaffolding update 2015-01-15 08:38:34 +02:00
Michael Snoyman
9a3a2a5aa5 Version bump 2015-01-09 11:04:18 +02:00
Michael Snoyman
f5ea1742ef Merge pull request #904 from legrostdg/master
Updated french translation of Yesod.Auth.Message.
2015-01-09 11:03:01 +02:00
Félix Sipma
9c1a970305 Updated french translation of Yesod.Auth.Message. 2015-01-07 19:40:37 +01:00
Michael Snoyman
9f7f5dab1b Version bump 2015-01-07 13:20:04 +02:00
Michael Snoyman
a63e685e84 Merge pull request #903 from gostrc/fix-spelling
fix documentation spelling
2015-01-07 07:13:35 +02:00
Thomas Dziedzic
6398206b8f fix documentation spelling 2015-01-06 21:10:12 -08:00
Michael Snoyman
e79a85b289 Scaffolding update yesodweb/yesod-scaffold#50 2015-01-02 09:06:49 +02:00
Michael Snoyman
587127dda9 Version bump 2014-12-31 08:09:42 +02:00
Michael Snoyman
6c3152e150 Merge pull request #899 from MaxGabriel/addHandlerArguments
Have add-handler include the function arguments
2014-12-31 08:07:14 +02:00
Maximilian Tagher
3f20c759dc Have add-handler include the function arguments 2014-12-30 19:11:07 -08:00
Michael Snoyman
e96d1c3622 Version bumps 2014-12-30 05:58:39 +02:00
Greg Weber
5e84dbb8ab change get_ to get 2014-12-29 16:17:37 -08:00
Michael Snoyman
d28fd7ddfc Merge pull request #896 from gxtaillon/master
Updated french translation of Yesod.Auth.Message.
2014-12-28 09:22:12 +02:00
gxtaillon
c9dff10bd1 Updated french translation of Yesod.Auth.Message. 2014-12-28 00:51:43 -05:00
Michael Snoyman
ef16c97334 Merge pull request #895 from geraldus/i18n-gman
Support "Logout" message
2014-12-22 09:21:25 +02:00
Артур Файзрахманов
7875b6aa87 Support "Logout" message
Added support for `Logout` message, all translations made with Google
Translate, except: Russian translation (by hand) and Dutch translation
(do not translated)
2014-12-22 01:19:47 +05:00
Michael Snoyman
bed6dafce8 Doc link updates 2014-12-21 15:23:52 +02:00
Michael Snoyman
f3308026a7 Add missing .hsfiles 2014-12-21 10:37:40 +02:00
Michael Snoyman
7faea277cc Add mini scaffolding 2014-12-20 21:31:39 +02:00
Michael Snoyman
b3754498ec Version bump 2014-12-20 18:25:15 +02:00
Patrick Boe
8b7c58f381 added functions to simplify application of an ssl-only policy to a site 2014-12-20 10:26:32 -05:00
Michael Snoyman
09df930de3 monad-control 1.0 2014-12-17 17:58:19 +02:00
Michael Snoyman
c1f1e91fa9 Scaffolding update 2014-12-17 11:36:00 +02:00
Michael Snoyman
f5a9dae1ea Merge branch 'master' of github.com:yesodweb/yesod 2014-12-16 10:17:25 +02:00
Michael Snoyman
d28b6eae3f No args in keter.yml 2014-12-16 10:14:44 +02:00
Michael Snoyman
13d156613e Merge pull request #890 from creichert/master
Update README in yesod-websockets to address the fixed timeout issue.
2014-12-16 08:54:03 +02:00
Christopher Reichert
ae6a03d36f Update README in yesod-websockets to address the timeout issue. 2014-12-15 21:59:57 -06:00
Michael Snoyman
4b1758e3e3 Improved doc link 2014-12-15 23:47:29 +02:00
Michael Snoyman
7b5ffac803 Version bump 2014-12-15 09:01:15 +02:00
Michael Snoyman
af7b2dd230 Merge pull request #889 from creichert/master
Keep client WebSocket connections alive using Network.WebSockets.forkPingThread
2014-12-15 08:47:04 +02:00
Christopher Reichert
c98fbb0596 Depend on websockets >= 0.9 in yesod-websockets.cabal.
The forkPingThread function was added in version 0.9 of websockets.

Complimentary fix to #889.
2014-12-14 16:11:25 -06:00
Christopher Reichert
fbc6c9fc13 Fix if then statement layout in Scaffolder.
Fixes the Travis build error:

```
Scaffolding/Scaffolder.hs:99:34:
    Unexpected semi-colons in conditional:
        if isBare; then LT.replace "cd PROJECTNAME && " ""; else LT.replace
                                                                   "PROJECTNAME" (LT.pack project)
    Perhaps you meant to use -XDoAndIfThenElse?
```
2014-12-14 14:44:24 -06:00
Christopher Reichert
e7a5b48898 Bump yesod-websockets version. 2014-12-14 14:13:06 -06:00
Christopher Reichert
595ee70386 Keep client connections alive using Network.WebSocket.forkPingThread. 2014-12-14 14:06:44 -06:00
Michael Snoyman
9d748b2c35 Merge branch 'master' of github.com:yesodweb/yesod 2014-12-11 12:42:12 +02:00
Michael Snoyman
b0b6257963 Add README.md to tarball 2014-12-11 12:18:11 +02:00
Greg Weber
807a446ad7 remove ./scripts/install reference 2014-12-10 15:15:54 -08:00
Michael Snoyman
bfcb2876f0 Merge pull request #885 from roSievers/patch-1
Fix issue #884 (Scaffolding with --bare)
2014-12-08 07:29:36 +02:00
Rolf Sievers
a421d638f3 Fix issue #884. 2014-12-07 15:18:19 +01:00
Michael Snoyman
94dad6e116 Corrected changelog 2014-11-30 15:42:55 +02:00
Michael Snoyman
3876ae0460 Version bump 2014-11-30 15:40:57 +02:00
peng
05966b8a00 add 'jqueryDatePickerDayField' with jquery's datepicker as the underlying implementation and keep 'jqueryDayField' behaving the same as before. 2014-11-30 19:25:53 +08:00
Michael Snoyman
5f21c73d7d Changelog fix and typo correction 2014-11-30 07:39:40 +02:00
Greg Weber
05f2a7631c add Yesod.Core.Unsafe module 2014-11-29 17:45:56 -08:00
Michael Snoyman
eeb0bb57d1 Version bump 2014-11-29 19:20:35 +02:00
Michael Snoyman
f82bd1885f Updated scaffolding 2014-11-29 19:20:02 +02:00
Michael Snoyman
f9e3e961b2 Merge pull request #877 from MaxGabriel/documentFieldsOptions
Document the Options section of Fields.hs
2014-11-29 17:58:40 +02:00
Michael Snoyman
04e89d33da Merge pull request #879 from MaxGabriel/patch-2
Fix typos; verison => version
2014-11-29 17:31:54 +02:00
Maximilian Tagher
f1bdd0ace8 Fix typos; verison => version 2014-11-28 17:02:10 -05:00
Maximilian Tagher
ce74e23d87 timeField now uses type="time"
* Also removes deprecation from `timeField`
* Also mildly discourages using `timeFieldTypeText`
2014-11-28 15:57:01 -05:00
Maximilian Tagher
5e6846d572 Finish documenting fields 2014-11-28 13:22:06 -05:00
Maximilian Tagher
1a38a74424 docs wip 2014-11-28 13:10:29 -05:00
Michael Snoyman
4f7180ea2d Version bumps/docs 2014-11-28 08:00:18 +02:00
Michael Snoyman
9a64b1bdb0 MonadLoggerIO instances 2014-11-28 07:55:43 +02:00
Michael Snoyman
c5519b36ef Rename changelog.md to ChangeLog.md (it was bugging me) 2014-11-28 07:47:52 +02:00
Michael Snoyman
c95e74053b Version bump 2014-11-28 07:47:30 +02:00
Felipe Lessa
a87778a003 Merge pull request #874 from MaxGabriel/addTypeTime
Add type="time" to timeField
2014-11-25 15:32:29 -02:00
Greg Weber
b8d474e77e Merge pull request #876 from yesodweb/pb-env-client-session-backend
Add envClientSessionBackend, ENV-based session key
2014-11-25 09:18:09 -08:00
patrick brisbin
21cd47cc98
Add envClientSessionBackend, ENV-based session key
This can be useful if:

1. You can't rely on a persistent file system (e.g. Heroku)
2. Your application is open source (e.g. you can't commit the key)

By keeping a consistent value in the environment variable, your users will
have consistent sessions without relying on the file system.

Usage:

    makeSessionBackend _ = fmap Just $ envClientSessionBackend 120 "SESSION_KEY"
2014-11-25 11:15:13 -05:00
Maximilian Tagher
222c9e3c99 Adds timeFieldTypeText and timeFieldTypeTime. Deprecates 'timeField'
* Also documents all 3 functions
2014-11-25 10:56:30 -05:00
Maximilian Tagher
33d9f5e18c Support different types for timeField 2014-11-25 10:36:34 -05:00
Maximilian Tagher
1944f02c84 Add type="time" to timeField 2014-11-25 10:34:46 -05:00
Michael Snoyman
4ee1eb17cd Generalize a type signature a bit 2014-11-25 12:03:54 +02:00
Michael Snoyman
a65349612e Support time 1.5 2014-11-25 07:18:11 +02:00
Michael Snoyman
c9d934b920 Merge pull request #875 from MaxGabriel/documentFields
Document Fields.hs
2014-11-25 06:58:40 +02:00
Maximilian Tagher
8e025c8226 Further improvements 2014-11-24 23:25:39 -05:00
Maximilian Tagher
af63a60c69 More stuff 2014-11-24 19:58:36 -05:00
Maximilian Tagher
07090ccb7e Document Fields.hs WIP 2014-11-24 14:11:25 -05:00
Greg Weber
c284e1f8b0 Merge pull request #865 from lambdacms/form-i18n-nl
Adds dutch form translations
2014-11-24 10:05:15 -08:00
Michael Snoyman
3679e67927 Version bump 2014-11-24 07:51:51 +02:00
Michael Snoyman
62a037f65f Doc update 2014-11-24 07:50:51 +02:00
Michael Snoyman
4b1966473e Disambiguate a name 2014-11-23 22:40:42 +02:00
Michael Snoyman
846033b176 Fix some haddocks 2014-11-23 18:54:50 +02:00
Michael Snoyman
5622e96725 README.md 2014-11-23 12:18:41 +02:00
Michael Snoyman
f8b9a702b8 Add missing import 2014-11-23 12:13:25 +02:00
Michael Snoyman
0af76fa97b Only update expires time once per hour 2014-11-23 12:10:22 +02:00
Felipe Lessa
d6e5469179 Merge pull request #873 from MaxGabriel/documentBootstrap3
Document Yesod.Form.Bootstrap3
2014-11-23 00:33:21 -02:00
Maximilian Tagher
2d31b3155d Improves code formatting
* Fixes bug where @<button>@ was being treated as a Haskell function reference
* Uses '<*' instead of @<*@, since <* is a Haskell function (though this doesn't appear to make the link work)
2014-11-22 17:23:12 -08:00
Maximilian Tagher
f4e8ac9496 Fix usages of bootstrapSubmit 2014-11-22 17:04:48 -08:00
Maximilian Tagher
f84e9703ed Revision 1 of Bootstrap 3 documentation 2014-11-22 16:27:23 -08:00
Michael Snoyman
6c693d8793 Merge pull request #872 from DaveCTurner/master
`neverExpires` sets 'Expires' header to be a year from now.
2014-11-22 17:50:52 +02:00
Maximilian Tagher
5038bea627 Document Yesod.Form.Bootstrap3 2014-11-21 20:17:55 -08:00
David Turner
42f098ff64 neverExpires sets 'Expires' header to be a year from now. 2014-11-21 17:40:32 +00:00
Michael Snoyman
5d771e49bb Minor indentation cleanup 2014-11-21 08:22:17 +02:00
Michael Snoyman
213dcbd985 Fix some warnings 2014-11-21 08:21:15 +02:00
Michael Snoyman
11ae185c83 Switch from Monoid to Semigroup 2014-11-21 08:20:06 +02:00
Michael Snoyman
65baf35d0c Make EnvUsage more extensible 2014-11-20 17:11:41 +02:00
Michael Snoyman
5a4ebf394d More EnvUsage constructors 2014-11-20 09:48:22 +02:00
Michael Snoyman
a0836cf955 Version bump 2014-11-20 02:18:44 +02:00
Michael Snoyman
7fcddb6ee3 Provide Example instance for YesodExample 2014-11-20 02:14:06 +02:00
Michael Snoyman
79db398a54 EnvUsage for better control 2014-11-20 01:05:17 +02:00
Michael Snoyman
35511d2466 Nicer _env: syntax (thanks @gregwebs) 2014-11-20 00:53:29 +02:00
Michael Snoyman
e896322493 Merge pull request #871 from lambdacms/auth-i18n-nl
Dutch authentication translation messages
2014-11-20 00:32:27 +02:00
Mats Rietdijk
0678281352 Adds missing dutch translation and improved another translation 2014-11-19 23:02:35 +01:00
Mats Rietdijk
31fb28850c Adds dutch translations to yesod-auth 2014-11-19 22:47:32 +01:00
Michael Snoyman
ff9e2553ed Add makeYesodLogger 2014-11-19 22:46:06 +02:00
Michael Snoyman
bb48e1cbfc Add more helpers for scaffolding 2014-11-19 22:39:06 +02:00
Michael Snoyman
86ad70da6a Make staticRoutes more resilient to missing imports 2014-11-19 21:41:46 +02:00
Michael Snoyman
fb42a6d4bb Allow devel.hs in subdirs 2014-11-19 21:11:49 +02:00
Michael Snoyman
d7bf7a1215 Yesod.Default.Config2 2014-11-19 21:08:43 +02:00
Michael Snoyman
b15ce6b1ea Version bump 2014-11-19 11:10:45 +02:00
Michael Snoyman
9a4348a0e3 Improve etag supported fpco/stackage-server#29 #868 #869 2014-11-19 11:03:55 +02:00
Michael Snoyman
ee3a3cc806 Merge pull request #867 from gsingh93/patch-1
Removed duplicate names from .gitignore
2014-11-17 17:52:47 +02:00
Gulshan Singh
f3b5edcac6 Removed duplicate names from .gitignore 2014-11-17 10:45:49 -05:00
Michael Snoyman
6568e39383 Version bump 2014-11-17 10:06:43 +02:00
Michael Snoyman
a689b0b268 Scaffolding update 2014-11-17 09:58:13 +02:00
Michael Snoyman
b38abdba0f notModified and setEtag 2014-11-15 20:31:27 +02:00
Michael Snoyman
d1815857df Version bump 2014-11-13 23:38:33 +02:00
Michael Snoyman
c0f0c13352 Disable tests and benchmarks for yesod devel #864 2014-11-13 23:36:03 +02:00
Greg Weber
f90397ad3d Merge pull request #863 from sol/fix-warnings
yesod-test: Fix deprecation warnings
2014-11-11 07:38:59 -08:00
Rutger
76e19207cc Adds dutch form translations 2014-11-11 16:12:26 +01:00
Simon Hengel
89e4e96698 yesod-test: Fix deprecation warnings 2014-11-11 22:07:31 +08:00
Michael Snoyman
b152faecf3 Version bump 2014-11-10 07:21:12 +02:00
Michael Snoyman
ec987529ba Version bump 2014-11-09 14:43:25 +02:00
Michael Snoyman
30780add67 Scaffolding update 2014-11-09 14:32:20 +02:00
Michael Snoyman
1d88c61306 Merge pull request #860 from sol/master
Forward compatibility with Hspec 2.0
2014-11-09 14:22:34 +02:00
Simon Hengel
b6c894061e Forward compatibility with Hspec 2.0 2014-11-09 20:15:50 +08:00
Luite Stegeman
87e06494ea restore default options injection 2014-10-29 14:18:41 +01:00
Greg Weber
898c0a1e18 test case for toWidget* functions 2014-10-27 21:16:03 -07:00
Michael Snoyman
94491f6417 Version bump 2014-10-23 05:59:32 +03:00
Michael Snoyman
f26aa4d5b4 Version bump 2014-10-23 05:58:32 +03:00
Michael Snoyman
21a7d47f3b Fixes for import Handler indentation 2014-10-23 05:58:32 +03:00
Michael Snoyman
245041bc92 Merge pull request #854 from paul-rouse/master
Redirect dynamically in GoogleEmail2 login page
2014-10-21 11:25:15 +03:00
Paul Rouse
fbb0313589 Redirect dynamically in GoogleEmail2 login page 2014-10-21 09:09:34 +01:00
Michael Snoyman
f49ddc8047 Version bump 2014-10-21 09:21:43 +03:00
Michael Snoyman
973b0bd6d7 Add requires-secure to keter file 2014-10-21 09:21:21 +03:00
Michael Snoyman
8a6b4f4523 Yesod.Form.Input cleanup/documentation 2014-10-21 09:08:51 +03:00
Michael Snoyman
5a426529db Version bump/changelog start 2014-10-20 11:53:57 +03:00
Michael Snoyman
972e117005 More efficient token generation
Old code would create a new System.Random generator each time, which
requires going to the system entropy store. New code caches an
mwc-random gen at startup.
2014-10-20 10:34:38 +03:00
Michael Snoyman
658f31e0d7 Version bump 2014-10-19 17:05:17 +03:00
Michael Snoyman
b83835b421 Updated scaffolding: proper logging for Persistent 2014-10-19 17:05:03 +03:00
Michael Snoyman
27cfef6edb Add ViewPatterns to scaffold 2014-10-16 19:20:42 +03:00
Michael Snoyman
cb65f421bf Minor scaffolding updates 2014-10-13 10:29:56 +03:00
Michael Snoyman
e1a239a749 optparse-applicative 0.11 2014-10-13 10:29:22 +03:00
Michael Snoyman
dfd059165d Version bump 2014-10-13 09:40:27 +03:00
Michael Snoyman
8570b4568f Merge pull request #849 from MaxGabriel/requiredTextArea
Allow textareaFields to have a required attribute
2014-10-13 09:17:59 +03:00
Maximilian Tagher
dd6a184052 Allow textareaFields to have a required attribute
(Just like `htmlField` does)
2014-10-10 18:07:33 -07:00
Greg Weber
4d4f0c137c Merge pull request #848 from dschalk/patch-5
Create README.md
2014-10-07 09:42:07 -05:00
dschalk
9574404153 Create README.md 2014-10-07 10:34:31 -04:00
Michael Snoyman
20b49da658 Scaffolding update (bootstrap 3) 2014-10-07 12:55:12 +03:00
Michael Snoyman
3b310a7103 yesodWithInternalState 2014-10-07 07:42:02 +03:00
Michael Snoyman
8672a3c197 Merge pull request #845 from dschalk/patch-2
Create chat-with-timeout-control.hs
2014-10-07 06:36:15 +03:00
dschalk
8caa9f087b Create chat-with-timeout-control.hs 2014-10-06 20:56:08 -04:00
Greg Weber
dece47fe9e Merge pull request #843 from MaxGabriel/documentRoutes
Document Route typeclasses
2014-10-05 23:09:47 -05:00
Maximilian Tagher
e49ccb7871 Document Route typeclasses 2014-10-05 15:06:23 -07:00
Michael Snoyman
33d431f2ea Remove a deprecated dep 2014-10-05 12:51:41 +03:00
Michael Snoyman
dbc251b9ee Version bump 2014-10-03 08:50:25 +03:00
Michael Snoyman
b578e67c92 Version bump 2014-10-03 08:31:44 +03:00
Greg Weber
7f775e1dde document cache key 2014-10-02 09:11:23 -07:00
Erik de Castro Lopo
d31e2d0988 yesod-test : Fix two more CssQuery parser problems.
Closes #834
2014-10-02 21:26:24 +10:00
Michael Snoyman
9d0d48afd6 Version bump 2014-10-01 14:50:57 +03:00
Michael Snoyman
8a09a3181e Revert "`required' attribute for nicHtmlField (textfield tag)"
This reverts commit d4175f11cc.
2014-10-01 14:47:42 +03:00
Michael Snoyman
fe940598e1 Add Nic to hello-forms 2014-10-01 14:47:35 +03:00
Michael Snoyman
9ff2c243f2 Two more failing yesod-test cases.
Pinging @erikd.
2014-10-01 14:11:27 +03:00
Michael Snoyman
c91b2978be Remove deprecated deps 2014-10-01 07:09:39 +03:00
Michael Snoyman
6fed35f9ea Version bump 2014-10-01 07:01:02 +03:00
Michael Snoyman
643bcf5562 Merge pull request #836 from yesodweb/expose-yesod-routes-th-types
expose Yesod/Routes/TH/Types.hs
2014-10-01 07:00:34 +03:00
Michael Snoyman
7983e7cbac Version bump 2014-10-01 06:56:58 +03:00
Erik de Castro Lopo
58bf5223c0 yesod-test : Fix parsing of descendent selector in CSS query parser.
Closes #834
2014-10-01 06:24:57 +10:00
Greg Weber
f633734a96 expose Yesod/Routes/TH/Types.hs 2014-09-30 12:44:09 -07:00
Greg Weber
aaeafb0591 add some documentation 2014-09-30 12:22:44 -07:00
Michael Snoyman
e21bfb4d94 GHC 7.4 fixes 2014-09-30 13:45:39 +03:00
Michael Snoyman
c8e2aaf2a8 Fix test 2014-09-30 13:37:10 +03:00
Michael Snoyman
4b85a66d93 Simpler demonstration of descendent selector bug 2014-09-30 13:34:32 +03:00
Michael Snoyman
9a9cab4365 Demonstrate bug in CSS parsing
Pinging @erikd. I think this problem was introduced in the new parser.
2014-09-30 13:31:44 +03:00
Michael Snoyman
a39962b72d Add missing module for Hackage testing 2014-09-30 12:47:59 +03:00
Michael Snoyman
9ce4d49d0a persistent 2.1 and warp 3.0.2 2014-09-30 06:57:38 +03:00
Michael Snoyman
d98061408a Merge remote-tracking branch 'origin/master' into yesod-1.4
Conflicts:
	yesod-persistent/test/Yesod/PersistSpec.hs
2014-09-29 08:17:54 +03:00
Michael Snoyman
3447510080 Clean up a bunch of warnings 2014-09-29 08:08:02 +03:00
Michael Snoyman
14d9b7ce71 Fix compilation error 2014-09-29 07:41:54 +03:00
Michael Snoyman
fc9154ecc6 Add missing language extension 2014-09-29 07:39:48 +03:00
Greg Weber
963bdbfdcd add MultiParamTypeClasses extension 2014-09-28 21:38:48 -07:00
Greg Weber
8fd0378c4b TypeCache documentation 2014-09-24 09:04:41 -07:00
Greg Weber
510f70d5b3 fix typos 2014-09-24 08:07:15 -07:00
Greg Weber
01339ad528 add some documentation for Yesod.Auth.Email 2014-09-24 07:47:13 -07:00
Michael Snoyman
29894604e5 Merge branch 'master' into yesod-1.4
Conflicts:
	yesod-core/yesod-core.cabal
2014-09-23 10:00:24 +03:00
Michael Snoyman
20041c0859 Version bump 2014-09-23 09:37:00 +03:00
RyanGlScott
b70790e525 Bump random upper version bounds 2014-09-22 23:43:31 -05:00
Michael Snoyman
0d1da1b583 Scaffolding update to Yesod 1.4 2014-09-21 22:00:53 +03:00
Michael Snoyman
343335f00e Merge branch 'master' into yesod-1.4 2014-09-21 21:55:02 +03:00
Michael Snoyman
3848b23ca5 Updated scaffolding 2014-09-21 13:12:59 +03:00
Michael Snoyman
def48d8a45 Version bumps for 1.4 release 2014-09-21 11:41:37 +03:00
Michael Snoyman
f1de32ec68 Merge branch 'master' into yesod-1.4 2014-09-21 10:56:58 +03:00
Michael Snoyman
eda8597039 Better keter.yml in scaffolding 2014-09-21 10:56:22 +03:00
Michael Snoyman
a2563c8d05 yesod keter: support for new config file format 2014-09-21 10:42:53 +03:00
Michael Snoyman
bef44d962a Merge pull request #831 from yesodweb/cachedBy
add cachedBy, like cached but adds a key
2014-09-21 08:24:34 +03:00
Greg Weber
f18d0a8bac TypeCache typo and module exposure 2014-09-20 20:57:27 -07:00
Greg Weber
00b5781ec5 add cachedBy, like cached but adds a key
re-factored to a base implementation with
no Yesod dependencies in TypeCache.hs
2014-09-20 14:34:10 -07:00
Michael Snoyman
f86d181377 Merge branch 'master' into yesod-1.4 2014-09-21 00:07:11 +03:00
Michael Snoyman
60d1d5334b Version bump 2014-09-20 23:44:08 +03:00
Michael Snoyman
c629cba207 Version bump 2014-09-20 23:34:38 +03:00
Michael Snoyman
b7b3294eb2 Merge pull request #828 from jcristovao/master
Added convertField function to ease the generation of new fields
2014-09-18 06:54:47 +03:00
Greg Weber
629df4a291 add required attribute 2014-09-17 12:31:42 -07:00
João Cristóvão
13bc55969a Added convertField function to ease the generation of new fields 2014-09-17 18:08:06 +01:00
Greg Weber
17b94c16c7 version bump 2014-09-17 09:28:45 -07:00
Greg Weber
8c2542eb8c add required attribute 2014-09-17 09:28:26 -07:00
Michael Snoyman
ed2aeda06d Merge pull request #824 from erikd/master
yesod-test: Improve CSS selector parser.
2014-09-17 06:50:16 +03:00
Greg Weber
51927638c1 version bump 2014-09-16 18:50:06 -07:00
Greg Weber
448b33d1cc fix confirmation email status
I screwed this up in a big re-factoring in 153654ad
2014-09-16 18:49:45 -07:00
Greg Weber
4f95cb9f64 Merge pull request #825 from yesodweb/confirm-email-status
Confirm email status
2014-09-16 20:49:05 -05:00
Greg Weber
2a30519169 fix some import warnings 2014-09-16 18:13:28 -07:00
Greg Weber
1067816b5d fix confirmation email status
I screwed this up in a big re-factoring in 153654ad
2014-09-16 18:10:40 -07:00
Erik de Castro Lopo
581a688cf5 yesod-test: Improve CSS selector parser.
* Tighten up what the parser will accept (especially wrt identifiers).
* Write the parser in a more idiomatic (for *parsec) style.
2014-09-17 10:24:57 +10:00
Michael Snoyman
50f57a3586 Fix browserid.hs (closes #547) 2014-09-14 11:04:16 +03:00
Michael Snoyman
bec985467f Merge pull request #821 from mgomezch/yesodauthpersist
Decouple YesodAuthPersist from Persistent
2014-09-14 07:30:18 +03:00
Michael Snoyman
d3e4831b38 Scaffolding update 2014-09-14 07:23:19 +03:00
Manuel Gómez
94331fcab9 Travis doesn't like type instance in a class 2014-09-12 13:35:00 +00:00
Manuel Gómez
9729cd9d15 Default type instance for AuthEntity
`AuthEntity` is now a type family associated to the `YesodAuthPersist`
class, so its old type alias definition has now become its default type
instance, which allows recovering the old behavior with minimal
boilerplate: an empty instance declaration for `YesodAuthPersist` makes
a Yesod application written with Persistent work just like before.

Unfortunately, this requires enabling `UndecidableInstances` in the
`Yesod.Auth` module since there is now a nested type family application
(as `AuthEntity` is now itself a type family).

This was tested with the scaffolded application with PostgreSQL, and it
works (given another small change to make it work with Persistent 2 due
to how `SqlPersistT` is now defined).
2014-09-12 13:18:51 +00:00
Manuel Gómez
4fd20299c1 maybeAuthPair, requireAuthPair
`maybeAuth` and `requireAuth` have been reverted to their original
signatures, which assume a Persistent database.  `maybeAuthPair` and
`requireAuthPair` are introduced, which do the same but without that
assumption.
2014-09-12 13:14:15 +00:00
Michael Snoyman
ef55173383 Merge pull request #822 from docmunch/no-id-token
remove the id_token parameter
2014-09-12 07:01:51 +03:00
Greg Weber
ec6fd486b6 remove the id_token parameter
We saw this error:
Internal Server Error
key "id_token" not present
2014-09-11 13:19:20 -07:00
Manuel Gómez
086837686a Decouple YesodAuthPersist from Persistent 2014-09-10 17:51:11 +00:00
Michael Snoyman
e4a401f58d Add a signature 2014-09-08 10:02:11 +03:00
Michael Snoyman
2b01c38d60 Added missing pragma 2014-09-08 07:11:38 +03:00
Michael Snoyman
39f4d0c95f Force persistent-2.0 2014-09-07 20:54:07 +03:00
Michael Snoyman
587d135f17 Remove yesod-platform 2014-09-07 20:53:57 +03:00
Michael Snoyman
ccab062f2d Remove all conditional compilation for Yesod 1.4 release
Left in for GHC-bundled libraries (ghc, base, bytestring, binary)
2014-09-07 18:17:45 +03:00
Michael Snoyman
598e570913 Remove deprecated packages 2014-09-07 17:41:09 +03:00
Michael Snoyman
f779004d19 Merge yesod-routes into yesod-core entirely 2014-09-07 17:34:37 +03:00
Michael Snoyman
88b9217e25 Merge branch 'master' into yesod-1.4 2014-09-07 17:02:01 +03:00
Michael Snoyman
815901eeb4 Version bump 2014-09-07 16:58:00 +03:00
Michael Snoyman
be5ec95647 Clean up parsing module further 2014-09-07 16:55:37 +03:00
Michael Snoyman
bc00f3958f Unified parsing and dispatching code (still ugly) 2014-09-07 16:55:37 +03:00
Michael Snoyman
a1ea34f196 Remove old dispatch method 2014-09-07 16:55:37 +03:00
Michael Snoyman
97af86e43a Simplified done.cg #819 2014-09-03 17:56:20 +03:00
Michael Snoyman
8cbcc5fab3 Merge branch 'master' into yesod-1.4 2014-09-03 09:03:18 +03:00
Michael Snoyman
67438d191d optparse-applicative 0.10 2014-09-03 08:20:10 +03:00
Greg Weber
ec91c8b59b version bump 2014-09-01 20:19:25 -07:00
Greg Weber
867f0c02e0 Merge pull request #818 from HugoDaniel/patch-1
Fixes the "reader not in scope" error
2014-09-01 12:27:43 -05:00
Hugo Daniel
525a73a100 Update yesod-bin.cabal
This fixes the error:

[10 of 10] Compiling Main             ( main.hs, dist/build/yesod/yesod-tmp/Main.o )

main.hs:192:35:
    Not in scope: ‘reader’
    Perhaps you meant one of these:
      ‘header’ (imported from Options.Applicative),
      ‘readIO’ (imported from Prelude), ‘readLn’ (imported from Prelude)
cabal: Error: some packages failed to install:
yesod-bin-1.2.12.5 failed during the building phase. The exception was:
ExitFailure 1
2014-09-01 18:12:20 +01:00
Michael Snoyman
2187c0cf8d Add required to textareaField (fixes #817) 2014-09-01 07:19:15 +03:00
Michael Snoyman
3478841d15 Add required to textareaField (fixes #817) 2014-09-01 07:18:42 +03:00
Michael Snoyman
34980eff82 Merge pull request #816 from yesodweb/install-j
use -j for cabal install
2014-08-31 09:55:25 +03:00
Greg Weber
07c1baefc4 use -j for cabal install 2014-08-30 19:16:49 -07:00
Michael Snoyman
29d7e252f1 Merge branch 'master' into yesod-1.4 2014-08-31 05:04:27 +03:00
Michael Snoyman
1e76a28f6d withUrlRenderer 2014-08-31 02:24:08 +03:00
Michael Snoyman
ebf3c8e4f2 Scaffolding update for #814 2014-08-31 00:22:34 +03:00
Michael Snoyman
9471399589 Merge branch 'master' into yesod-1.4 2014-08-28 05:19:21 +03:00
Michael Snoyman
d6b3d2a890 conduit 1.2 version bumps 2014-08-27 18:01:02 +03:00
Michael Snoyman
d3df218a96 conduit 1.2 patch 2014-08-27 17:34:35 +03:00
Michael Snoyman
fc66819535 Merge branch 'master' into yesod-1.4
Conflicts:
	yesod-form/yesod-form.cabal
2014-08-27 11:18:21 +03:00
Michael Snoyman
8b2297adf4 Conditional support for persistent2 branch.
Pinging @gregwebs. I've backported the relevant tweaks on the yesod-1.4
branch, to allow master to compile against persistent2. Whenever you're
ready to release persistent2, we can:

1. Release persistent2.
2. Release new versions of yesod packages, which will work with
   persistent 1.3 and 2.0.
3. Add an upper bound in Stackage to avoid using the new persistent
   libraries until they're ready for primetime.
4. Release your blog post.

yesod-1.4 should then remove the CPP here and only work with
persistent2; the biggest "breaking change" in the 1.4 release will be
remove backwards compatibility hacks for persistent, conduit,
shakespeare, and wai.
2014-08-27 11:16:08 +03:00
Michael Snoyman
30352f56ec Some fixes for persistent2 2014-08-27 10:53:17 +03:00
Michael Snoyman
6eb1447dd9 Add missing LANGUAGE pragma 2014-08-27 08:15:47 +03:00
Michael Snoyman
a6d545fe32 Merge branch 'master' into yesod-1.4 2014-08-27 07:51:39 +03:00
Michael Snoyman
1539753562 Relax conduit upper bound 2014-08-27 07:44:26 +03:00
Michael Snoyman
a13ebd3fa8 Some merge resolution 2014-08-25 21:20:27 +03:00
Michael Snoyman
c66ef04f17 Merge branch 'master' into yesod-1.4
Conflicts:
	yesod-form/Yesod/Form/Functions.hs
2014-08-25 20:20:16 +03:00
Michael Snoyman
b2c16c9d4c Scaffolding update: turn on -N 2014-08-25 18:07:58 +03:00
Michael Snoyman
641135f011 Version bump 2014-08-25 10:38:43 +03:00
Michael Snoyman
7146b62086 Merge pull request #812 from cosmo0920/bump-up-lowerbound-aeson
yesod-auth: bump up lower bound for aeson
2014-08-24 14:09:53 +03:00
cosmo0920
1f20cc0004 yesod-auth: bump up lower bound for aeson
Because `Data.Aeson.Encode.encodeToTextBuilder` is added since
aeson-0.7.0.0.
2014-08-24 19:55:19 +09:00
Michael Snoyman
a3ec07c359 Disable broken test 2014-08-23 21:50:38 +03:00
Michael Snoyman
1c775e37c0 Version bump 2014-08-21 07:19:49 +03:00
Michael Snoyman
fd9518d747 Merge pull request #810 from yesodweb/bump-persistent
bump persistent versions
2014-08-21 07:18:59 +03:00
Greg Weber
7fa8f8a3dd bump persistent versions
this allows the latest version of persistent-mongoDB to be installed
2014-08-20 12:05:30 -07:00
Michael Snoyman
e091096388 Version bump 2014-08-20 18:46:01 +03:00
Michael Snoyman
2ad3227776 Version bumps 2014-08-20 17:54:46 +03:00
Michael Snoyman
9c3cf3e4c5 Scaffolding updates 2014-08-20 17:53:06 +03:00
Michael Snoyman
17016f8427 Merge branch 'master' of github.com:yesodweb/yesod 2014-08-20 16:46:21 +03:00
Michael Snoyman
40547b2b71 Merge pull request #809 from dunric/master
`required' attribute for nicHtmlField (textarea tag)
2014-08-20 16:04:32 +03:00
Dunric
d4175f11cc `required' attribute for nicHtmlField (textfield tag) 2014-08-20 01:53:59 +02:00
Michael Snoyman
827ddf8be5 Merge pull request #808 from dunric/master
Add some minimal interaction to add-handler command
2014-08-18 09:16:46 +03:00
Dunric
9831220c47 add-handler interactive 2014-08-17 20:15:50 +02:00
Michael Snoyman
587080dbff Merge pull request #797 from wuzzeb/master
Include google person information in the credsExtra field for GoogleEmail2 auth
2014-08-17 11:20:29 +03:00
Michael Snoyman
a70de71d8e Merge branch 'master' of github.com:yesodweb/yesod 2014-08-16 23:06:29 +03:00
Michael Snoyman
404e1b2f9c Platform update 2014-08-16 23:05:58 +03:00
Michael Snoyman
63e7cd8e2f network/network-uri split (again) 2014-08-16 23:05:10 +03:00
Michael Snoyman
a2d118e236 network/network-uri split 2014-08-16 23:02:32 +03:00
John Lenz
2a6956a85c Small fixes to adding person info to creds extra for google auth 2014-08-15 21:17:52 -05:00
Michael Snoyman
0a5fafa223 Merge pull request #807 from arowM/naturalJapanese
Fixed Japanese message
2014-08-15 09:54:42 +03:00
Kadzuya OKAMOTO
1fe72e8351 fixed Japanese message 2014-08-15 12:57:39 +09:00
Michael Snoyman
4adf6d89ba Merge pull request #804 from erikd/master
yesod-bin/Devel.hs : Relax requirements on location of Application.hs.
2014-08-14 13:36:13 +03:00
Erik de Castro Lopo
c20cb20438 yesod-bin/Devel.hs : Relax requirements on location of Application.hs.
I often move Application.hs to MyApp/Application.hs (and change the
module name as needed) which would result in yesod-bin printing a
warning about a missing Application.hs.

The code should now accept any file named Application.hs (either in
the top level source directory or somewhere in the tree.
2014-08-14 18:16:01 +10:00
Michael Snoyman
989343210a Merge pull request #803 from creichert/master
Load keter config file with yml or yaml extension.
2014-08-14 08:11:57 +03:00
Christopher Reichert
c1f08eeb9f Load keter config file with yml or yaml extension.
Complimentary fix for snoyberg/keter#41
2014-08-13 21:19:14 -05:00
Greg Weber
e74709433b add yesodSpecApp 2014-08-11 16:23:41 -07:00
Greg Weber
00f8bcf59b expose YesodExampleData 2014-08-11 15:58:47 -07:00
Michael Snoyman
fdb6ff9f5d Merge pull request #802 from paul-rouse/master
Revise previous fix (#799) to yesod devel timeout
2014-08-08 14:29:14 +03:00
Paul Rouse
20dfec4d88 Revise previous fix (#799) to yesod devel timeout 2014-08-08 11:10:07 +01:00
Michael Snoyman
a9f526bb39 Scaffolding changes for Ctrl-C 2014-08-08 11:28:33 +03:00
Michael Snoyman
c1ba0dc2fa Version bump 2014-08-07 08:23:46 +03:00
Greg Weber
7d138fbf48 Merge pull request #799 from paul-rouse/master
Mitigate yesod devel load (#767) by increasing a timeout
2014-08-06 12:34:16 -07:00
Paul Rouse
1d3b60abef Mitigate yesod devel load (#767) by increasing a timeout 2014-08-06 20:27:24 +01:00
Michael Snoyman
9726f9c59f Version bump 2014-08-06 14:03:53 +03:00
Michael Snoyman
cfb96fd316 add-handler: check if file exists #798 2014-08-06 13:47:34 +03:00
John Lenz
8cc1accc11 Include google person information in the credsExtra field for GoogleEmail2 auth 2014-08-05 22:46:55 -05:00
Michael Snoyman
6088f9049c platform update 2014-08-05 22:56:54 +03:00
Michael Snoyman
68b4f455da Don't include transformers-compat 2014-08-05 22:56:38 +03:00
Michael Snoyman
1959ec7aae jqueryAutocmpleteField' #793 2014-08-04 12:29:35 +03:00
Michael Snoyman
9dba11c83c Relax unix-compat 2014-08-03 19:43:40 +03:00
Michael Snoyman
0a619bf29a Version bump 2014-08-03 16:23:16 +03:00
Michael Snoyman
4fd1f76b17 Merge pull request #792 from geraldus/auth-minor-improvements
pre-baked Route Auth value
2014-08-03 13:09:35 +03:00
Артур Файзрахманов
ed53d46adc Type signature fix 2014-08-03 16:07:16 +06:00
Артур Файзрахманов
13f0eb3895 pre-baked Route Auth value
Added forwardUrl alias for `PluginR "browserid" []` as in other plugins
(e.g. GoogleEmail2 and OpenID).
2014-08-03 16:02:52 +06:00
Michael Snoyman
b3959dead3 Version bumps 2014-08-03 12:36:58 +03:00
Michael Snoyman
970f81af15 Scaffolding updates
Addresses kazu-yamamoto/logger#44 and #791
2014-08-03 12:36:58 +03:00
Michael Snoyman
c0ebb1624e More haskell-platform workarounds 2014-08-01 15:44:41 +03:00
Isamu Mogi
e6492ca507 unix-compat and yaml bump to support Win64 2014-08-01 20:57:08 +09:00
Michael Snoyman
7f5ed740a9 renderBootstrap2 2014-07-30 11:52:04 +03:00
Michael Snoyman
05d31d6621 Add MonadActive instances 2014-07-30 11:33:38 +03:00
Michael Snoyman
8f2e84fa0a Version bump 2014-07-28 20:55:34 +03:00
Michael Snoyman
ad249aaedb Merge pull request #787 from geraldus/auth-russian-translation-tmp
added messages for Russian language
2014-07-28 20:54:22 +03:00
Артур Файзрахманов
30be70918f added messages for Russian language
`.cabal` unchanged, need version bump
2014-07-28 23:13:31 +06:00
Michael Snoyman
bc6e0293ae Merge pull request #786 from joelteon/master
Strip src/ prefix in yesod devel
2014-07-28 09:11:13 +03:00
Joel Taylor
23ffdbe4f8 strip src prefix 2014-07-27 11:17:03 -07:00
Michael Snoyman
4f4123fc0c Merge pull request #785 from MaxGabriel/patch-1
Fix typo in yesod-test; analize -> analyze
2014-07-26 22:50:01 +03:00
Maximilian Tagher
c06724402c Fix typo in yesod-test; analize -> analyze 2014-07-26 12:48:56 -07:00
Michael Snoyman
b33650551e Version bump 2014-07-26 22:16:37 +03:00
Michael Snoyman
73204a0620 Merge pull request #784 from geraldus/form-i18n-ru-temp
Basic form i18n for Russian Language
2014-07-26 22:10:48 +03:00
Артур Файзрахманов
99484ab894 Fixed cabal file
Added Russian form translation as exposed module in .cabal
2014-07-27 01:08:39 +06:00
Michael Snoyman
6a09bc3406 Version bumps 2014-07-26 21:53:26 +03:00
Michael Snoyman
575e222605 Merge branch 'patch-2' of https://github.com/cblp/yesod into yesod-1.4 2014-07-26 21:20:49 +03:00
Michael Snoyman
e6eae8ee5a Merge remote-tracking branch 'origin/master' into yesod-1.4
Conflicts:
	yesod-routes/Yesod/Routes/Parse.hs
	yesod-routes/test/Hierarchy.hs
	yesod-routes/yesod-routes.cabal
2014-07-26 21:20:31 +03:00
Артур Файзрахманов
09ecf9e211 Corrected ValueRequired translation 2014-07-26 07:36:58 +06:00
Артур Файзрахманов
d6b24510ea Fixed function name
Sorry friends, I’m so inattentive!
2014-07-26 07:26:11 +06:00
Артур Файзрахманов
10524fdd82 Fixed typo in module name 2014-07-26 07:19:50 +06:00
Артур Файзрахманов
1d28ac42b9 Basic form i18n for Russian Language
Some of translations maybe need to be discussed, because of some
translations are not literal.
2014-07-25 21:48:42 +06:00
Yuriy Syrovetskiy
9aa9bf9478 401 if API client is not authenticated
Server should not HTTP-redirect API client to the auth page, error 401 is more suitable.
2014-07-25 19:19:41 +04:00
Michael Snoyman
adc259a8e8 Merge pull request #782 from cblp/patch-1
typo
2014-07-25 18:07:55 +03:00
Yuriy Syrovetskiy
13243aba54 typo 2014-07-25 19:07:01 +04:00
Michael Snoyman
99621c17b0 Generate valid HTML from renderTable 2014-07-24 10:45:06 +03:00
Michael Snoyman
027dfa9d91 Miss qualified function usage 2014-07-24 10:28:23 +03:00
Michael Snoyman
2d54a5df13 Don't ignore leftovers in parsing #780 2014-07-24 10:21:06 +03:00
Michael Snoyman
e23c78f2ce Better overlap rules #779
We now have the concept that either an entire route is overlap checked
or not. This is essentially what we had before, except there was code
littered everywhere on the mistaken assumption that just one component
could be overlap checked. This also allows us to mark parent routes or
multipiece components as non-overlapped checked.

In addition, if you put a bang at the beginning of the pattern, the
entire route is not overlap checked. The previous syntax is kept for
backwards compatibility.
2014-07-23 12:40:24 +03:00
Michael Snoyman
972efd0ca4 Scaffold update 2014-07-15 19:06:27 +03:00
Erik de Castro Lopo
4745676200 yesod-bin/Scaffolding/Scaffolder.hs : Remove un-used variable. 2014-07-15 20:42:11 +10:00
Erik de Castro Lopo
bc933bbefb yesod-bin/Keter.hs : Use System.Process instead of System.Cmd.
System.Cmd is deprecated.
2014-07-15 20:42:11 +10:00
tolysz
a4894d54af remove not needed extension 2014-07-14 15:37:46 +01:00
tolysz
8a8bfa7ec7 correct the wrapper 2014-07-14 15:10:50 +01:00
tolysz
acd2bb61e4 add enclosed-exceptions 2014-07-14 15:04:17 +01:00
tolysz
89cd52ad10 Rewrite to Either SomeException a
Rewrite to use suggested `enclosed-exceptions` package and `Either` pattern for capturing exceptions
2014-07-14 15:02:32 +01:00
tolysz
038c94d1cf copy and paste 2014-07-14 12:41:37 +01:00
tolysz
56da66d937 add missing ScopedTypeVariables 2014-07-14 12:33:07 +01:00
tolysz
4a6f7045f4 copy and paste typo 2014-07-14 12:22:44 +01:00
tolysz
65c0bd5c64 fix exports 2014-07-14 12:14:01 +01:00
tolysz
50728f6b59 bump verision 2014-07-14 12:09:47 +01:00
tolysz
772e9ec7f8 Add versions with exceptions
Add versions of commands which execute IO () actions on exceptions.
2014-07-14 12:08:46 +01:00
Michael Snoyman
9d006b0ea2 Merge pull request #771 from jcristovao/master
requireAuthId does not need YesodAuthPersist master
2014-07-14 13:01:32 +03:00
João Cristóvão
feee2d7de8 requireAuthId does not need YesodAuthPersist master 2014-07-14 10:57:54 +01:00
Michael Snoyman
f6d06ef390 HostPreference conflict #769 2014-07-10 08:46:29 +03:00
Michael Snoyman
fec962d779 Merge pull request #766 from burz/master
Fix an import error and add color to "Build failure" warning.
2014-07-07 06:57:07 +03:00
Anthony Burzillo
54a4417f54 Add color to "Build failure" warning 2014-07-06 23:25:17 -04:00
Anthony Burzillo
3e100451d4 Fix import error 2014-07-06 23:21:46 -04:00
Anthony Burzillo
6d1a25187a Merge remote-tracking branch 'upstream/master' 2014-07-06 18:26:01 -04:00
Michael Snoyman
f18c13a06d Merge pull request #764 from yesodweb/pb-external-link-feed
Add feed functions to generate feeds with external links
2014-06-29 19:40:37 +03:00
patrick brisbin
bc8d015110
Add feed functions to generate feeds with external links
Rather than requiring a Route, these functions can accept Text URLs and just use
id to render them.
2014-06-28 08:56:11 -04:00
Michael Snoyman
4c31714a25 Special support for key-value pairs in route attributes #762 2014-06-24 08:46:08 +03:00
Michael Snoyman
4858f0837b Attributes can be set on parent routes #762 2014-06-18 19:51:27 +03:00
Michael Snoyman
268c68a544 Version bump 2014-06-18 08:02:36 +03:00
Michael Snoyman
27b3cb58bb Upstream yesod-scaffold changes for #761 2014-06-18 08:01:45 +03:00
Michael Snoyman
ecd5d76181 Scaffolding update 2014-06-18 07:56:15 +03:00
Michael Snoyman
9a583e5af3 Version bumps 2014-06-18 06:59:23 +03:00
Michael Snoyman
ef25c90e9b Handle labels containing inputs #759 2014-06-17 08:22:38 +03:00
Michael Snoyman
382a5402c8 yesod-auth 1.3, authenticate-oauth 1.5 2014-06-17 08:04:28 +03:00
Michael Snoyman
28c366a3b3 Add back conduit 1.0 support #757 2014-06-16 09:07:04 +03:00
Michael Snoyman
00c3a04dc4 Merge pull request #755 from axel-angel/master
Adapt generateFormGet to follow the post variant (deprecate non-prime)
2014-06-16 08:53:48 +03:00
Michael Snoyman
576d1dedd2 Merge pull request #758 from AlexanderAA/master
Three typos
2014-06-16 08:51:27 +03:00
Alexander
a4137461e3 Update README 2014-06-16 15:43:17 +12:00
Axel Angel
bfe0b2867a Adapt generateFormGet to follow the post variant (deprecate non-prime)
To stay backward compatible, we fix this in generateFormGet'

From discussion:
https://groups.google.com/forum/#!topic/yesodweb/lWKFzJDOnnY
2014-06-15 20:30:18 +02:00
Michael Snoyman
21d1965774 Merge remote-tracking branch 'origin/master' into yesod-1.4 2014-06-15 15:49:51 +03:00
Michael Snoyman
f21d926ef7 warp bump for yesod-platform 2014-06-15 15:49:09 +03:00
Michael Snoyman
f92cdd5c41 sendWaiApplication 2014-06-15 15:48:57 +03:00
Michael Snoyman
d9faced6b1 Merge pull request #751 from MaxGabriel/validateName
Validate cabal package name not having numeric-only words
2014-06-13 08:34:20 +03:00
Michael Snoyman
f648f5982c entropy bump 2014-06-13 08:29:28 +03:00
Michael Snoyman
1f704e914d Fixes for WAI 2.1 2014-06-10 13:59:35 +03:00
Michael Snoyman
32e729fdb3 Version bump 2014-06-09 13:36:13 +03:00
Michael Snoyman
e8c910d958 ghc 7.8.3 support #748 2014-06-09 12:37:22 +03:00
Michael Snoyman
b93a5d1993 Merge branch 'master' into yesod-1.4
Conflicts:
	yesod-core/test/YesodCoreTest/CleanPath.hs
	yesod-persistent/yesod-persistent.cabal
2014-06-09 11:22:30 +03:00
Michael Snoyman
4c2b8eec33 Platform fix 2014-06-09 11:18:41 +03:00
Michael Snoyman
0dc5d2e88e yesod-platform and scaffolding update 2014-06-09 11:01:49 +03:00
Michael Snoyman
1c78f86c8d Version bumps 2014-06-09 10:44:03 +03:00
Michael Snoyman
6ac697f032 Merge branch 'wai3'
Conflicts:
	yesod-core/yesod-core.cabal
	yesod-form/yesod-form.cabal
	yesod-persistent/yesod-persistent.cabal
2014-06-09 10:27:32 +03:00
Michael Snoyman
ebc18ad1cd Remove transformers upper bounds 2014-06-09 10:25:51 +03:00
Michael Snoyman
33c384bb4e yesod-test: use HTTP/1.1 2014-06-08 08:14:38 +03:00
Alexander
fc8b126e9e Typo fix 2014-06-08 15:20:27 +12:00
Maximilian Tagher
7315a464d7 Use Cabal's Distribution.Text/Distribution.Package to validate package names 2014-06-07 12:27:34 -07:00
Maximilian Tagher
5b5caf2ad4 Break out the check for numeric-only words into a separate function, with comments 2014-06-06 13:08:20 -07:00
Maximilian Tagher
62877cbba0 In yesod init, ensure words have atleast one character; fixes #550 2014-06-06 13:02:08 -07:00
Michael Snoyman
4158353070 Merge remote-tracking branch 'origin/master' into yesod-1.4 2014-06-05 15:13:15 +03:00
Michael Snoyman
d42ba4d024 Fix a conditional 2014-06-05 15:12:14 +03:00
Michael Snoyman
0d599e463a Version bumps 2014-06-05 06:05:47 +03:00
Michael Snoyman
fa6bc0fa5b Merge branch 'master' of github.com:yesodweb/yesod 2014-06-05 06:03:31 +03:00
Michael Snoyman
a265b094ad Merge branch 'master' of https://github.com/jprider63/yesod
Conflicts:
	yesod-core/yesod-core.cabal
2014-06-05 06:03:07 +03:00
jp.rider63
8b1a675339 upped conduit version dependency 2014-06-03 13:57:27 -04:00
Michael Snoyman
0a3ae4ef66 Merge remote-tracking branch 'origin/master' into yesod-1.4 2014-06-01 16:12:36 +03:00
Michael Snoyman
96caaf31d8 GoogleEmail2 2014-06-01 16:10:47 +03:00
Michael Snoyman
3b53c047e7 Version bump 2014-05-29 18:52:39 +03:00
Erik de Castro Lopo
90d639d413 yesod-test : Add simple tests for htmlCount/html*Contain. 2014-05-29 08:55:14 +10:00
Erik de Castro Lopo
7318d47781 yesod-test : Add htmlNoneContain (logical inverse of htmlAnyContain). 2014-05-29 07:02:27 +10:00
Michael Snoyman
08f796fc58 Version bumps 2014-05-27 12:48:03 +03:00
Michael Snoyman
3202eec80a Merge remote-tracking branch 'origin/master' into wai3 2014-05-27 12:46:33 +03:00
Michael Snoyman
f0d6e1adaa Version bump 2014-05-25 08:29:11 +03:00
Michael Snoyman
e305587143 Don't warn about unlisted Setup module 2014-05-25 08:27:48 +03:00
Michael Snoyman
be6d36ae8c Merge pull request #744 from tdox/improve_doubleField
doubleField may add a zero to some text before sending it to Data.Text.Read ...
2014-05-25 08:04:45 +03:00
Tad Doxsee
59ded9e2b5 doubleField may add a zero to some text before sending it to Data.Text.Read so that text such as '.3' may be read as 0.3. 2014-05-23 11:18:18 -07:00
Michael Snoyman
62d3cbe552 Merge pull request #743 from haskellGardener/patch-1
yesod-bin.cabal grant developers rtsopts
2014-05-22 21:18:37 +03:00
Michael Snoyman
82de52e3d2 Various additional WAI 3.0 fixes 2014-05-22 21:04:28 +03:00
Michael Snoyman
71263ae047 Initial WAI 3.0 support, one test still failing 2014-05-22 20:17:29 +03:00
Robert Lee
a37e54ee8c yesod-bin.cabal grant developers rtsopts
Sometimes yesod (yesod-bin) needs a stack space boost. Large projects can suffer stack overflows during development rebuilds.
2014-05-22 11:15:10 -05:00
Michael Snoyman
ca8b032684 platform updates 2014-05-22 18:07:07 +03:00
Michael Snoyman
0633866ef9 Version bump 2014-05-15 11:51:35 +03:00
Michael Snoyman
11ac378920 fsnotify 0.1 2014-05-15 11:51:03 +03:00
Michael Snoyman
cb95446469 Call watchTree in background (faster startup when there are lots of files) 2014-05-14 08:09:21 +03:00
Michael Snoyman
cf20f15957 Use Map for updating environment variables.
This ensures that the newly inserted variables overwrite any existing
variables. For more information, see:

https://groups.google.com/d/msg/yesodweb/0AX2GbKqmIk/nKYTCVoCm4QJ
2014-05-13 18:31:21 +03:00
Michael Snoyman
787d3c828d Version bump 2014-05-13 16:14:52 +03:00
Michael Snoyman
96e59947eb Add ToJSON and FromJSON for Textarea (fixes #738) 2014-05-13 09:08:44 +03:00
Michael Snoyman
e35836bbc1 Include patched pwstore-fast implementation.
See: https://github.com/PeterScott/pwstore/pull/10
2014-05-11 15:43:06 +03:00
Michael Snoyman
c8f7e34b2f Merge pull request #731 from andrewthad/master
Fix starting field number
2014-05-09 18:28:07 +03:00
Michael Snoyman
ddc622485a Merge pull request #735 from axel-angel/master
Auth.Email: modern buttons, use translation RegisterLong
2014-05-09 07:31:04 +03:00
Michael Snoyman
663aa4d804 Merge pull request #736 from axel-angel/auth-french
Auth.Message: Translate missing french messages
2014-05-09 07:05:45 +03:00
Axel Angel
da034e7beb Translate missing french messages 2014-05-09 00:50:13 +02:00
Axel Angel
bd1b5b1ef1 Auth.Email: modern buttons, use translation RegisterLong 2014-05-09 00:29:50 +02:00
andrewthad
9f379bc219 Fix starting field number
This commit makes starts the counter as `IntSingle 0` instead of `IntSingle 1`. This is needed because `newFormIdent` yield the incremented state value. Meaning: right now, all of my forms start at f2 instead of f1. This commit will make them start at f1 like I would expect them to.
2014-05-06 09:34:56 -04:00
Michael Snoyman
60526676e5 Encode empty paths correctly #730 2014-05-06 08:25:44 +03:00
Michael Snoyman
cbbeb3b7f6 exceptions 0.6 2014-05-05 21:20:26 +03:00
Michael Snoyman
098bff53ec Lower bound on hamlet-1.1.8 for yesod-form #727 2014-04-30 07:40:54 +03:00
Greg Weber
8605815afd Merge pull request #723 from yesodweb/css-absolute2
Css absolute2
2014-04-28 05:18:53 -07:00
Greg Weber
c498c77cc3 test absolute file paths in a cross-platform way 2014-04-27 08:23:09 -07:00
Michael Snoyman
8c183d9cda Another fix for UTF8 paths 2014-04-27 11:21:43 +03:00
Greg Weber
68c02c3289 version bumpm for 503 json response 2014-04-25 11:13:01 -07:00
Greg Weber
c5df0b0bf4 check for a colon and slashes after http 2014-04-25 07:54:04 -07:00
Michael Snoyman
99831b52a2 Respect accept header for JSON in devel server #719 2014-04-24 07:14:01 +03:00
Michael Snoyman
f43c7fd3e4 copy-to-port #724 2014-04-24 06:38:53 +03:00
Michael Snoyman
e9311d0e1f ToWidget instances for Css, JS 2014-04-23 16:31:13 +03:00
Michael Snoyman
bf3e8afefb Fix some character encoding bugs 2014-04-23 16:05:00 +03:00
Greg Weber
9fa5a23597 remove white space 2014-04-21 22:07:22 -07:00
Greg Weber
2ea07ed398 use latest css-text version 2014-04-21 22:07:22 -07:00
Greg Weber
22caf035ef absolute url function returns lazy text 2014-04-21 22:07:21 -07:00
Greg Weber
a2e979ccda expose url re-writing function 2014-04-21 22:07:21 -07:00
Greg Weber
c3976efea9 make relative css urls absolute 2014-04-21 22:07:20 -07:00
Michael Snoyman
9b816aec75 Scaffolding update 2014-04-18 16:08:57 +03:00
Michael Snoyman
65f12be39b Fixes for previous merge 2014-04-18 15:18:31 +03:00
Michael Snoyman
c9378af060 Strip a bound 2014-04-18 14:36:17 +03:00
Michael Snoyman
fe622d5345 Merge remote-tracking branch 'origin/master' into yesod-1.4
Conflicts:
	yesod-auth/yesod-auth.cabal
	yesod-form/Yesod/Form/Fields.hs
	yesod-form/yesod-form.cabal
	yesod-persistent/Yesod/Persist/Core.hs
2014-04-18 14:33:54 +03:00
Michael Snoyman
b6f221b54e Platform update 2014-04-17 08:31:20 +03:00
Michael Snoyman
03a39a05f7 Export defaultYesodMiddleware and authorizationCheck 2014-04-17 07:54:37 +03:00
Michael Snoyman
2c9777403a Travis: install alex 2014-04-16 14:42:41 +03:00
Michael Snoyman
dfd7965b6b Workarounds for older bytestrings 2014-04-16 14:31:54 +03:00
Michael Snoyman
e8ce5650da Version bump 2014-04-14 08:40:21 +03:00
Michael Snoyman
e036f934f6 Add MonadCatch for WidgetT 2014-04-14 08:32:55 +03:00
Michael Snoyman
186a676a5c Merge branch 'master' of github.com:yesodweb/yesod 2014-04-12 22:26:47 +03:00
Michael Snoyman
82d40c4ad4 Remove a useless upper bound 2014-04-12 22:26:19 +03:00
Michael Snoyman
e355dbcf43 GHC 7.8 support 2014-04-12 21:47:06 +03:00
Michael Snoyman
dc6c96a4a3 Merge pull request #714 from pseudonom/static-docs
Fixed old comment on CSS post-processing default
2014-04-12 21:01:45 +03:00
pseudonom
620e200c4d Fixed old comment on CSS post-processing default 2014-04-11 17:26:39 -04:00
Michael Snoyman
7133f75bf3 Note about strictness annotations 2014-04-10 20:36:46 +03:00
Michael Snoyman
b67d225f56 Use mplus (thanks @meteficha) 2014-04-10 20:30:14 +03:00
Michael Snoyman
4dc7a1258c Deeply evaluate session and headers #712 2014-04-10 20:21:49 +03:00
Michael Snoyman
c44a48c8ae Test cases for #712 2014-04-10 19:59:54 +03:00
Michael Snoyman
398abb0ade Scaffolding update 2014-04-10 19:58:46 +03:00
Michael Snoyman
b8a73d9b7f defaultMiddlewares and MonadCatch instance 2014-04-10 15:04:29 +03:00
Michael Snoyman
ad4ab651b4 renderBootstrap2 2014-04-09 21:59:06 +03:00
Michael Snoyman
e61c98507b Workaround for some meaningless warnings 2014-04-09 21:34:36 +03:00
Michael Snoyman
3f4a870b86 Workaround for GHC 7.8.1 regression 2014-04-09 20:49:03 +03:00
Michael Snoyman
c8553920a3 Version bump 2014-04-09 20:14:02 +03:00
Michael Snoyman
0b861143af Add yesod-auth-hashdb to make-cabal.sh 2014-04-09 19:55:08 +03:00
Michael Snoyman
8b3d854d22 Reformat make-cabal.sh 2014-04-09 19:54:32 +03:00
Michael Snoyman
2528bc3c3e Merge pull request #710 from paul-rouse/master
Add yesod-auth-hashdb to platform and Yesod.Auth description
2014-04-09 19:49:43 +03:00
Michael Snoyman
588cafa223 Expand YesodDB for GHC 7.8.1 bug #709 2014-04-09 19:37:33 +03:00
Paul Rouse
a81639f480 Typo 2014-04-09 17:36:39 +01:00
Paul Rouse
7180d8f299 Add yesod-auth-hashdb to platform and Yesod.Auth description 2014-04-09 17:33:41 +01:00
Michael Snoyman
5a24477316 Fix some CPP 2014-04-09 07:40:38 +03:00
Michael Snoyman
41054cc171 A few version bumps 2014-04-03 16:20:21 +03:00
Michael Snoyman
7512cc2bfc Add ToContent etc instance for Css and Javascript 2014-04-03 12:23:38 +03:00
Michael Snoyman
55309a01b3 Don't install deprecated mega-sdist 2014-04-02 13:09:57 +03:00
Michael Snoyman
f16f7ed83d Version bump 2014-04-02 13:04:10 +03:00
Michael Snoyman
843e03d4f7 scaffolding and platform updates 2014-04-02 13:03:41 +03:00
Michael Snoyman
5edb77eb80 Use defaultShouldDisplayException 2014-03-30 09:38:36 +03:00
Michael Snoyman
76cff2ab23 MonadReader instance for HandlerT and WidgetT 2014-03-28 13:15:51 +03:00
Michael Snoyman
03d86646a6 Version bump 2014-03-27 17:41:23 +02:00
Michael Snoyman
66e9e203f8 Remove some old files 2014-03-27 17:40:58 +02:00
Michael Snoyman
d764464152 conduit 1.1 2014-03-27 16:38:52 +02:00
Michael Snoyman
3f1fe6e1c0 Version bumps 2014-03-26 22:05:56 +02:00
Michael Snoyman
7f1b06ecb3 Multiple threads for communicating with processes 2014-03-26 22:05:06 +02:00
Michael Snoyman
bdcb174830 Remove pureMD5 and SHA deps 2014-03-26 15:21:37 +02:00
Michael Snoyman
f0d392a53e Version bump 2014-03-26 11:08:36 +02:00
Michael Snoyman
60b4684119 Drop usage of failure 2014-03-26 10:38:51 +02:00
Michael Snoyman
5e6b19f624 Merge remote-tracking branch 'origin/master' into persistent2-simpler-dispatch 2014-03-25 05:40:12 +02:00
Michael Snoyman
2fd70b6e44 Bump yesod-auth upper bound in yesod 2014-03-25 05:40:03 +02:00
Michael Snoyman
c4d97b755b Merge remote-tracking branch 'origin/master' into persistent2-simpler-dispatch
Conflicts:
	yesod-auth/Yesod/Auth/HashDB.hs
2014-03-25 05:31:12 +02:00
Michael Snoyman
edc6bdd581 Use defaultShouldDisplayException 2014-03-25 05:29:45 +02:00
Michael Snoyman
7991edee32 Doh! 2014-03-24 12:07:14 +02:00
Michael Snoyman
dde1a7c215 hspec 1.8.4 hspec/hspec#165 2014-03-23 16:10:53 +02:00
Michael Snoyman
57442abaae Remove HashDB 2014-03-21 08:48:15 +02:00
Michael Snoyman
c456b0a7aa Merge pull request #700 from yesodweb/auth-json-2
Auth json 2
2014-03-21 08:44:57 +02:00
Greg Weber
b1cdf072ad Merge branch 'master' into auth-json-2
Conflicts:
	yesod-auth/Yesod/Auth.hs
	yesod-auth/Yesod/Auth/Email.hs
	yesod-auth/yesod-auth.cabal
2014-03-20 14:38:14 -07:00
Michael Snoyman
827b1d4bd2 Merge remote-tracking branch 'origin/master' into persistent2-simpler-dispatch 2014-03-20 20:38:14 +02:00
Michael Snoyman
6ef507e54f Better implementation of defaultGetDBRunner 2014-03-20 20:37:39 +02:00
Michael Snoyman
aef99b44d8 Remove unneeded dep 2014-03-20 19:22:43 +02:00
Michael Snoyman
a4ad7d387d Remove unnecessary dep 2014-03-20 19:19:13 +02:00
Michael Snoyman
971da29bad Version bumps 2014-03-20 12:26:40 +02:00
Michael Snoyman
0774864877 Use pure in an example 2014-03-20 12:09:24 +02:00
Michael Snoyman
7e4ef60ae1 Drop filesystem-conduit dependency 2014-03-20 12:09:24 +02:00
Michael Snoyman
1b036957c2 Merge pull request #698 from meteficha/fragment
Helper data type for redirecting with fragment identifiers.
2014-03-20 04:32:42 +02:00
Michael Snoyman
24e8e53f64 Merge remote-tracking branch 'origin/master' into persistent2-simpler-dispatch
Conflicts:
	.gitignore
	yesod-core/yesod-core.cabal
2014-03-20 04:14:09 +02:00
Felipe Lessa
ddf64c1481 Helper data type for redirecting with fragment identifiers. 2014-03-19 19:52:17 -03:00
Michael Snoyman
afe88dbc43 Include http-reverse-proxy 2014-03-18 20:42:03 +02:00
Michael Snoyman
96113c1e95 yesod-platform update 2014-03-18 20:39:25 +02:00
Michael Snoyman
bb97d83853 Merge pull request #697 from vincenthz/master
Use const time equality from byteable instead of crypto-api
2014-03-18 14:13:20 +02:00
Vincent Hanquez
8d07d1fa72 Use const time equality from byteable instead of crypto-api 2014-03-18 08:29:47 +00:00
Michael Snoyman
43baddd1eb Version bump 2014-03-18 09:53:53 +02:00
Michael Snoyman
fc36d56018 Merge pull request #696 from vincenthz/master
Remove crypto-conduit in favor of the simpler cryptohash-conduit.
2014-03-18 09:51:46 +02:00
Vincent Hanquez
31748ddbd0 Remove crypto-conduit in favor of the simpler cryptohash-conduit. 2014-03-18 06:59:20 +00:00
Michael Snoyman
0f987e4876 Merge pull request #694 from snakamura/extra-backslash
Remove an extra backslash
2014-03-17 13:52:26 +02:00
Satoshi Nakamura
09caea1e49 Remove an extra backslash 2014-03-17 19:35:51 +09:00
Michael Snoyman
c5f9a2d5b2 Version bump 2014-03-17 08:55:14 +02:00
Michael Snoyman
cb6cf18919 Scaffolding update 2014-03-17 08:35:59 +02:00
Felipe Lessa
94f972c2a8 Merge pull request #690 from meteficha/identifyForm
New identifyForm function
2014-03-13 05:41:23 -03:00
Felipe Lessa
969496b9f1 Golf around on identifyForm :). 2014-03-12 11:32:46 -03:00
Felipe Lessa
3d2253d5d3 Typo. 2014-03-12 11:23:32 -03:00
Felipe Lessa
68d0142dda New identifyForm function (fixes #649).
Based on code from @axel-angel but rewritten in a more lightweight
style (IMHO, at least :).
2014-03-12 11:20:31 -03:00
Felipe Lessa
a7a7764c97 Do not display FormFailures as they contain duplicates of field failures. 2014-03-12 10:27:46 -03:00
Felipe Lessa
51fbc2a57b Use correct error classes on Bootstrap3 module. 2014-03-12 10:14:04 -03:00
Michael Snoyman
c36dbf9302 Add missing import 2014-03-12 06:50:33 +02:00
Michael Snoyman
476b10b5c7 Merge pull request #687 from meteficha/bootstrap3
New Yesod.Form.Bootstrap3 module
2014-03-12 06:44:28 +02:00
Michael Snoyman
532cdd0d2f Merge pull request #689 from yesodweb/fork-handler2
add forkHandler. closes #680
2014-03-12 06:26:01 +02:00
Greg Weber
4b8cb247ce add forkHandler. closes #680
Also fix import warnings in Handler
2014-03-11 18:33:45 -07:00
Greg Weber
5c3078b51e parseJsonBody_ deprecated for requireJsonBody 2014-03-11 18:07:46 -07:00
Greg Weber
8535f19583 use fewer imports 2014-03-11 17:14:24 -07:00
Felipe Lessa
e44b93083a Smarter with{Small,Large}Input, do not override existing classes. 2014-03-11 17:45:59 -03:00
Felipe Lessa
4366dbc05f Bump yesod-form to version 1.3.8. 2014-03-11 17:10:54 -03:00
Felipe Lessa
93aa6c08de Ignore backup files. 2014-03-11 17:10:05 -03:00
Felipe Lessa
59402da412 Deprecate the original renderBootstrap. 2014-03-11 17:09:27 -03:00
Felipe Lessa
12a527a9d5 New Yesod.Form.Bootstrap3 module.
The original renderBootstrap code was heavily modified by
Mladen Srdic [1].  I took his code and modified it as well,
and the result is this commit.

[1] https://www.fpcomplete.com/user/msrdic/bootstrap-3-forms-with-yesod-1
2014-03-11 17:08:41 -03:00
Michael Snoyman
c86823b1ce Version bump 2014-03-11 18:38:21 +02:00
Michael Snoyman
64547ba773 Import mkHsFile for Windows as well 2014-03-11 06:29:51 +02:00
Michael Snoyman
43eb8d83f0 Update hello-forms to use multi email field 2014-03-09 18:56:25 +02:00
Michael Snoyman
566060df8e Remove redundant script in travis.yml 2014-03-09 18:54:10 +02:00
Michael Snoyman
99fd185a25 Merge pull request #683 from TobyGoodwin/master
Implement multiEmailField
2014-03-09 18:51:17 +02:00
Toby Goodwin
e2a6ef31ed eschew fromJust, better error reporting 2014-03-09 16:20:39 +00:00
Michael Snoyman
414236481f Add yesod-websockets to sources.txt 2014-03-09 07:56:51 +02:00
Toby Goodwin
1acd48079c improve error handling to report particular errs 2014-03-07 18:57:29 +00:00
Toby Goodwin
010ecffa1b implement multiEmailField 2014-03-07 18:28:35 +00:00
Michael Snoyman
9eeefca36a Added chat example 2014-03-07 09:16:14 +02:00
Michael Snoyman
f1ca43e7c6 Include async helpers 2014-03-07 07:34:00 +02:00
Michael Snoyman
065c1887ad WebsocketsT ==> WebSocketsT 2014-03-07 07:19:51 +02:00
Michael Snoyman
15b509fcab Added conduit API 2014-03-07 07:19:24 +02:00
Michael Snoyman
0a2c3a1d7a Updated gitignore 2014-03-07 07:15:30 +02:00
Michael Snoyman
13976667ed Initial yesod-websockets
Pinging @gregwebs and @meteficha. Greg: I know you were talking about
Sockets.IO support, and Felipe: I thought you might be curious about
this relative to yesod-eventsource. Comments welcome :)
2014-03-06 18:00:46 +02:00
Michael Snoyman
56e42936b0 sendRawResponse 2014-03-06 16:34:27 +02:00
Michael Snoyman
11a35799b5 Version bump 2014-03-06 07:49:21 +02:00
Michael Snoyman
d2745fc277 Separate hsfiles command 2014-03-06 07:35:05 +02:00
Michael Snoyman
a4ab0530ca Merge branch 'now-simpler' of github.com:HugoDaniel/yesod
Conflicts:
	yesod-bin/main.hs
	yesod-bin/yesod-bin.cabal
2014-03-06 07:32:37 +02:00
Michael Snoyman
a719dee9ba warp 2.0.3.3 2014-03-06 07:23:12 +02:00
Michael Snoyman
bcff12bed1 parseHelperGen 2014-03-05 06:59:57 +02:00
Michael Snoyman
9574eda4ae Merge pull request #679 from docmunch/master
Added a createOnClickOverride function to BrowserId
2014-03-05 06:45:05 +02:00
Max Cantor (MBPr)
6182ecb256 Correct Cabal Version and Added createOnClickOverride to BrowserId 2014-03-04 15:24:08 -08:00
Greg Weber
a62157097c parseJsonBody_ -> requireJsonBody. closes #678 2014-03-04 10:06:56 -08:00
Michael Snoyman
ac871397e9 Merge remote-tracking branch 'origin/simpler-dispatch' into persistent2-simpler-dispatch 2014-03-04 15:02:21 +02:00
Michael Snoyman
5cb02e2a9b Minor tweaks 2014-03-04 15:02:01 +02:00
Michael Snoyman
a83971c273 Add some yesod-routes benchmarks 2014-03-04 14:09:12 +02:00
Michael Snoyman
2af3b1b8f1 Merge remote-tracking branch 'origin/simpler-dispatch' into persistent2-simpler-dispatch 2014-03-04 13:57:51 +02:00
Michael Snoyman
eb54c35677 Fix a test 2014-03-04 13:57:43 +02:00
Michael Snoyman
13172439a9 Added missing ViewPatterns 2014-03-04 13:57:15 +02:00
Michael Snoyman
84baab6fb5 Merge remote-tracking branch 'origin/simpler-dispatch' into persistent2-simpler-dispatch 2014-03-04 13:47:21 +02:00
Michael Snoyman
c19088d569 Switch yesod-core to use simpler dispatch 2014-03-04 13:46:03 +02:00
Michael Snoyman
750bc9c9ac All simpler dispatch tests pass 2014-03-04 13:41:16 +02:00
Michael Snoyman
f4bbe1cc52 Set content-length whenever evaluating a response body 2014-03-02 14:30:46 +02:00
Michael Snoyman
2819821b2e Version bump 2014-03-02 07:51:55 +02:00
Michael Snoyman
a1166022ed Merge pull request #676 from igraves/master
Switching to Data.Default.Class in yesod-bin.
2014-03-02 07:48:32 +02:00
Ian Graves
198e65d222 Switching to Data.Default.Class in yesod-bin. 2014-03-01 14:16:44 -06:00
Michael Snoyman
12ddec8b8c Fix pure for AForm #672 2014-02-26 07:54:01 +02:00
Michael Snoyman
58ade2e446 Merge branch 'master' of github.com:yesodweb/yesod 2014-02-26 07:51:24 +02:00
Michael Snoyman
9e7710dd9a Merge pull request #673 from meteficha/yesod-auth-email-layout
Allow custom handlers for Yesod.Auth.Email
2014-02-26 07:28:37 +02:00
Felipe Lessa
59d7bc969c yesod-auth: Bump version to 1.2.6. 2014-02-25 19:29:33 -03:00
Felipe Lessa
6f7e8c8e04 Allow Yesod.Auth.Email handlers to be overriden.
The main purpose is to allow more customization of the Yesod.Auth.Email
handlers by not only changing the CSS but also the DOM.
2014-02-25 19:28:09 -03:00
Felipe Lessa
9e6db27be2 Sync normalizeEmailAddress' doc to current code. 2014-02-25 19:11:44 -03:00
Felipe Lessa
9f7031d9dd Whitespace. 2014-02-25 19:10:02 -03:00
Felipe Lessa
71558d3342 Increase Yesod.Auth.Email pwstore strength to the recommended minimum of 14. 2014-02-25 19:08:50 -03:00
Michael Snoyman
5f99205f13 Merge pull request #671 from arpunk/remove-deprecated-html-rep
Remove deprecated RepHtml content type in yesod-auth
2014-02-25 06:33:33 +02:00
arpunk
167b29db8d Remove deprecated RepHtml content type 2014-02-24 23:18:46 -05:00
Michael Snoyman
b32be57fe8 Added widgets benchmark 2014-02-24 19:02:04 +02:00
Michael Snoyman
9fad1071fc Incomplete changes 2014-02-24 14:20:17 +02:00
Michael Snoyman
98b64cd17c Security warnings for Yesod.Auth.HashDB #668 2014-02-22 19:22:47 +02:00
Michael Litchard
0ab2fc21fd version bump 2014-02-22 07:43:55 -08:00
Michael Litchard
b4f181ba38 Merge branch 'master' of https://github.com/yesodweb/yesod
Conflicts:
	sources.txt
2014-02-22 06:48:23 -08:00
Michael Litchard
2081d810b9 Merge branch 'oauth-fix-deps' of https://github.com/yesodweb/authenticate
Conflicts:
	.gitignore
	.travis.yml
	sources.txt
2014-02-22 06:45:39 -08:00
Michael Snoyman
94cab1c9d4 RSA 2.0 support 2014-02-21 07:16:04 +02:00
Michael Snoyman
b10717f311 Platform: use newer warp 2014-02-19 09:12:15 +02:00
Michael Snoyman
d262543ff1 Scaffolding update 2014-02-19 09:12:07 +02:00
Michael Snoyman
a95d572efa Include yesod-eventsource 2014-02-16 08:01:15 +02:00
Michael Snoyman
504a10a4e9 Platform update 2014-02-16 08:01:08 +02:00
Michael Snoyman
480b4e3304 Some fixes for mass input 2014-02-10 11:24:20 +02:00
Michael Snoyman
53bf9496dd Try to address #612 2014-02-09 10:34:25 +02:00
Michael Snoyman
be73d7d6c9 Scaffolding update 2014-02-07 07:55:08 +02:00
Michael Snoyman
9386be5f97 Version bump 2014-02-05 17:36:53 +02:00
Michael Snoyman
fd0fe2daff defaultMainLog 2014-02-05 17:35:45 +02:00
Michael Snoyman
9ec14e7f53 Log exceptions from Warp 2014-02-05 09:48:33 +02:00
Michael Snoyman
e7bddafcbb Merge pull request #662 from yesodweb/never-expires-cache-control
add cache-control to neverExpires
2014-02-03 20:30:31 -08:00
Greg Weber
f20c236d50 add cache-control to neverExpires 2014-02-03 16:33:29 -08:00
Michael Snoyman
3bec45790e Version bump 2014-02-02 18:57:17 +02:00
Michael Snoyman
7a7b843c1d Merge branch 'master' of github.com:yesodweb/yesod 2014-02-02 18:56:57 +02:00
Michael Snoyman
37a2aba25c Version bump 2014-02-02 18:45:29 +02:00
Michael Snoyman
254316f91f Merge pull request #661 from czednick/cz_done_change
Update done output to use Michael's PSA cabal advice
2014-02-01 09:03:45 -08:00
Casey Zednick
03ecaba0cc Update done output to use Michael's PSA advice (https://groups.google.com/forum/#!topic/yesodweb/5fPqTr0Ca3A) 2014-01-31 23:08:23 -08:00
Michael Snoyman
cdfd478fcd Factor out some duplicated code 2014-01-31 13:15:05 +02:00
Elise Huard
a417b95a98 runInputPostResult is the modified method 2014-01-31 10:45:43 +01:00
Elise Huard
12897ae5a0 Defer error handling of runInputForm to user code. 2014-01-30 15:28:56 +01:00
Michael Snoyman
c0e366bd72 Version bump 2014-01-27 17:25:06 +02:00
Michael Snoyman
5ee5301ce8 Added test cases for #658 notCaught 4 and 5 2014-01-27 17:24:50 +02:00
Michael Snoyman
86b7f5ea43 Test case and fix for notCaught3 in #658 2014-01-27 17:20:02 +02:00
Michael Snoyman
b828c7c600 Version bumps 2014-01-27 15:12:18 +02:00
Michael Snoyman
77eeb929d4 Updated scaffolding 2014-01-27 15:11:55 +02:00
Michael Snoyman
8d41c8f735 Merge pull request #657 from pSub/atom-author
newsfeed/atom: Wrap the name of the author in a name element.
2014-01-26 08:08:36 -08:00
Pascal Wittmann
c9255712fb Wrap the name of the author in a name element.
According to http://tools.ietf.org/html/rfc4287 the atom:author
element contains a person construct, that is it contains at least the
name element.
2014-01-26 15:22:47 +01:00
Michael Snoyman
a6594f5408 Better cabal install command 2014-01-23 20:03:24 +02:00
Michael Snoyman
b88308720f step= for int and double fields 2014-01-21 22:52:18 +02:00
Michael Snoyman
611f18baf5 conduit update 2014-01-20 17:04:02 +02:00
Michael Snoyman
5f3eaf1f10 More platform updates 2014-01-20 11:23:22 +02:00
Michael Litchard
853d92c6d2 Glad to be aboard 2014-01-17 18:58:33 -08:00
Michael Snoyman
1f0ab6acf2 Use newer SHA in yesod-platform 2014-01-17 15:38:26 +02:00
Michael Snoyman
dfcbe249e4 yesod-platform update 2014-01-16 19:29:42 +02:00
Michael Snoyman
db096471ca persistent2 2014-01-16 08:23:50 +02:00
Michael Snoyman
1479f44f82 Version bumps 2014-01-16 07:46:27 +02:00
Michael Snoyman
807ff497f9 aeson 0.7 support 2014-01-15 19:12:57 +02:00
Michael Snoyman
1a43658455 Merge pull request #653 from triplepointfive/form_double_field
Change doubleField type from text to number
2014-01-13 22:15:13 -08:00
Ilya Smelkov
d500468b8d Change doubleField type from text to number 2014-01-13 23:27:22 +04:00
Michael Snoyman
08d1233415 Merge pull request #651 from yesodweb/auth-layout
yesod-auth: user defined layout
2014-01-12 06:07:58 -08:00
Michael Snoyman
78cd98af12 Version bump 2014-01-12 16:04:01 +02:00
Michael Snoyman
47d136b057 Allow !# as well as #! #652 2014-01-11 19:51:04 +02:00
Greg Weber
d817d37c9c yesod-auth: user defined layout 2014-01-08 14:35:13 -08:00
Greg Weber
153654adb9 yesod-auth: send json responses 2014-01-08 12:19:45 -08:00
Michael Snoyman
12480b2d2a Adjust some version bounds in scaffolding 2014-01-03 14:58:13 +02:00
Michael Snoyman
14fbd3860c Fix add-handler for multipiece routes (closes #640) 2013-12-29 09:47:18 +02:00
Michael Snoyman
f76b09856b platform update 2013-12-29 08:38:25 +02:00
Michael Snoyman
aedd5aff36 scaffolding update 2013-12-29 08:33:39 +02:00
Michael Snoyman
3ca170b45d Scaffolding update #641 2013-12-28 19:16:19 +02:00
Michael Snoyman
45eadd3e09 fast-logger 2.1 support 2013-12-26 13:53:39 +02:00
Michael Snoyman
b018c5d7aa Allow persistent 1.3 2013-12-26 12:13:10 +02:00
Michael Snoyman
9e7cba4d67 Merge branch 'master' of github.com:yesodweb/yesod 2013-12-24 15:04:19 +02:00
Michael Snoyman
98955ac161 Minor doc fix (thanks Toby) 2013-12-24 14:52:50 +02:00
Greg Weber
507d6faed8 Merge pull request #638 from jprider63/master
Add the function onHtmlError to the auth typeclass so users can customize behavior on authentication errors.
2013-12-23 07:16:31 -08:00
Michael Snoyman
c4f58611cf Version bump 2013-12-23 11:32:54 +02:00
Michael Snoyman
742e21f011 Merge pull request #639 from mruegenberg/master
Add Typeable instance for User entity in Auth.HashDB. Fix #634.
2013-12-22 20:42:06 -08:00
jp.rider63
df9a8136a6 renamed to onErrorHtml 2013-12-22 22:13:59 -05:00
Greg Weber
20efbebe4e test cases for multiple method routes 2013-12-22 17:10:17 -08:00
Michael Snoyman
9b69c15bfd Possible travis fix 2013-12-22 16:46:38 +02:00
Michael Snoyman
8376f4da9e Revert "Update Functions.hs"
This reverts commit 78913a2cfb.
2013-12-22 16:29:12 +02:00
jp.rider63
ed0e551d17 updated onHtmlError documentation 2013-12-22 01:06:57 -05:00
jp.rider63
b57ac44d9c Added type constraint to onHtmlError. Modified plugins to support this
changed type
2013-12-22 01:02:30 -05:00
Michael Snoyman
1c72dc7788 Merge pull request #637 from yesodweb/json-auth
use loginErrorMessageI to send a json response
2013-12-21 21:17:47 -08:00
Marcel Ruegenberg
13347802bf Add Typeable instance for User entity in Auth.HashDB. Fix #634. 2013-12-21 20:11:19 +01:00
Michael Snoyman
91ccaf98f7 Remove ../wai from sources.txt 2013-12-21 20:17:57 +02:00
Michael Snoyman
c5a59a98d4 Merge pull request #635 from andrewthad/master
Update Functions.hs
2013-12-21 10:02:22 -08:00
Greg Weber
366e63fb36 use loginErrorMessageI to send a json response 2013-12-20 18:32:20 -08:00
jp.rider63
e17523b8f2 attempt at adding onError to auth typeclass 2013-12-20 12:49:30 -05:00
andrewthad
78913a2cfb Update Functions.hs
Generalize parseHelper to work with types of messages other than FormMessage.
2013-12-20 12:01:55 -05:00
Michael Snoyman
304d5d101e Version bump 2013-12-18 09:07:21 +02:00
Michael Snoyman
1429ae83eb Improved overlap checking for nesting #632 2013-12-18 08:24:32 +02:00
Greg Weber
5bc9f06959 test case for overlapping routes bug 2013-12-17 14:18:54 -08:00
Michael Snoyman
9dc16daff2 Version bump 2013-12-17 15:56:56 +02:00
Michael Snoyman
0b4a7185c6 Add some docs 2013-12-17 15:55:28 +02:00
Michael Snoyman
08375a0da8 yesod-platform update 2013-12-13 09:01:11 +02:00
Michael Snoyman
6f68aa46ff Version bump 2013-12-13 08:24:18 +02:00
Greg Weber
bd6b9253a1 remove old embed-refresh flag
fixes indentation issue
2013-12-12 21:52:23 -08:00
Michael Snoyman
d4998d2246 Temp file upload changes in wai-extra 2.0.1 #630 2013-12-13 06:45:40 +02:00
Michael Snoyman
d8bdcae2d5 Add required attribute for radio fields and selects #628 2013-12-11 18:56:48 +02:00
Michael Snoyman
62da244763 Minor yesod-platform update 2013-12-11 17:50:59 +02:00
Michael Snoyman
ce71775067 Version bump 2013-12-11 17:26:47 +02:00
Michael Snoyman
48ea50ac93 Filter out blank lines in route parsing #629 2013-12-11 17:00:03 +02:00
Greg Weber
f88c927875 failing test case for a space under nesting 2013-12-10 19:47:25 -08:00
Greg Weber
ef80ab00df bump yesod-bin version for new --interrupt-only option 2013-12-10 13:52:40 -08:00
Greg Weber
fbfd1b65e4 Merge branch 'master' of github.com:yesodweb/yesod 2013-12-10 13:50:20 -08:00
Michael Snoyman
72af90d541 yesod-platform update 2013-12-10 18:24:47 +02:00
Michael Snoyman
853e7ad7b5 Remove text upper bounds 2013-12-04 15:01:07 +02:00
Michael Snoyman
82a0d0d390 http-conduit 2.0 support 2013-12-04 14:29:52 +02:00
Michael Snoyman
1747e2fdc8 Don't use fromStrict 2013-12-04 14:16:25 +02:00
Michael Snoyman
02ab5320e3 Version bumps 2013-12-04 07:01:20 +02:00
Michael Snoyman
19f13fa3c7 Scaffolding update 2013-12-04 07:00:28 +02:00
Michael Snoyman
4fe36c848e Bump resourcet dep 2013-12-04 06:09:28 +02:00
Michael Snoyman
04893d6b0a Export credsKey 2013-12-04 05:26:51 +02:00
Michael Snoyman
cf0fad20bc Merge branch 'master' of github.com:yesodweb/yesod 2013-12-03 12:34:55 +02:00
Michael Snoyman
cca38cfe03 Expand prefix on generated identifiers #625 2013-12-03 12:01:11 +02:00
Michael Snoyman
f85b38e817 Fix tests: force HTTP/1.1 in a few places 2013-12-03 11:57:56 +02:00
Michael Snoyman
c670c54ba4 fast-logger 2.0 2013-12-03 11:55:39 +02:00
Michael Snoyman
b18e43c050 Incomplete fast-logger 2.0 changes 2013-12-02 19:40:03 +02:00
Michael Snoyman
a2851c929c Merge branch 'master' into wai-2.0
Conflicts:
	yesod-bin/Devel.hs
2013-12-02 08:00:37 +02:00
Michael Snoyman
6b2e4ef3a4 Switch to EMBED_REFRESH 2013-12-02 07:59:26 +02:00
Greg Weber
12d0832f50 add --interrupt-only so yesod does not interrupt on enter
Useful when running multiple jobs in the same shell
2013-11-22 16:15:35 -08:00
Greg Weber
84c53fb74f add embed-refresh flag 2013-11-22 16:14:42 -08:00
Michael Snoyman
b81a9721fb Disable CSS minification when combining stylesheets #623 2013-11-21 22:44:31 +02:00
Greg Weber
7915510322 hlint & compiler warnings
also tried out embeding the refresh file
2013-11-19 11:24:59 -08:00
Greg Weber
8390802a6b randomly show one motivational refresh messages 2013-11-19 11:24:59 -08:00
Michael Snoyman
089f8f1e12 Ignore sandbox files #620 2013-11-14 21:10:26 +02:00
Michael Snoyman
3330e89e10 Merge remote-tracking branch 'origin/master' into wai-2.0 2013-11-12 19:40:51 +02:00
Michael Snoyman
11b49dfe9e Merge remote-tracking branch 'origin/master' into HEAD 2013-11-12 19:29:34 +02:00
Michael Snoyman
dce5ea942e Fix a faulty rewrite rule 2013-11-12 19:29:18 +02:00
Michael Snoyman
4d25fd2be1 Replace lift . notFound to avoid a segfault bug 2013-11-12 19:28:18 +02:00
Michael Snoyman
d34c3f26dc WAI 2.0 updates 2013-11-10 16:49:26 +02:00
Michael Snoyman
6f495fc758 Merge branch 'master' into wai-2.0
Conflicts:
	yesod-static/yesod-static.cabal
2013-11-10 13:46:58 +02:00
Michael Snoyman
294641c404 Version bumps 2013-11-10 07:48:01 +02:00
HugoDaniel
178a0c8052 Using CL.map in readIt 2013-11-07 11:15:40 +00:00
HugoDaniel
ec8edc92f1 Listing files into a hsfiles file is now simpler 2013-11-07 09:58:34 +00:00
Greg Weber
b86f809a10 fix environment capitalize function 2013-11-05 14:26:46 -08:00
Michael Snoyman
30dac8fbb6 Merge branch 'master' of github.com:yesodweb/yesod 2013-11-01 08:12:38 +02:00
Michael Snoyman
5a53777615 Newer entropy fixes #617 2013-11-01 08:12:14 +02:00
Greg Weber
9e17b83514 add --force-reinstalls to .travis.yml 2013-10-29 21:02:04 -07:00
Greg Weber
1722d32666 done message should reference the sandbox 2013-10-29 20:51:47 -07:00
Greg Weber
2d79ef43e9 cabal-dev -> cabal sandbox 2013-10-29 20:41:41 -07:00
Michael Snoyman
0c386c9f46 Replace ghcError with throwGhcException #612 2013-10-15 10:33:45 +03:00
Michael Snoyman
ad6e99d589 GHC 7.8 changes 2013-10-15 10:30:05 +03:00
Michael Snoyman
f04c4c456c Add an extensions line for TH 2013-10-15 10:30:05 +03:00
Michael Snoyman
5fb40434e9 Merge pull request #611 from wuzzeb/compress-messages
yesod-static: improve messages for embedded compression tools
2013-10-13 20:56:31 -07:00
Michael Snoyman
2e7694d465 Version bump 2013-10-13 18:40:17 +03:00
Michael Snoyman
a94566e22e Version bump 2013-10-13 13:06:41 +03:00
Michael Snoyman
3a9fa33b7e Export a TH-used identifier #609 2013-10-13 12:11:15 +03:00
Michael Snoyman
978d6a80da optparse-applicative 0.6 #610 2013-10-13 11:27:00 +03:00
Michael Snoyman
eb478470e9 Merge pull request #608 from AaronFriel/master
Update Socks dependency to fix build error
2013-10-10 09:39:40 -07:00
Aaron Friel
ba7d732a81 Update Socks dependency to fix build error 2013-10-10 10:39:37 -05:00
Michael Snoyman
8fb2d180d5 cereal 0.4 fpco/stackage#121 2013-10-01 15:42:46 +03:00
Michael Snoyman
eb5c5be2c5 Merge pull request #603 from axel-angel/checkboxesField
Add checkboxesField{,List} fields (based on multiSelectField{,List})
2013-09-22 11:21:43 -07:00
Axel Angel
0dcc9e2b29 Simplify in checkboxesField{,List}: no intermediate selOpts list 2013-09-22 15:08:21 +02:00
Axel Angel
a3bef1bc2b Add missing exports for checkboxesField{,List} 2013-09-22 15:01:09 +02:00
John Lenz
a4690dd424 yesod-static: improve messages for embedded compression tools
When trying various compression tools, display some messages
to the user about which compression tool is used.

--HG--
extra : rebase_source : e90e6ed49317b91a0fbe90d94f437459926f59e7
2013-09-19 15:22:14 -05:00
Axel Angel
d13c145b97 Add checkboxesField{,List} fields (based on multiSelectField{,List})
squashed:
    - Attrs are applied to checkboxes in checkBoxField
    - Fix checkboxesField{,List} attrs are applied to input instead of span
    - Fix checkboxesField{,List} attribute checked
2013-09-18 20:27:24 +02:00
Michael Snoyman
f0cfebe879 Merge pull request #601 from wuzzeb/data-default
static: make Entry a setting type
2013-09-17 10:14:55 -07:00
John Lenz
380cdcd174 static: make Entry a setting type
In the future we might want to add new features to the
Entry.  I am currently thinking about source maps, where
a new field will need to be added to the Entry.  Therefore,
use Data.Default to make sure we don't need to bump the
major version for these features.
2013-09-17 11:03:00 -05:00
Michael Snoyman
b903128bf0 Merge pull request #600 from wuzzeb/embedded-static
Embedded static
2013-09-15 00:51:00 -07:00
John Lenz
1a5aa23f13 static: fix the build on GHC 7.4
There were two build issues on GHC 7.4: using atomicModifyIORef'
and ByteString.Lazy.toStrict, both of which were missing.  These
are now fixed.

In addition, looking at the IORef code more closely,
we want the quite a bit of strictness in the IORef.
The common case is that the widget content already exists in the map
(every reload of a page will call embedStaticContent), but until we
force the map the thunks holding the duplicated generated content will
be kept around, leaking memory.  This will be the common situation since
the vast majority of the time the content already exists.  Since
the containers module does not have a strict map until 0.5, use
unordered containers which does have a strict map.
2013-09-12 17:52:15 -05:00
John Lenz
8e16fd2227 static: update sample-embed.hs and point the old embedded static to the new one 2013-09-12 12:21:47 -05:00
John Lenz
2ad3977712 static: add several embedded generators
This constains the generators to embed files, directories,
and javascript compression
2013-09-12 12:21:47 -05:00
John Lenz
f8a35ce0a0 static: Add an embedded static subsite
This commit adds just the subsite itself.  The subsite
works by running a list of generaters at compile time.
The entries produced by the generators are converted into
wai-app-static.WaiAppStatic.Storage.Embedded entries.  Also,
addStaticContent is supported via an IORef.  When a widget
produces static content (css, javascript), it is stuck into
the IORef inside the embedded static subsite.  The embedded
static subsite will then serve it from the IORef, properly
using a 304 response if the client already has the content.
2013-09-12 12:21:33 -05:00
Michael Snoyman
c876974656 version bumps 2013-09-10 20:43:42 +03:00
Michael Snoyman
07aa7fe037 Merge remote-tracking branch 'origin/normalize-email'
Conflicts:
	yesod-auth/yesod-auth.cabal
2013-09-09 17:09:22 +03:00
Michael Snoyman
7274341322 normalizeEmailAddress 2013-09-09 15:01:20 +02:00
Michael Snoyman
23b4564424 Do not include vault in yesod-platform 2013-09-09 08:30:56 +02:00
Michael Snoyman
43e806ef4e true/false for boolField #595 2013-09-08 17:21:08 +02:00
Michael Snoyman
94e4310a9c --bare option to init #515 2013-09-08 17:17:05 +02:00
Michael Snoyman
5b379067b2 Add warning about calling parseJsonBody twice 2013-09-08 16:52:56 +02:00
Michael Snoyman
8ae0b789e1 Merge branch 'master' into wai-2.0 2013-09-08 14:25:10 +02:00
Michael Snoyman
a3f004184e platform update 2013-09-08 14:23:45 +02:00
Michael Snoyman
759eb4154b Scaffolding tweak 2013-09-08 14:20:27 +02:00
Michael Snoyman
db17c0ade1 shakespeare 1.2/version bumps 2013-09-08 13:48:24 +02:00
Michael Snoyman
94f42659ea Merge branch 'master' into wai-2.0 2013-09-08 13:23:09 +02:00
Michael Snoyman
679046cae0 Merge remote-tracking branch 'origin/master' 2013-09-08 13:10:14 +02:00
Michael Snoyman
e4c39d22bb yesod-platform update 2013-09-08 13:08:59 +02:00
Michael Snoyman
5ed1a23390 Merge pull request #597 from Tarrasch/patch-4
Update README.md
2013-09-08 03:13:15 -07:00
Arash Rouhani
1005c3f009 Update README.md 2013-09-08 12:08:01 +02:00
Michael Snoyman
e29cd12ff8 Version bumps 2013-09-08 10:46:37 +02:00
Michael Snoyman
5642489841 Minor tweaks for #590 2013-09-01 16:15:03 +03:00
Michael Snoyman
f0ba8bb7f3 Merge branch 'master' of https://github.com/andrewthad/yesod 2013-09-01 15:46:12 +03:00
Michael Snoyman
6d9369e186 Merge pull request #593 from koterpillar/cryptohash-cryptoapi
Update to cryptohash-cryptoapi
2013-09-01 01:54:18 -07:00
Alexey Kotlyarov
f0bef8005f Update to cryptohash-cryptoapi
Crypto.Hash.MD5 no longer exports the MD5 type, switch to
cryptohash-cryptoapi.
2013-09-01 15:05:27 +10:00
Michael Snoyman
833d83c3e3 Merge pull request #592 from lubomir/translate-auth
Add Czech translation for auth messages
2013-08-31 10:36:51 -07:00
Michael Snoyman
48c6ff3600 Merge pull request #591 from obscaenvs/patch-2
Changed description of hsenv
2013-08-31 10:32:21 -07:00
Lubomír Sedlář
94fd685046 Add Czech translation for auth messages 2013-08-31 13:37:20 +02:00
Fredrik Carlen
44f7cf0bf0 Changed description of hsenv
- `hsenv` works on Mac OS X also (at least Lion and Mountain lion).
- supplied link to forked, working version of `hsenv` at https://github.com/tmhedberg/hsenv
2013-08-31 10:56:56 +02:00
andrewthad
c9791bd2c7 Update Fields.hs 2013-08-30 12:21:40 -04:00
andrewthad
b8d47f880f Added optionsPersistKey to Fields
There is no immediately obvious way to use optionsPersist with selectField. The function optionsPersistKey makes this possible. Example of use:
areq (selectField $ optionsPersistKey [] [Asc UserIdent] userIdent) "User" Nothing
2013-08-28 15:14:08 -04:00
Michael Snoyman
ffc27af9c2 Merge pull request #589 from lubomir/doc-update
Add more documentation to Yesod.Form.Functions
2013-08-24 11:21:27 -07:00
Lubomír Sedlář
1ea61ddfc7 Add more documentation to Yesod.Form.Functions 2013-08-23 16:44:21 +02:00
Michael Snoyman
e420705b07 Allow modification of confirmation email page 2013-08-20 13:38:11 +03:00
Michael Snoyman
366127527a Fix some CPP 2013-08-19 13:20:44 +03:00
Michael Snoyman
2d0f560bea wai 2.0 2013-08-19 12:51:54 +03:00
Michael Snoyman
01738f354f Scaffolding updates 2013-08-18 18:33:32 +03:00
Michael Snoyman
d5bf0f583d Version bumps 2013-08-13 18:59:21 +03:00
Michael Snoyman
d1a44454e4 hsfiles update 2013-08-13 18:57:34 +03:00
Michael Snoyman
525467cf57 Merge pull request #578 from k-bx/master
Add postBody and setRequestBody functions to POST some data in a test.
2013-08-11 22:34:57 -07:00
Anthony Burzillo
9cd6573ea7 Remove uneeded whitespace from files created on init 2013-08-11 13:55:44 -04:00
Konstantine Rybnikov
928be6991e Refactor a bit to make pattern matching happy and makeMultipart only work on multipart data. 2013-08-11 09:53:41 +03:00
Konstantine Rybnikov
59eb67e087 Add error-reporting when trying to add file or post-param after binary content is set. 2013-08-09 23:13:56 +03:00
Konstantine Rybnikov
441842ae12 Revert "Use GADTs for static guarantee you use right type of post data."
This reverts commit 3655af11d3.
2013-08-09 22:48:09 +03:00
Michael Snoyman
e99302e93d needOldPassword and checkPasswordSecurity 2013-08-07 09:21:29 +03:00
Michael Snoyman
aa5781d4e4 shouldLogIO 2013-08-07 07:22:28 +03:00
Michael Snoyman
d5b66d35d5 Allow overriding status code in error handlers 2013-08-04 08:55:42 +03:00
Michael Snoyman
97b78ad481 fromArgsSettings #583 2013-08-04 08:36:05 +03:00
Michael Snoyman
f0f85a0a03 Merge pull request #581 from lubomir/czech-translation-2
Add Czech translation to forms
2013-08-01 10:27:47 -07:00
Lubomír Sedlář
51f1b54b34 Add Czech translation to forms 2013-08-01 19:23:59 +02:00
Konstantine Rybnikov
3655af11d3 Use GADTs for static guarantee you use right type of post data. 2013-07-30 11:11:34 +03:00
Konstantine Rybnikov
eb7ad4e480 Remove unused comment 2013-07-29 17:03:37 +03:00
Konstantine Rybnikov
a46a6fa399 Small spacing fix 2013-07-29 17:01:20 +03:00
Konstantine Rybnikov
fdb564abfe Get post function back without overwriting content 2013-07-29 17:00:32 +03:00
Konstantine Rybnikov
8664c010da Second attempt to write a good postBody and setRequestBody. 2013-07-29 16:57:13 +03:00
Konstantine Rybnikov
ee168c7829 Add postBody and setRequestBody functions to POST some data in a test. 2013-07-29 11:26:32 +03:00
Michael Snoyman
5d3572d792 Merge pull request #577 from k-bx/master
Add yesodSpecWithSiteGenerator method.
2013-07-25 22:38:15 -07:00
Konstantine Rybnikov
a67732329d Add yesodSpecWithSiteGenerator method.
This method "extracts" site from `IO site` action every time, instead
of getting it only once. Helpful for flushing database (to recreate
connections) etc.
2013-07-25 17:48:29 +03:00
Michael Snoyman
01a2b823c5 yesod-platform bump 2013-07-23 14:07:09 +03:00
Michael Snoyman
e51f4cadcb Version bump 2013-07-19 06:27:59 +03:00
Michael Snoyman
ce21720d3b Merge pull request #572 from chrisdone/refreshing-page
Add nice refreshing page
2013-07-16 02:33:46 -07:00
Chris Done
39b031f35e Add nice refreshing page. 2013-07-16 08:30:46 +02:00
Michael Snoyman
444ee7aadb New yesod-platform 2013-07-07 12:50:26 +03:00
Michael Snoyman
1f614b3b44 Version bump 2013-07-07 10:17:31 +03:00
Michael Snoyman
fccfaf862f Do not include hashable 2013-07-07 10:14:17 +03:00
Michael Snoyman
11016c9c5c Merge pull request #568 from mgsloan/yesod-auth-email-autofocus
Add autofocus to input fields of the Yesod.Auth.Email subsite
2013-07-04 00:01:40 -07:00
Michael Sloan
ea37928397 Add autofocus to input fields of the Yesod.Auth.Email subsite 2013-07-03 23:20:12 -07:00
Michael Snoyman
aae3c7a4fb Version bumps 2013-06-24 13:57:07 +03:00
Michael Snoyman
a9a8cd3286 Merge branch 'master' of github.com:yesodweb/yesod 2013-06-24 13:53:06 +03:00
Michael Snoyman
b5bb56d4e1 Scaffolding updates 2013-06-23 21:15:36 +03:00
Hiromi Ishii
a971bfa8dc Merge pull request #23 from yesodweb/cpt-0.4
Cpt 0.4
2013-06-19 07:34:50 -07:00
Michael Snoyman
49f1c76aea Allow crypto-pubkey-types 0.4 2013-06-19 07:01:02 +03:00
Michael Snoyman
548743d5da Merge pull request #564 from imvu/master
Request to add a ToTypedContent to the response tyvar of Handler for yesodMiddleware.
2013-06-18 01:09:27 -07:00
Jonathan Fischoff
28e7bc26b8 Adding a ToTypedContent constraint to yesodMiddleware for response logging, etc. 2013-06-17 14:24:50 -07:00
Greg Weber
7658deaf05 typo in comment 2013-06-10 13:36:22 -07:00
Michael Snoyman
f9be0a83bd Option to disable reverse proxy 2013-06-10 13:42:08 +03:00
Michael Snoyman
d377b48510 Merge pull request #561 from iquiw/master
Use protocol relative URLs for Google hosted libraries
2013-06-08 23:52:44 -07:00
Iku Iwasa
6ed1b27a4a Use protocol relative URLs for Google hosted libraries 2013-06-09 15:10:02 +09:00
Michael Snoyman
202d41e708 New yesod-platform 2013-06-06 23:07:59 +03:00
Michael Snoyman
169d14b444 Version bump 2013-06-06 21:07:39 +03:00
Michael Snoyman
e3cc6f3e22 Merge pull request #560 from meteficha/parseRoutesFile-fix
parseRoutesFile should use qAddDependentFile
2013-06-06 11:05:58 -07:00
Felipe Lessa
6163049028 yesod-routes: Bump version to 1.2.0.1. 2013-06-06 12:53:06 -03:00
Felipe Lessa
3fa327c662 Use qAddDependentFile on parseRoutesFile*. 2013-06-06 12:52:40 -03:00
Michael Snoyman
c8146210c6 Yesod.Persist.Core 2013-06-06 10:09:30 +03:00
Michael Snoyman
8e5c419dd5 Move some Yesod exports to Yesod.Core 2013-06-06 10:05:22 +03:00
Michael Snoyman
772563c46b lookupHeader/lookupHeaders 2013-05-30 08:31:24 +03:00
Michael Snoyman
8ff8dcb776 http-reverse-proxy 0.2 2013-05-28 13:56:56 +03:00
Michael Snoyman
743966898d Move away from RepHtml some more 2013-05-20 09:16:53 +03:00
Michael Snoyman
44c5b03a6e Deprecate hamletToRepHtml 2013-05-19 19:33:48 +03:00
Hiromi Ishii
0ace941117 version bump 2013-05-19 13:28:53 +09:00
Hiromi Ishii
c43b272327 Merge pull request #556 from notogawa/master
yesod-auth-oauth for yesod-1.2
2013-05-18 21:18:32 -07:00
notogawa
a897502679 caught up with yesod 1.2 2013-05-18 23:01:15 +09:00
Michael Snoyman
464c78c9b0 Version bump 2013-05-12 09:08:06 +03:00
Michael Snoyman
7ace5dde01 Merge pull request #553 from yesodweb/json-auth-plugins
Json auth plugins
2013-05-11 23:06:33 -07:00
Hiromi Ishii
b831fb8cc3 version bumped 2013-05-10 02:16:11 +09:00
Hiromi Ishii
448061baaa relaxed version restriction. 2013-05-10 02:10:45 +09:00
Greg Weber
0c9abba5c1 BrowserID: don't use an exception on failure 2013-05-09 11:45:19 -05:00
Greg Weber
604d93512b auth plugins should send JSON response
previously they always redirected
2013-05-09 11:42:34 -05:00
Michael Snoyman
89203d0630 returnJson and provideJson 2013-05-09 08:39:06 +03:00
Michael Snoyman
bb5fa38eb2 Merge pull request #551 from tlaitinen/master
401 Unauthorized HTTP status code for JSON-reply login fails and success="true" for JSON-reply
2013-05-08 00:12:16 -07:00
Tero Laitinen
021b0f48f9 401 Unauthorized HTTP status code for JSON-reply login fails 2013-05-07 21:31:51 +03:00
Michael Snoyman
6db31ec3c4 HashDB: JSON response on bad login #549 2013-05-07 18:54:16 +03:00
Michael Snoyman
64f51da0df Require lifted-base 0.1.2 (Data.IORef.Lifted) 2013-05-07 11:15:59 +03:00
Michael Snoyman
cc21c7a7ec yesod-platform update 2013-05-07 07:29:55 +03:00
Greg Weber
eb779fb0f6 document UniqueList 2013-05-06 16:57:13 -05:00
Felipe Lessa
8bde1b592f yesod-eventsource: Update to Yesod 1.2. 2013-05-03 21:21:53 -03:00
Felipe Lessa
5c434b089a Rewrite handlerToIO so that it works with Yesod 1.2.
Since the new YesodRequest has strict fields, handlerToIO didn't
work at all.  Even if it did, it had a reference to its parent's
ResourceT's internal state, so its chances of blowing up were
quite high.

The new implementation takes a whitelist approach of taking what
we want instead of clearing what we do not want.  Also, it takes
care of using a new runResourceT.
2013-05-03 21:20:31 -03:00
Felipe Lessa
c19501b1d8 yesod-core: New 'customizeSessionCookies' helper function. 2013-05-03 20:56:52 -03:00
Michael Snoyman
26d3458745 Pass in -DWINDOWS on Windows #546 2013-05-02 23:24:20 -07:00
Michael Snoyman
1bcc05aee7 Workaround for #545 2013-05-03 08:44:23 +03:00
Michael Snoyman
3e7d4eeaa2 Fix tests in tarball #543 2013-05-03 08:07:37 +03:00
Michael Snoyman
479bc93655 New yesod-platform 2013-05-02 13:23:48 +03:00
Michael Snoyman
568312d794 Ignore /tarballs/ 2013-05-02 08:50:58 +03:00
Michael Snoyman
3956958b7a Better Show HandlerContents 2013-05-01 14:38:21 +03:00
Michael Snoyman
4e2041a1e3 Remove persistent from sources.txt 2013-04-29 08:07:17 +03:00
Michael Snoyman
c47d2bd442 Merge pull request #542 from yesodweb/no-string-packing
Revert string packing in yesod-static
2013-04-25 05:15:38 -07:00
Michael Snoyman
18dd77a1fe Revert string packing in yesod-static 2013-04-25 13:55:45 +03:00
Michael Snoyman
81c6e3b607 Merge commit '7010292840eeba205238ac13686155dd8b5b9609' 2013-04-25 09:06:20 +03:00
Michael Snoyman
7010292840 Add link to yesod-auth-account 2013-04-25 09:06:11 +03:00
Michael Snoyman
872a259680 Scaffolding doc update 2013-04-25 03:19:02 +03:00
Michael Snoyman
87dd80fee0 Updated scaffoldings 2013-04-25 03:14:58 +03:00
Michael Snoyman
eecfe25e2a Merge remote-tracking branch 'origin/maintain/1.1' 2013-04-24 22:04:21 +03:00
Michael Snoyman
3f85f1b91e New yesod-platform 2013-04-24 22:01:22 +03:00
Michael Snoyman
d79fe24d4d Fixes after merge 2013-04-24 22:00:56 +03:00
Michael Snoyman
98ededba28 Merge remote-tracking branch 'origin/yesod1.2'
Conflicts:
	yesod-auth/Yesod/Auth.hs
	yesod-auth/yesod-auth.cabal
	yesod-core/yesod-core.cabal
	yesod-static/Yesod/Static.hs
	yesod-static/yesod-static.cabal
	yesod/yesod.cabal
2013-04-24 19:00:03 +03:00
Michael Snoyman
d3f25d1f44 Version bumps 2013-04-24 18:23:44 +03:00
Felipe Lessa
7a5c9c3276 Whitespace. 2013-04-24 10:27:52 -03:00
Felipe Lessa
fac15a4e26 Bump clientsession deps on scaffold. 2013-04-24 10:27:41 -03:00
Michael Snoyman
04f23c740a Not experimental 2013-04-23 22:23:02 +03:00
Michael Snoyman
abd4cc5fc2 Export yesodRunner 2013-04-23 11:55:27 +03:00
Michael Snoyman
f9520e90e7 Sitemap: start with a flush 2013-04-22 19:54:16 +03:00
Michael Snoyman
42943deab9 Better route type parsing (fixes #471) 2013-04-22 15:01:52 +03:00
Fredrik Carlen
21b8d3e10b Update Message.hs
Added translations to the Swedish messages, and added also some minor corrections to those aswell.
2013-04-22 10:48:35 +03:00
josejuan
0f0c30ecf8 Some corrections on Spanish string into Message.hs
Some corrections on Spanish string into Message.hs
Minor grammatical errors and some unusual terminology.
2013-04-21 22:38:54 +03:00
Felipe Lessa
9a09a80cd8 Update Portuguese translation. 2013-04-21 14:40:49 -03:00
kluge
afa330a83d Update Finnish translations
Add Finnish translations for new strings related to username logins.
2013-04-21 20:20:18 +03:00
Michael Snoyman
60c9df66f4 Fix Spanish messages 2013-04-21 18:38:55 +03:00
Francisco Jose CHAVES
f2bb79faad Update Message.hs
LatinAmerican Spanish
2013-04-21 10:04:11 -05:00
Michael Snoyman
73726dcd6e Merge branch 'patch-1' of https://github.com/pSub/yesod into yesod1.2 2013-04-21 17:15:24 +03:00
Michael Snoyman
16260f3e37 RouteAttrs (fixes #531) 2013-04-21 17:14:40 +03:00
Michael Snoyman
4cde171285 BrowserID lazy load 2013-04-21 17:14:40 +03:00
Pascal Wittmann
7e00bf4443 Update Message.hs
Updated German transaltions.
2013-04-21 17:05:45 +03:00
Michael Snoyman
ba9e40c177 Merge pull request #536 from rnons/patch-1
Chinese translation of Yesod.Auth.Message
2013-04-21 06:55:58 -07:00
rns
76b6ab100e Update Message.hs
Chinese translation of Yesod.Auth.Message
2013-04-21 20:48:29 +08:00
Michael Snoyman
5a1663b6fd Allow username logins for Yesod.Auth.Email (fixes #532) 2013-04-21 12:57:32 +03:00
Michael Snoyman
d01d6fa61a Static file combining #517 2013-04-21 11:14:18 +03:00
Michael Snoyman
1da46a547e Fix priority 2013-04-19 13:00:44 +03:00
Michael Snoyman
91757320f3 Dedupe path pieces in yesod-static 2013-04-18 22:59:40 +03:00
Michael Snoyman
13715075f4 Merge pull request #527 from meteficha/improved-yesod-static-th
Improved (?) yesod-static TH
2013-04-18 12:11:55 -07:00
Michael Snoyman
a013eb2295 maximumContentLength is a Maybe 2013-04-18 10:19:50 +03:00
Michael Snoyman
64ef26104d Route attributes/appcache example #518 2013-04-11 17:07:22 +03:00
Michael Snoyman
fd15efa8dd Fix yesod-form 2013-04-11 15:22:58 +03:00
Michael Snoyman
99ba9456f7 Killed Yesod.Form.Class (fixes #470) 2013-04-11 14:18:52 +03:00
Michael Snoyman
dfd50f8649 AuthEntity 2013-04-11 09:54:46 +03:00
Michael Snoyman
f29bdbed0e YesodAuthPersist 2013-04-11 09:43:40 +03:00
Felipe Lessa
53fd20d239 Squash static strings into a single one. 2013-04-09 18:03:32 -03:00
Felipe Lessa
1a8767935e Whitespace. 2013-04-09 18:03:17 -03:00
Michael Snoyman
0d4102d20a Version bump 2013-04-09 11:26:06 +03:00
Michael Snoyman
2bbd0d16a2 Merge pull request #526 from qrilka/clear-creds
Added clearCreds symmetric to setCreds function
2013-04-09 01:24:16 -07:00
Kirilll Zaborsky
f6b12764e4 Added haddocks to setCreds/clearCreds 2013-04-09 10:53:49 +04:00
Kirilll Zaborsky
f5f84e830d Added clearCreds symmetric to setCreds function 2013-04-09 09:25:30 +04:00
Michael Snoyman
307540fc04 GHC 7.6.2 2013-04-09 06:43:30 +03:00
Michael Snoyman
e68ea6a3b9 Disable yesod devel timeout by default 2013-04-08 05:52:57 +03:00
Greg Weber
a357922d39 setHeader -> addHeader 2013-04-03 15:24:12 -07:00
Michael Snoyman
cb8aa986f0 Fix yesod-test 2013-04-03 21:40:13 +03:00
Michael Snoyman
8faaca5fa5 Merge pull request #525 from yesodweb/not-authenticated-401
not authenticated returns 401, not 403
2013-04-03 10:54:48 -07:00
Greg Weber
8429a66ad8 not authenticated returns 401, not 403 2013-04-03 07:47:32 -07:00
Michael Snoyman
e663e84caf Deprecate setHeader, provide addHeader #524 2013-04-03 17:28:44 +03:00
Michael Snoyman
97f7979956 add-handler: use Html instead of RepHtml 2013-04-03 16:15:16 +03:00
Michael Snoyman
bbe69d25a2 Fix a test 2013-04-03 12:20:40 +03:00
Michael Snoyman
7a90a794d8 Expanded yesod-test testsuite 2013-04-03 11:50:00 +03:00
Michael Snoyman
a1090d97d6 Expose YesodExample 2013-04-03 11:14:53 +03:00
Michael Snoyman
c8738103f4 Merge branch 'json-auth2' of https://github.com/yesodweb/yesod into yesod1.2 2013-04-03 09:29:13 +03:00
Michael Snoyman
09eecb8e79 Merge branch 'yesod1.2' of https://github.com/yesodweb/yesod into yesod1.2 2013-04-03 09:28:19 +03:00
Michael Snoyman
f9fd1ee0ee Ignore vendor 2013-04-03 09:25:18 +03:00
Michael Snoyman
ae9fa93417 Include persistent 1.2 in sources.txt 2013-04-03 09:24:18 +03:00
Michael Snoyman
28e7a9db23 Persistent 1.2 2013-04-03 09:06:13 +03:00
Michael Snoyman
6c55ad6f98 Merge pull request #523 from yesodweb/content-negotiation2
accept header content negotiation
2013-04-02 12:10:56 -07:00
Michael Snoyman
7a036fa707 Merge pull request #522 from yesodweb/json-auth2
fix yesod-core auth response type for json
2013-04-02 12:06:29 -07:00
Michael Snoyman
04d51bdb4c Fix bug for complete URLs 2013-04-02 19:45:23 +03:00
Michael Snoyman
51eb7d4ba2 RequestBuilder overhaul 2013-04-02 19:41:52 +03:00
Greg Weber
18be9bc206 accept header content negotiation
* look at wildcards */* and main/*
* return a 406 when nothing matches the accept header
2013-04-02 08:39:56 -07:00
Greg Weber
be04f4888b fix yesod-core auth response type for json 2013-04-02 08:27:30 -07:00
Michael Snoyman
9f97de6519 Export list cleanup 2013-04-02 17:39:32 +03:00
Michael Snoyman
db53252960 yesod-test can use type-safe URLs 2013-04-02 17:29:09 +03:00
Michael Snoyman
ad817275e8 Further yesod-test cleanup 2013-04-02 17:05:40 +03:00
Michael Snoyman
ba8706429a Make yesod-test integrate better with hspec 2013-04-02 16:32:40 +03:00
Michael Snoyman
f2072747ce Include Yesod in server name 2013-04-02 14:58:02 +03:00
Michael Snoyman
48db89cb45 Version bump 2013-04-02 10:59:46 +03:00
Michael Snoyman
5d119bcb98 Merge pull request #520 from meteficha/yesod1.2
Use clientsession 0.9.* on Yesod 1.2.
2013-04-01 12:51:22 -07:00
Michael Snoyman
30dfc26238 allow clientsession 0.9 2013-04-01 21:23:08 +03:00
Felipe Lessa
993c557c12 Use clientsession 0.9.* on Yesod 1.2. 2013-04-01 11:45:16 -03:00
Michael Snoyman
6d98103115 Generalized sendChunk* functions 2013-03-27 09:46:10 +02:00
Michael Snoyman
cb49b684bd Streaming DB demo 2013-03-27 09:45:54 +02:00
Michael Snoyman
d4422b656b LiteApp uses a Writer monad 2013-03-27 08:51:03 +02:00
Michael Snoyman
13173f65c6 Added streaming demo 2013-03-24 22:12:06 +02:00
Michael Snoyman
ae65603c4b Generalize streaming functions 2013-03-24 22:11:59 +02:00
Michael Snoyman
7748a190f9 Get rid of maybeAuthIdRaw #486 2013-03-24 14:24:41 +02:00
Michael Snoyman
b5a1d76a40 maybeAuthId checks that ID is valid #486 2013-03-24 09:30:39 +02:00
Michael Snoyman
f3b459e9ce respond 2013-03-22 10:33:33 +02:00
Michael Snoyman
8ab09931c4 Code cleanup and transformer instances 2013-03-22 09:17:14 +02:00
Michael Snoyman
f6aaca7012 sitemapList and sitemapConduit 2013-03-21 14:11:59 +02:00
Michael Snoyman
3450fb8279 Another Travis tweak 2013-03-21 13:52:30 +02:00
Michael Snoyman
b1a7c743cd No more travis script 2013-03-21 13:25:50 +02:00
Michael Snoyman
c0b0f630dd Travis tweak 2013-03-21 12:53:17 +02:00
Michael Snoyman
efda9507c8 Attempted Travis fix 2013-03-21 12:13:56 +02:00
Michael Snoyman
c16184eb40 Type-specialized versions of sendChunk 2013-03-21 11:42:20 +02:00
Michael Snoyman
968b96e0b1 sendChunk/sendFlush 2013-03-21 08:42:10 +02:00
Michael Snoyman
ff3eb746f1 Added some docs 2013-03-21 08:30:09 +02:00
Michael Snoyman
0546d566c3 Streaming sitemap 2013-03-20 15:06:15 +02:00
Michael Snoyman
f066e66053 Streaming Persistent 2013-03-20 15:06:01 +02:00
Michael Snoyman
8c45b2709f respondSource 2013-03-20 13:49:43 +02:00
Michael Snoyman
029fc7166d Fix some warnings 2013-03-20 12:45:35 +02:00
Michael Snoyman
223c957e95 forget unregistering 2013-03-20 12:03:11 +02:00
Michael Snoyman
68ca768b83 Export more aeson stuff 2013-03-20 11:57:00 +02:00
Michael Snoyman
fb4045ea45 Warning cleanup 2013-03-20 11:46:32 +02:00
Michael Snoyman
7cde3d4bdb Put binaries into yesod-bin (fixes #514) 2013-03-20 08:58:27 +02:00
Michael Snoyman
6efd35ceca Hopeful Travis fix 2013-03-20 08:35:34 +02:00
Michael Snoyman
d35b8a0dc2 Require newest bugfix warp 2013-03-20 07:39:51 +02:00
Michael Snoyman
0eda39f242 Added ParseRoute instance for Static 2013-03-19 15:53:03 +02:00
Michael Snoyman
13af2461f1 Add missing route for yesod-auth 2013-03-19 15:18:54 +02:00
Michael Snoyman
56e9432393 Add an underscore 2013-03-19 15:17:59 +02:00
Michael Snoyman
96d5f4bcf6 Remove unneeded test stuff from cabal file 2013-03-19 15:17:49 +02:00
Michael Snoyman
cf77d86a6a Use new mkParseRouteInstance in yesod-core 2013-03-19 15:17:28 +02:00
Michael Snoyman
4d8c19becd yesod-routes: parsing included 2013-03-19 15:13:56 +02:00
Michael Snoyman
2254b3403d lite demo 2013-03-18 14:16:05 +02:00
Michael Snoyman
2c8b9c32c9 Moved subsite demo into subfolder 2013-03-18 14:08:04 +02:00
Michael Snoyman
564fdab66b SimpleApp to LiteApp 2013-03-18 12:18:49 +02:00
Michael Snoyman
0fc1c6cfef SimpleApp 2013-03-18 12:13:26 +02:00
Michael Snoyman
da24596b77 Incomplete SimpleApp 2013-03-18 05:12:04 +02:00
Michael Snoyman
2a719941ca Some parsing fixes (not complete) 2013-03-17 13:35:30 +02:00
Michael Snoyman
bca0d24533 Route parsing 2013-03-17 13:28:17 +02:00
Michael Snoyman
ffcbcb449e Added pong.hs 2013-03-17 12:48:11 +02:00
Michael Snoyman
3b121ccde5 More cleanups 2013-03-17 12:46:55 +02:00
Michael Snoyman
090191bec3 Include warp etc in Yesod.Core 2013-03-17 12:39:04 +02:00
Michael Snoyman
beac5d56db Minor TH cleanup 2013-03-17 12:08:58 +02:00
Michael Snoyman
4295346171 Split files up a bit more 2013-03-17 11:38:33 +02:00
Michael Snoyman
172f706924 Re-export some classes/methods 2013-03-17 11:28:57 +02:00
Michael Snoyman
a2c4f1f3b7 MonadHandler/MonadWidget 2013-03-17 10:10:39 +02:00
Michael Snoyman
ff232bf3ab Merge pull request #512 from qrilka/hashdb-user-fields
EntityField data instances export for HashDB.User
2013-03-15 02:38:18 -07:00
Michael Snoyman
1fabee31e4 Included demo 2013-03-15 08:46:27 +02:00
Michael Snoyman
ac6ab5b4d0 Remove the long-outdated examples 2013-03-15 07:35:14 +02:00
Michael Snoyman
8b9f8ea024 Some convenience re-exports 2013-03-15 05:54:09 +02:00
Michael Snoyman
cd2f0ed610 More useful defaultClientSessionBackend 2013-03-15 05:41:50 +02:00
Michael Snoyman
2d93157e9a Fixed Yesod.Static 2013-03-14 19:02:30 +02:00
Michael Snoyman
44a01d7107 Better fileSource 2013-03-14 19:02:20 +02:00
Michael Snoyman
326c13d8b4 House cleaning 2013-03-14 18:32:35 +02:00
Kirilll Zaborsky
cd21c91485 EntityField data instances export for HashDB.User 2013-03-14 16:44:05 +04:00
Michael Snoyman
15bbd54e12 Some cleanup 2013-03-14 10:23:57 +02:00
Michael Snoyman
9c4cd573b4 Everything compiles 2013-03-14 09:28:51 +02:00
Michael Snoyman
3df45ac1c7 Another whitespace fix for tests 2013-03-14 07:38:24 +02:00
Michael Snoyman
55d13c62a6 whitespace fix for tests 2013-03-14 07:36:09 +02:00
Michael Snoyman
0f1637a1aa Implemented rawRequestBody 2013-03-14 07:35:09 +02:00
Michael Snoyman
8e793c70cc Compiles again, tests fails 2013-03-14 07:32:40 +02:00
Michael Snoyman
c466845095 More incomplete changes 2013-03-14 05:58:37 +02:00
Michael Snoyman
553dff7bd2 Incomplete change: GWidget/GHandler->WidgetT/HandlerT 2013-03-14 05:00:16 +02:00
Michael Snoyman
9503921d90 Merge branch 'master' into new-subsite 2013-03-13 13:52:59 +02:00
Michael Snoyman
099b96f178 Everything compiles 2013-03-13 13:35:11 +02:00
Michael Snoyman
f063074ac4 Fixed yesod-routes tests 2013-03-13 11:32:54 +02:00
Michael Snoyman
4bdd01ef58 Simplified GHandler/GWidget 2013-03-13 10:59:10 +02:00
Michael Snoyman
fc6551c650 defaultLayoutT 2013-03-13 10:15:47 +02:00
Michael Snoyman
5de675b45c Added missing test file 2013-03-13 09:17:40 +02:00
Michael Snoyman
0633d0b259 Beginning of subsite TH overhaul 2013-03-13 09:14:24 +02:00
Michael Snoyman
2aefef4414 YesodSubDispatch 2013-03-13 08:48:28 +02:00
Michael Snoyman
e928991410 Include a proper subsite test 2013-03-13 08:14:01 +02:00
Michael Snoyman
9a53092be7 Remove yreRoute 2013-03-13 07:20:20 +02:00
Michael Snoyman
815e185a4b Slight simplification to YesodDispatch typeclass 2013-03-13 07:12:19 +02:00
Felipe Lessa
8408145fe2 yesod-eventsource: Bump deps and version. 2013-03-12 12:19:46 -03:00
Michael Snoyman
0a54826157 Simplified SessionBackend 2013-03-12 16:29:48 +02:00
Michael Snoyman
cf3fe53cd4 Initial HandlerT 2013-03-12 16:14:29 +02:00
Michael Snoyman
a2d26e096d Move session header logic to yarToResponse 2013-03-12 10:41:17 +02:00
Michael Snoyman
77f41a18dd Removed localNoCurrent for error handling 2013-03-12 10:33:02 +02:00
Michael Snoyman
062efc9ae3 More code movement 2013-03-12 10:30:34 +02:00
Michael Snoyman
845258e544 Removed some dead code 2013-03-12 10:26:43 +02:00
Michael Snoyman
04a034770b Beginning of a dispatch overhaul 2013-03-12 10:21:26 +02:00
Michael Snoyman
9873b4d8f3 Moved code around some more 2013-03-12 05:49:24 +02:00
Michael Snoyman
4d6c114b12 yesod-default folded into yesod 2013-03-11 12:12:04 +02:00
Michael Snoyman
db57468832 Version bumps 2013-03-11 12:07:10 +02:00
Michael Snoyman
df7c897ee2 cached used in maybeAuth 2013-03-11 11:52:32 +02:00
Michael Snoyman
eecda0c80e Removed conditional compilation 2013-03-11 11:46:05 +02:00
Michael Snoyman
e2cd292877 yesod-auth doesn't use redirects for JSON requests (fixes #479) 2013-03-11 11:37:45 +02:00
Michael Snoyman
8246aa4c1e Whole repo compiles 2013-03-11 11:25:26 +02:00
Michael Snoyman
2af304bd7f Provide JSON reps for default error message handler (fixes #478) 2013-03-11 11:10:00 +02:00
Michael Snoyman
0959194fb5 Travis: do cabal update 2013-03-11 10:57:35 +02:00
Michael Snoyman
f3f55a1ecd RepHtml is a synonym for Html 2013-03-11 10:54:26 +02:00
Michael Snoyman
1d0cac6e03 TypedContent 2013-03-11 10:45:01 +02:00
Michael Snoyman
d2f5ca449d selectRep/provideRep API 2013-03-11 09:08:34 +02:00
Michael Snoyman
81ec09bf63 Some more rearranging 2013-03-11 07:29:43 +02:00
Michael Snoyman
e673c1f35e Removed some subsite stuff 2013-03-11 07:23:30 +02:00
Michael Snoyman
2c2ee10dd7 Converted Yesod.Handler to typeclasses 2013-03-11 07:08:03 +02:00
Michael Snoyman
8f8e986839 Started on the Handler typeclasses 2013-03-11 06:00:50 +02:00
Michael Snoyman
8d5f207c8d Removed Yesod.Internal.TestApi 2013-03-10 15:21:54 +02:00
Michael Snoyman
5c4ddfad6c Removed Yesod.Internal 2013-03-10 15:18:58 +02:00
Michael Snoyman
9559c2a345 Typeable-based cache implementation (#268) 2013-03-10 15:05:40 +02:00
Michael Snoyman
1a5793e2b9 Removed Yesod.Request 2013-03-10 14:38:52 +02:00
Michael Snoyman
070e0aa8b3 Make RandomGen parameter optional 2013-03-10 14:34:00 +02:00
Michael Snoyman
5b5203a275 Removed yepnope 2013-03-10 14:20:39 +02:00
Michael Snoyman
0e2fee8da3 Removed messageLogger 2013-03-10 14:17:53 +02:00
Michael Snoyman
0c4643422c safeEh logs properly 2013-03-10 14:14:44 +02:00
Michael Snoyman
1b8a1b9d42 Removed unneeded conditional 2013-03-10 14:04:45 +02:00
Michael Snoyman
ee01aaf268 Better error handling and auth checking 2013-03-10 14:03:10 +02:00
Michael Snoyman
dc79ddecd9 Auth tests 2013-03-10 13:48:26 +02:00
Michael Snoyman
7e2338aaa1 Unified some datatypes 2013-03-10 13:33:52 +02:00
Michael Snoyman
4ece5fafd9 Removed handlerToYAR 2013-03-10 13:24:23 +02:00
Michael Snoyman
e4683ed001 .Class and .Run modules 2013-03-10 12:56:32 +02:00
Michael Snoyman
1bd193f642 Initial YesodRequest/YesodRespnse change 2013-03-10 11:58:29 +02:00
Michael Snoyman
4f1a6b461e BackendSession => SessionMap 2013-03-10 11:13:19 +02:00
Michael Snoyman
98613278d4 Yesod.Core.Types created, but it's a mess 2013-03-10 11:02:53 +02:00
Michael Snoyman
20091656aa Make Felipe's session code the default (#415) 2013-03-10 10:08:20 +02:00
Michael Snoyman
2377d70ec8 Merge branch 'master' into yesod1.2
Conflicts:
	yesod-json/yesod-json.cabal
2013-03-10 09:49:28 +02:00
Michael Snoyman
90252618d6 Added missing test file 2013-03-10 09:43:21 +02:00
Michael Snoyman
b8a8000ac7 Version bump 2013-03-10 09:41:24 +02:00
Michael Snoyman
2e8078e461 Deal with JSON parse errors #511 2013-03-10 09:40:04 +02:00
Michael Snoyman
afd700753c Use RequestBodyLength 2013-03-10 05:26:34 +02:00
Michael Snoyman
eda98f96db Merge remote-tracking branch 'origin/master' into yesod1.2
Conflicts:
	yesod-core/yesod-core.cabal
	yesod-json/yesod-json.cabal
2013-03-10 05:10:13 +02:00
Michael Snoyman
d8af216730 yesod-platform update 2013-03-04 10:56:29 +02:00
Michael Snoyman
5b444c59eb Version bumps 2013-03-04 10:37:37 +02:00
Michael Snoyman
98fb0370bc Merge pull request #509 from ShaneKilkelly/test-additions
Test additions
2013-03-03 22:38:41 -08:00
Shane Kilkelly
d06e4530f9 and export the new function from the module 2013-03-03 17:25:26 +00:00
Shane Kilkelly
bbb1a66bac add a htmlAnyContain function 2013-03-03 17:16:10 +00:00
Hiromi Ishii
1009cffc67 relaxed version deps 2013-03-03 18:06:50 +09:00
Hiromi Ishii
7b96e947e5 Relaxed version dependencies (support conduit-1.0 and so on). 2013-03-03 17:24:12 +09:00
Luite Stegeman
2ffc083cc9 older cabal-install sometimes omits the .inplace database, workaround 2013-03-02 23:27:06 +01:00
Michael Snoyman
aafecf5787 Parse query string parameters from URLs 2013-02-28 07:28:34 +02:00
Michael Snoyman
dcecc1dc12 Version bump 2013-02-26 13:46:52 +02:00
Michael Snoyman
2be6a9fdca yesod devel disables library profiling 2013-02-26 13:19:12 +02:00
Michael Snoyman
078fee969b Scaffolding: allow http-conduit 1.9 2013-02-26 08:04:38 +02:00
Luite Stegeman
68163b9e16 use inplace package id for the development server, should fix #507 2013-02-26 04:10:04 +01:00
Michael Snoyman
fc7dcfc3b3 Possible typo in readme (#506) 2013-02-25 08:21:06 +02:00
Michael Snoyman
f405cf2a88 http-conduit 1.9 2013-02-21 10:54:45 +02:00
Michael Snoyman
7d1b0f5bf1 Fix some deps 2013-02-21 07:16:27 +02:00
Michael Snoyman
9de803c7b5 Fix some deps 2013-02-21 07:14:25 +02:00
Michael Snoyman
d4862233bd Scaffolding includes getLogger 2013-02-19 08:07:09 +02:00
Michael Snoyman
729221bf2f Scaffolding update 2013-02-19 08:00:25 +02:00
Michael Snoyman
a0dd09c2e1 Include Postgres + Fay scaffolding 2013-02-19 08:00:14 +02:00
Michael Snoyman
789cd18b6c Version bump 2013-02-19 07:47:56 +02:00
Luite Stegeman
4013ef6160 use the GHC API to figure out the package configuration for yesod devel 2013-02-19 04:09:05 +01:00
Michael Snoyman
c39fa8ddf8 Version bumps 2013-02-18 18:36:20 +02:00
Michael Snoyman
459e5c29bf blaze-html 0.6 2013-02-18 18:15:05 +02:00
Michael Snoyman
a73cac167e wai 1.4 2013-02-18 12:39:20 +02:00
Michael Snoyman
afa20adac9 Fix a dependency problem 2013-02-18 11:46:54 +02:00
Michael Snoyman
581248b1c8 Include Persona login icon yesodweb/authenticate#19 2013-02-18 11:30:23 +02:00
Michael Snoyman
431787f7cb Remove some upper bounds 2013-02-18 10:33:44 +02:00
Michael Snoyman
551b9d7c1e Version bumps 2013-02-18 07:02:08 +02:00
Michael Snoyman
34e7a863e5 Merge remote-tracking branch 'origin/master' 2013-02-18 06:57:45 +02:00
Michael Snoyman
827b78995b Merge pull request #503 from craccho/patch-1
h2 looks like textfield
2013-02-14 00:26:10 -08:00
Toshiaki Ishikura
aca425ea55 h2 looks like textfield 2013-02-14 17:04:53 +09:00
Michael Snoyman
7129baff18 Version bump 2013-02-13 13:35:42 +02:00
Michael Snoyman
8e5104f098 Version bump 2013-02-13 13:35:08 +02:00
Michael Snoyman
99fa35ed40 Fix browserid test 2013-02-13 13:33:46 +02:00
Michael Snoyman
d5314feed9 Merge branch 'new_urls' of https://github.com/fmarier/authenticate 2013-02-13 13:18:41 +02:00
Michael Snoyman
9923acd33d Version bump 2013-02-13 11:55:24 +02:00
Michael Snoyman
a1734e0e18 conduit 1.0 support 2013-02-13 11:45:50 +02:00
Michael Snoyman
9528a1cb12 Drop some upper bounds 2013-02-13 11:30:01 +02:00
Francois Marier
44f0951330 Update URLs of verifier and include.js 2013-02-13 18:08:40 +13:00
Michael Snoyman
8eb898931a Merge branch 'master' into yesod1.2 2013-02-12 16:59:40 +02:00
Michael Snoyman
397004767e Remove yesod-json deps 2013-02-12 16:59:37 +02:00
Michael Snoyman
23ee947ba1 IsContent instance for ResumableSource #466 2013-02-12 15:49:59 +02:00
Michael Snoyman
ed53b20308 Merge yesod-json functionality into yesod-core (closes #487) 2013-02-12 15:42:45 +02:00
Michael Snoyman
61624e1536 Merge pull request #499 from qrilka/proxy-timeout
Added proxy timeout to yesod devel flags
2013-02-06 23:29:05 -08:00
Kirilll Zaborsky
368570efc1 Added proxy timeout to yesod devel flags 2013-02-07 10:17:10 +04:00
Michael Snoyman
d483523636 Version bump 2013-02-03 15:32:54 +02:00
Michael Snoyman
c4238a4f7c Merge pull request #498 from jwiegley/master
Added explicit type signature for GHC 7.6.2
2013-02-03 05:31:15 -08:00
John Wiegley
4f22aa7aac Added explicit type signature for GHC 7.6.2 2013-02-03 07:29:01 -06:00
Michael Snoyman
c786b30afb email-validate 1.0.0 2013-02-02 19:51:15 +02:00
Michael Snoyman
38292d6357 Updated scaffolding 2013-02-01 00:19:55 +02:00
Michael Snoyman
3de491870a Merge pull request #495 from paul-rouse/master
Provide mechanism to add extra headers to a request in Yesod.Test
2013-01-29 23:22:02 -08:00
paul-rouse
c4310fb03b Provide mechanism to add extra headers to a request in Yesod.Test 2013-01-29 19:43:07 +00:00
Michael Snoyman
d167842839 Version bumps, http-types 0.8 2013-01-29 10:33:14 +02:00
Michael Snoyman
c930c103ba http-types 0.8 2013-01-29 09:57:47 +02:00
Michael Snoyman
3786362300 Add Failure instance for GHandler 2013-01-27 19:04:18 +02:00
Felipe Lessa
9829e949c2 yesod-core: Bump version to 1.1.7.2. 2013-01-25 14:05:35 -02:00
Felipe Lessa
991f937b39 Use resolveApproot on runFakeHandler. 2013-01-25 13:55:41 -02:00
Michael Snoyman
bc3a91489b yesod-platform bump 2013-01-24 15:03:07 +02:00
Michael Snoyman
a57f8566c3 Updated yesod-platform 2013-01-23 19:00:14 +02:00
Michael Snoyman
4869372c20 Merge pull request #491 from dudebout/hsenv-doc
Puts back the documentation about hsenv in place.
2013-01-23 07:15:48 -08:00
Luite Stegeman
7a4d42745a Merge pull request #489 from dudebout/hsenv-interaction
Hsenv interaction, use correct package database
2013-01-22 20:27:55 -08:00
Nicolas Dudebout
33614b8ae3 Puts back the documentation about hsenv in place. 2013-01-21 12:41:24 -05:00
Nicolas Dudebout
34474f9844 Prepends the hsenv arguments instead of appending them. 2013-01-21 10:50:07 -05:00
Nicolas Dudebout
e056d5169c Aligns the import statements to reflect new length. 2013-01-18 16:19:23 -05:00
Nicolas Dudebout
a42ddb564c Removes a trailing empty line. 2013-01-18 16:19:00 -05:00
Nicolas Dudebout
373ff896b3 Detects when hsenv is activated and read the necessary GHC flags. 2013-01-18 16:18:51 -05:00
Nicolas Dudebout
9baadd471c Removes two trailing empty lines. 2013-01-18 16:16:32 -05:00
Greg Weber
77f74c879d update hsenv documentation 2013-01-17 08:10:12 -08:00
Greg Weber
cef52c30c9 Merge pull request #485 from dudebout/patch-3
Update README.md
2013-01-17 07:48:46 -08:00
Nicolas Dudebout
767c5a40ce Update README.md
This favors the version of hsenv on hackage as opposed to the one not maintained. This new version is the only one working with ghc 7.6 or newer.
2013-01-17 10:43:10 -05:00
Michael Snoyman
e685135b11 yesod-platform 1.1.7 2013-01-16 17:23:16 +02:00
Michael Snoyman
f78559d7ed Remove deprecated Yesod.Widget functions (fixes #469) 2013-01-15 11:23:21 +02:00
Michael Snoyman
91f98c480e Removed instance Exception ErrorResponse 2013-01-15 11:12:25 +02:00
Michael Snoyman
f2ad6612a9 Scaffold update 2013-01-15 11:04:40 +02:00
Greg Weber
613adc8a3d expand 's' to 'sub' 2013-01-14 07:36:34 -08:00
Greg Weber
0cb1752067 m stands for monad, use master 2013-01-14 07:34:09 -08:00
Michael Snoyman
5582591987 Merge pull request #473 from mlinksva/master
release notes were out of date, note they are maintained on wiki
2013-01-03 21:17:16 -08:00
Mike Linksvayer
d6a59cee3b notes were out of date, seem to be maintained on wiki, noted such 2013-01-03 21:09:54 -08:00
Michael Snoyman
617c1d724e Removed some FIXMEs 2013-01-02 14:26:56 +02:00
Michael Snoyman
7c72f11b21 Addressed some yesod-auth FIXMEs 2013-01-02 14:13:56 +02:00
Michael Snoyman
3c301cdb75 Avoid hashable 1.2 series (tibbe/hashable#49) 2013-01-02 13:29:24 +02:00
Michael Snoyman
e01c2c1415 New yesod-platform 2013-01-02 10:21:14 +02:00
Michael Snoyman
cb2491de04 Version bump 2013-01-01 11:18:27 +02:00
Michael Snoyman
bd05541df4 Limit request body sizes for chunked bodies 2013-01-01 11:18:07 +02:00
Michael Snoyman
6d3b7bb2eb Version bump 2012-12-27 09:30:42 +02:00
Michael Snoyman
ee8eefdaf7 Version bumps 2012-12-27 09:30:22 +02:00
Michael Snoyman
c9b6be07ef Merge pull request #424 from wuzzeb/master
Add support for multiple cookies in yesod-test
2012-12-26 09:06:22 -08:00
Michael Snoyman
980f925317 Update scaffold to use newer date cache code 2012-12-26 19:04:45 +02:00
Michael Snoyman
bf293e6a1f Make new session code optional, keep old API 2012-12-26 19:00:45 +02:00
Michael Snoyman
f4674f9465 Merge branch 'faster-session' of https://github.com/meteficha/yesod 2012-12-26 18:19:22 +02:00
Michael Snoyman
9fea238a6d Prepend autogen for development mode (fixes #293) 2012-12-26 18:13:02 +02:00
Michael Snoyman
c9ca0b1f9d Scaffolding: add link to Overriding widgetFile (yesodweb/shakespeare#78) 2012-12-26 17:33:28 +02:00
Michael Snoyman
9624d4bf66 Add error logging for all internal server errors (#335) 2012-12-26 16:41:24 +02:00
Michael Snoyman
f240709ea1 yesod devel: cycle listening ports 2012-12-26 16:13:40 +02:00
Michael Snoyman
e709eb2192 More reasonable yesod devel timeout 2012-12-26 16:03:01 +02:00
Michael Snoyman
992f4e7893 staticFiles (in Yesod.Static) does not work without OverloadedStrings (#437) 2012-12-26 15:59:49 +02:00
Michael Snoyman
fe88be19dd Instate a timeout for proxied requests 2012-12-25 16:00:59 +02:00
Michael Snoyman
a3ca024d1e Catch more IO exceptions during file reading 2012-12-25 15:46:31 +02:00
Michael Snoyman
9886d0c5e7 optparse-applicative 0.5 (fpco/stackage#27) 2012-12-24 09:13:35 +02:00
Michael Snoyman
d9231ff5ad BrowserID: createOnClick 2012-12-16 09:24:12 +02:00
Michael Snoyman
e9d7d69b22 Version bumps 2012-12-12 09:12:45 +02:00
Michael Snoyman
d8a3548a11 yesod-default parses DISPLAY_PORT (#459) 2012-12-12 09:11:20 +02:00
Michael Snoyman
3e51af2b34 Specify devel port on command line 2012-12-11 22:29:55 +02:00
Michael Snoyman
fdeaec8dd4 Improved email labels 2012-12-11 19:20:25 +02:00
Michael Snoyman
9a8490d524 Updated scaffolding 2012-12-11 12:52:22 +02:00
Hiromi Ishii
628aaae2b9 changed cabal file and added type signatures 2012-12-03 22:31:23 +09:00
Hiromi Ishii
ab980f34bd Merge branch 'master' of github.com:yesodweb/yesod 2012-12-03 22:30:24 +09:00
Hiromi Ishii
3ed5b54d65 Stop using fromJust and change to throw exceptions instead. 2012-12-03 22:29:48 +09:00
Michael Snoyman
b7224f9654 Version bumps 2012-12-02 14:38:34 +02:00
Michael Snoyman
341ca54733 Added missing aeson dep 2012-12-02 11:38:42 +02:00
Michael Snoyman
6b23d80326 Scaffold update for persistent 1.1 2012-12-02 11:19:02 +02:00
Michael Snoyman
31619113a0 Export toJSON from Yesod module 2012-12-02 11:03:30 +02:00
Michael Snoyman
4d6aab02d4 Merge remote-tracking branch 'origin/master' into persistent11 2012-12-02 10:50:48 +02:00
Hiromi Ishii
673e852234 added deriving clause 2012-12-02 14:28:17 +09:00
Luite Stegeman
a4ae1803f7 fix for Cabal library older than 1.16 2012-12-01 20:36:40 +01:00
Luite Stegeman
2c8be21b05 use the Cabal library to rebuild, even with --dev 2012-12-01 19:18:00 +01:00
Michael Snoyman
d40da187af Merge pull request #457 from sol/master
yesod-test: Remove redundant import
2012-11-29 02:19:19 -08:00
Simon Hengel
ba27046aff yesod-test: Remove redundant import 2012-11-29 11:00:19 +01:00
Michael Snoyman
6d63c680aa Merge pull request #456 from sol/master
Fix deprecation warnings
2012-11-28 11:56:22 -08:00
Michael Snoyman
77e87fe524 yesod-platform 1.1.5 2012-11-28 10:56:59 +02:00
Michael Snoyman
054340ec10 Version bumps 2012-11-28 09:47:01 +02:00
Simon Hengel
252871fea9 Fix deprecation warnings 2012-11-27 21:25:39 +01:00
Michael Snoyman
fb02d71d73 Persistent 1.1 2012-11-27 16:57:46 +02:00
Michael Snoyman
da5f34340e Added missing import 2012-11-26 15:46:19 +02:00
Michael Snoyman
5a29eec9c7 Debug output for Devel.hs 2012-11-26 15:33:39 +02:00
Michael Snoyman
f6dd0b56b9 maybeAuthId is now part of YesodAuth typeclass 2012-11-26 15:33:39 +02:00
Luite Stegeman
7f4ae2bd56 default to polling every second 2012-11-26 10:40:22 +01:00
Michael Snoyman
0c4ded0fd1 Slightly more efficient header construction 2012-11-25 21:45:08 +02:00
Michael Snoyman
918e3c9d2e Merge pull request #454 from dlthomas/master
Prevent caching of redirects
2012-11-25 11:34:25 -08:00
David L. L. Thomas
513d6ed4f9 Bugfix - Caching redirect *only* for 301 redirects
Previous commit got it backwards.
2012-11-25 11:12:39 -08:00
David L. L. Thomas
246a024dce Allowing cache on 301 redirects 2012-11-23 13:44:31 -08:00
Michael Snoyman
4a53fdf44e yesod-auth bump 2012-11-22 14:43:49 +02:00
Hiromi Ishii
bbec5d4b15 Merge branch 'master' of github.com:yesodweb/authenticate 2012-11-22 21:26:10 +09:00
Hiromi Ishii
2417461aef fixed dependencies 2012-11-22 21:25:35 +09:00
Michael Snoyman
50df681969 Removed some debug output 2012-11-22 12:57:47 +02:00
David L. L. Thomas
a2ad8fe704 Prevent caching of redirect
Dynamic redirects shouldn't be cached.  This especially causes a problem
with redirection to the login page, since trying to actually access the
page the user logged in to see can get them redirected back to the login
page on some browsers.

This patch adds headers to prevent caching of all redirects, which isn't
ideal, but better than allowing caching of all of them.
2012-11-21 22:39:53 -08:00
Michael Snoyman
69791585aa email-validate 0.3 2012-11-22 07:09:41 +02:00
Michael Snoyman
d37b0634a5 Added yesodMiddleware method 2012-11-21 10:58:45 +02:00
Michael Snoyman
6a7102f44e Use newer Mozilla Persona API (#453) 2012-11-18 19:03:26 +02:00
Michael Snoyman
b7aa72e104 Scaffold update 2012-11-16 09:50:03 +02:00
Michael Snoyman
7cc69c10d1 yesod-default for shakespeare-js 1.1 2012-11-16 09:43:32 +02:00
Michael Snoyman
053210da6f shakespeare-js 1.0.2 and 1.1 2012-11-16 09:27:31 +02:00
Michael Snoyman
e483547080 Scaffolding update 2012-11-15 09:42:31 +02:00
Michael Snoyman
e40c846d47 yesod-form version bump 2012-11-15 09:18:37 +02:00
Michael Snoyman
7e17a8df50 Merge branch 'fileField'
Conflicts:
	yesod-form/Yesod/Form/Types.hs
2012-11-15 09:14:07 +02:00
Michael Snoyman
e43bc22c39 Version bumps 2012-11-13 09:52:21 +02:00
Michael Snoyman
fac91c568e yesod devel proxies to 127.0.0.1 2012-11-12 22:02:06 +02:00
Michael Snoyman
a35161cf6e Haddock fixes 2012-11-12 17:51:41 +02:00
Michael Snoyman
a598846bd3 Better formatting of error messages 2012-11-12 11:24:32 +02:00
Michael Snoyman
21090b9314 Version bumps 2012-11-11 10:08:37 +02:00
Michael Snoyman
dafbda11b5 Merge branch 'patch-1' of https://github.com/RaphaelJ/yesod 2012-11-11 10:06:33 +02:00
Raphael Javaux
34d83ef812 Update yesod-auth/yesod-auth.cabal 2012-11-10 22:30:47 +01:00
Michael Snoyman
5ff3e1d1b0 Merge pull request #450 from RaphaelJ/patch-1
Change version requirement for SHA to the last version.
2012-11-10 08:18:53 -08:00
Raphael Javaux
1661727597 Change version requirement for SHA to the last version. 2012-11-10 15:13:36 +01:00
Michael Snoyman
d5b7a1f8bf Merge branch 'master' into fileField 2012-11-09 12:24:51 +02:00
Michael Snoyman
a1aadc49ad Removed another upper bound 2012-11-09 09:34:35 +02:00
Michael Snoyman
ff84077a73 Merge branch 'master' into fileField 2012-11-09 09:12:45 +02:00
Michael Snoyman
d40da67656 Remove hspec upper bound 2012-11-09 09:12:32 +02:00
Michael Snoyman
2ea1bcb5c8 fileField unabled
Boils down to two changes:

* fieldParse takes a list of FileInfos
* fieldEnctype added
2012-11-09 08:58:03 +02:00
Michael Snoyman
b15faa3cf8 hspec 1.4 2012-11-08 21:00:34 +02:00
Michael Snoyman
827a2f5485 Scaffolding http-conduit update 2012-11-07 17:57:53 +02:00
Michael Snoyman
f35cab9d44 Updated scaffold 2012-11-07 15:18:48 +02:00
Michael Snoyman
ae8168ede5 Added extra explanation from Felipe 2012-11-07 14:49:11 +02:00
Michael Snoyman
a144b56928 Warning about fork vs resourceForkIO 2012-11-07 14:35:31 +02:00
Michael Snoyman
ed5e65ae95 Merge branch 'master' of https://github.com/piyush-kurur/yesod 2012-11-07 14:05:18 +02:00
Piyush P Kurur
e32f37eadd refactored mkYesodGeneral to use mkDispatchInstance 2012-11-07 16:51:25 +05:30
Michael Snoyman
1c7e4c6f1a Version bumps 2012-11-07 12:07:32 +02:00
Michael Snoyman
a12b1791fe Specify scaffolding via url 2012-11-07 11:40:39 +02:00
Michael Snoyman
c3c0d0eaed Switch to project-template 2012-11-07 10:59:18 +02:00
Michael Snoyman
a486a2f71d Merge branch 'rebuild-for-shakespeare'
Conflicts:
	yesod/scaffold/project.cabal.cg
	yesod/yesod.cabal
2012-11-07 09:59:37 +02:00
Michael Snoyman
363e4afeee Allow multiple files (#448) 2012-11-07 09:08:29 +02:00
Michael Snoyman
5b02ec8079 Merge pull request #440 from piyush-kurur/master
Towards fixing #427 (see also a previous attempt #429)
2012-11-06 22:57:59 -08:00
Blake Rain
df8d61505b Merge pull request #447 from dudebout/patch-1
Fixes a spelling mistake.
2012-11-06 11:50:13 -08:00
Nicolas Dudebout
d2fcdf9307 Fixes a spelling mistake. 2012-11-06 14:42:00 -05:00
Michael Snoyman
2af6882ba1 update-hsfiles.sh 2012-11-05 16:30:26 +02:00
Michael Snoyman
b530bb9aaa More stylish 2012-11-05 16:29:54 +02:00
Michael Snoyman
78cc08e39f Scaffolding moved to separate repo 2012-11-05 16:08:49 +02:00
Michael Snoyman
309d3c0f26 yesod devel displays "app not loaded" message
In order to achieve this, yesod devel listens on port 3000 and reverse
proxies to port 3001. An environment variable is set to tell the app to
listen on port 3001.
2012-11-05 12:14:45 +02:00
Michael Snoyman
b961fb8d5f Ignore the fay folder (#445) 2012-11-05 12:14:45 +02:00
Michael Snoyman
bdbb73f94d Check for import changes in Shakespeare files (#413) 2012-11-05 12:14:45 +02:00
Michael Snoyman
83264153fc Remove lens (I'm afraid of hitting Cabal hell) 2012-11-05 11:41:53 +02:00
Luite Stegeman
b9eb79068c force reconfigure when cabal file changes 2012-11-04 00:48:43 +01:00
Michael Snoyman
169340c126 Accept scalar JSON bodies 2012-11-03 19:34:15 +02:00
Luite Stegeman
df9d4aef4a handle default extra arguments for build command 2012-11-02 14:06:43 +01:00
Luite Stegeman
00f8764799 Merge branch 'origin-develbuildghcapi' 2012-11-02 12:27:31 +01:00
Michael Snoyman
4b081ba0cb Travis tweak 2012-11-02 08:31:06 +02:00
Michael Snoyman
c26e5cd4eb Cleaned up some warnings 2012-11-02 08:27:30 +02:00
Michael Snoyman
befdd91d58 Merge remote-tracking branch 'origin/master' into HEAD 2012-11-02 08:06:49 +02:00
Luite Stegeman
54abbc8618 fix handling of parameters that may occur multiple times 2012-11-02 01:07:08 +01:00
Luite Stegeman
976abcbb91 allow user to set default value for command line options with env vars or config file 2012-10-30 19:14:09 +01:00
Michael Snoyman
8bf2045f92 Updated scripts 2012-10-29 18:39:04 +02:00
Michael Snoyman
0fc62c4dd8 .gitignore in scaffolding #441 2012-10-28 09:44:58 +02:00
Michael Snoyman
cd8a898115 No infinite redirects in yesod-static (#442) 2012-10-28 09:09:44 +02:00
Piyush P Kurur
30ddc17384 yesod-core: generic dispatch instance generation fixes #427 partially. 2012-10-26 15:23:54 +05:30
Michael Snoyman
49baf17b78 Do that attr thing properly 2012-10-24 17:38:15 +02:00
Michael Snoyman
f8497c3a22 Put attributes on <select>, not <option> 2012-10-24 17:33:57 +02:00
Michael Snoyman
78ef9ae7d0 http-conduit 1.8 2012-10-24 15:18:59 +02:00
Michael Snoyman
1ebe3c198d http-conduit 1.8 2012-10-24 15:16:54 +02:00
Michael Snoyman
393133d1b6 Add missing test files for yesod-static (#438) 2012-10-22 07:27:55 +02:00
Greg Weber
641152d0d6 Merge pull request #434 from sol/master
Update tests
2012-10-21 17:27:49 -07:00
Michael Snoyman
6ff229664f http-conduit 1.7 2012-10-21 14:12:27 +02:00
Michael Snoyman
8de4e332ec Initial travis 2012-10-21 14:07:04 +02:00
Michael Snoyman
a6ea443515 http-conduit 1.7 2012-10-21 14:03:25 +02:00
Michael Snoyman
a337a8afd8 language-javascript update for yesod-platform 2012-10-18 16:14:02 +02:00
Luite Stegeman
80a8c51434 allow custom build directory with command line flag or env var 2012-10-17 14:31:45 +02:00
Simon Hengel
ffcf7fbc5d yesod-test: Do not use Test.Hspec.Runner
Test.Hspec.Runner will export functions for monadic specs in the future
(Hspec >= 1.4).
2012-10-16 14:45:02 +02:00
Simon Hengel
dfae661878 Adept Hspec tests for forward compatibility
* Don't use hspecX, it's deprecated.

 * Do not import Test.Hspec.HUnit.  It's no longer necessary and may be
   removed in the future.
2012-10-16 14:44:58 +02:00
Luite Stegeman
174ac36719 try to load persistbuildconfig, even if cabal library version is not the same 2012-10-16 02:25:11 +02:00
Luite Stegeman
6bec7d342a fix infinite loop in cabal-dev args 2012-10-16 01:40:22 +02:00
Luite Stegeman
639204b6f0 pass extra arguments to cabal, for devel and builc 2012-10-15 20:42:55 +02:00
Luite Stegeman
19d4834378 use fsnotify to watch folder 2012-10-15 19:17:08 +02:00
Luite Stegeman
77383f8002 small fixes and cleanups 2012-10-15 17:10:58 +02:00
Luite Stegeman
75b8dc4457 merge master, switch to optparse-applicative 2012-10-15 16:30:35 +02:00
Luite Stegeman
9577083abd update bounds so scaffold builds with GHC 7.6 2012-10-15 14:53:33 +03:00
Michael Snoyman
23da1c9cb2 New yesod-platform 2012-10-15 09:54:42 +02:00
Michael Snoyman
4a6bdc0db7 Version bumps 2012-10-15 08:58:01 +02:00
Michael Snoyman
ae23dee4ab Include level in source 2012-10-13 22:40:03 +02:00
Michael Snoyman
74cf1f77be Get rid of export lists 2012-10-12 11:19:45 +02:00
Michael Snoyman
47365910da Put main.hs in app, no dist hardcoding 2012-10-12 11:04:58 +02:00
Michael Snoyman
97d652a528 YesodSite -> YesodDispatch 2012-10-12 10:59:44 +02:00
Michael Snoyman
b36f6225c0 Initial travis config 2012-10-12 10:58:01 +02:00
Michael Snoyman
01eae3351a Avoid the annoying "y shadowed" GHC warnings 2012-10-12 10:22:18 +02:00
Michael Snoyman
01b855969b CssBuilder 2012-10-11 07:35:25 +02:00
Michael Snoyman
57b8748a3d lifted-base 0.2 2012-10-11 06:41:14 +02:00
Michael Snoyman
ff46de28b5 network-conduit 0.6 2012-10-04 18:14:30 +02:00
Michael Snoyman
dc0c89574a version bump 2012-10-04 16:44:36 +02:00
Michael Snoyman
45e54ff2bb vector 0.10 2012-10-04 16:44:13 +02:00
Michael Snoyman
34f2f8cb13 unix-compat bump 2012-10-04 15:44:42 +02:00
Michael Snoyman
4ea4cefaf2 Remove unnecessary debug output 2012-10-03 22:45:08 +02:00
Michael Snoyman
e28f330711 path-pieces dependency bump 2012-09-29 22:29:17 +02:00
Michael Snoyman
08e123c0e6 yesod version prints yesod-core and yesod version numbers 2012-09-29 20:29:01 +02:00
Michael Snoyman
bedabb4038 New yesod-platform 2012-09-27 01:06:32 +02:00
Michael Snoyman
fd0cdcfc21 Removed unnecessary conditionals 2012-09-24 15:58:45 +02:00
Michael Snoyman
8793cffe47 warpEnv 2012-09-24 15:57:01 +02:00
Michael Snoyman
48357a6fd3 Use shouldLog in scaffold 2012-09-24 15:52:17 +02:00
Michael Snoyman
a30cc74087 Export log*S (#405) 2012-09-23 13:44:04 +02:00
Greg Weber
dcc2d138f4 Merge pull request #425 from Tarrasch/master
Improve documentation
2012-09-22 20:57:23 -07:00
Arash Rouhani
e35124f96f Use haddock for Yesod.Form.Types.Field 2012-09-22 18:58:34 -04:00
Michael Snoyman
34f2942c54 Add deprecation for messageLogger (#405) 2012-09-21 17:15:21 +03:00
Michael Snoyman
7bd06e9b7b LogSource (#405) 2012-09-21 15:01:07 +03:00
Michael Snoyman
cf4fed8cb9 Precede null path segments with dashes (#421) 2012-09-21 14:23:38 +03:00
Hiromi Ishii
5f93e24276 resolved deps hell 2012-09-20 15:41:04 +09:00
Michael Snoyman
c6aa648884 Merge branch 'master' of github.com:yesodweb/yesod 2012-09-19 09:06:03 +03:00
Michael Snoyman
0c68f46762 MonadLift instance for AForm 2012-09-19 09:03:53 +03:00
Michael Snoyman
fef3024d30 network 2.4 2012-09-19 09:02:58 +03:00
Michael Snoyman
4513c0029b Merge pull request #423 from lbolla/doc-change
Fix documentation.
2012-09-18 10:53:47 -07:00
John Lenz
f8f1377d53 yesod-test: add support for multiple cookies 2012-09-17 00:52:45 -05:00
Lorenzo Bolla
0a1f035ff8 Fix documentation.
Fix installation instructions in README.md when installing from cloned repo.
2012-09-16 16:06:55 +01:00
Michael Snoyman
3b8b77841c Updated yesod-platform 2012-09-11 09:37:37 +03:00
Michael Snoyman
a6ce05609d Version bumps 2012-09-11 07:17:23 +03:00
Michael Snoyman
818f2ecdf5 resourcet 0.4 2012-09-10 17:06:32 +03:00
Felipe Lessa
b2a9beba3c Use a cache for session cookie's expiration time.
The following HelloWorld app was used as benchmark:

  data HelloWorld = HelloWorld
  mkYesod "HelloWorld" [parseRoutes|
    / HomeR GET
  |]

  instance Yesod HelloWorld where
    -- makeSessionBackend = const $ return Nothing

  getHomeR = return . RepPlain . toContent $ "Hello World!"

  main :: IO ()
  main = warp 8080 HelloWorld

The benchmark was tested with httperf under the following
environments:

  [vanilla-nosession] Released yesod-core 1.1.1.1, but without sessions.

  [vanilla-session] Released yesod-core 1.1.1.1 (with sessions).

  [faster-session-1] With patch 065e33a, "Faster, leaner
  implementation of putTime/getTime".

  [faster-session-2] With this commit.

Performance results:

  A) Testing with:
       httperf --hog --client=0/1 --server=localhost \
               --port=8080 --uri=/ --rate=1000 \
               --send-buffer=4096 --recv-buffer=16384 \
               --num-conns=100 --wsess=1000,60,1 \
               --burst-length=20 --session-cookie

     Results:
       vanilla-nosession: 19187.7 req/s (0.1 ms/req)
       vanilla-session:    2523.3 req/s (0.4 ms/req)
       faster-session-1:   2933.5 req/s (0.3 ms/req)
       faster-session-2:   2957.5 req/s (0.3 ms/req)

     This test benchmarks both saving and loading the session.
     Interestingly, this commit provides only a small performance
     increase.

  B) Testing with:
       httperf --hog --client=0/1 --server=localhost \
               --port=8080 --uri=/ --rate=1000 \
               --send-buffer=4096 --recv-buffer=16384 \
               --num-conns=100 --num-calls=1000 \
               --burst-length=20

     Results:
       vanilla-nosession: 43548.7 req/s (0.0 ms/req)
       vanilla-session:    3609.4 req/s (0.3 ms/req)
       faster-session-1:   3454.9 req/s (0.3 ms/req)
       faster-session-2:   3786.9 req/s (0.3 ms/req)

     This test benchmarks only saving the session.  Strangely,
     faster-session-1 was worse than vanilla-session (while
     isolated tests show that the new putTime should be +70x
     faster).  However, there is a non-negligible performance
     increase on faster-session-2.
2012-09-05 01:35:10 -03:00
Felipe Lessa
065e33a3d1 Faster, leaner implementation of putTime/getTime.
Benchmark on my computer (per call, includes runPut/runGet):

    old putTime: 5658 ns +/- 224ns
    new putTime:  821 ns +/-  24ns (7x faster)

    old getTime: 7228 ns +/- 126ns
    new getTime:   99 ns +/-   4ns (73x faster!!)

Besides, the old format used 25 raw bytes (33.3 bytes on the
base64 output), while the new one uses 8 bytes (10.6 bytes on the
base64 output).
2012-09-05 00:41:54 -03:00
Michael
498d22714b checkMMod to checkMMap (#416) 2012-09-04 17:57:05 +03:00
Michael Snoyman
4cce1d5a8f Merge remote-tracking branch 'origin/master'
Conflicts:
	yesod-core/yesod-core.cabal
2012-09-03 20:49:50 +03:00
Felipe Lessa
865281d241 yesod-core: Bump version to 1.1.1.1.
Where do I redeem my prize?
2012-08-27 14:50:11 -03:00
Felipe Lessa
0d95e6917d yesod-core: Whitespace. 2012-08-27 14:50:04 -03:00
Felipe Lessa
5b19865c7a yesod-core: In handlerToIO, really avoid keeping old handler data in memory. 2012-08-27 10:20:17 -03:00
Hiromi Ishii
933ad50ac3 caught up with yesod 1.1 2012-08-25 14:54:59 +09:00
Michael Snoyman
dea07e8d4d Merge pull request #412 from yogsototh/patch-1
Added example on AddHandler to avoid confusion
2012-08-23 08:17:34 -07:00
Yann Esposito
667d8405a8 Added example on AddHandler to avoid confusion
I used the add-handler command of Yesod, and I found the sentences were too ambiguous. In order to avoid confusion, I just added some examples.

ps: I tried to write "getCommentR" instead of just "GET" and it was transformed in getcommentrCommentR :(.
2012-08-23 14:22:56 +03:00
Michael Snoyman
09016e9b7c Version bumps 2012-08-22 20:06:13 +03:00
Michael Snoyman
6b31b583f2 checkMMod 2012-08-22 20:05:34 +03:00
Michael Snoyman
34db07760a Merge branch 'master' of github.com:yesodweb/yesod 2012-08-22 20:04:11 +03:00
Michael Snoyman
a9b10ce0bc Merge pull request #410 from meteficha/runFakeHandler
New function runFakeHandler.
2012-08-21 21:06:55 -07:00
Felipe Lessa
20f51e38e2 yesod-core: Doc improvements for runFakeHandler. 2012-08-21 13:38:49 -03:00
Felipe Lessa
0346dab14c yesod-core: New function runFakeHandler. 2012-08-21 13:38:42 -03:00
Michael Snoyman
244eb88f36 Merge pull request #409 from meteficha/handlerToIO
yesod-core: New handlerToIO function.
2012-08-21 04:41:28 -07:00
Felipe Lessa
dc14783c81 yesod-core: On handlerToIO, avoid 'sourceList []'. 2012-08-20 13:13:46 -03:00
Felipe Lessa
786b5bc6e2 yesod-core: On handlerToIO's docs, avoid shadowing a name. 2012-08-20 13:09:43 -03:00
Felipe Lessa
60046bad96 yesod-core: New handlerToIO function. 2012-08-20 13:07:58 -03:00
Felipe Lessa
d94a95da3e Merge pull request #408 from meteficha/yesod-eventsource
New yesod-eventsource package.
2012-08-20 07:44:46 -07:00
Felipe Lessa
927ae17b19 yesod-eventsource: Bump version to 1.0.0.1. 2012-08-20 11:39:53 -03:00
Felipe Lessa
828c99fb7b wai-eventsource: Fix misleading doc on RepEventSource. 2012-08-20 11:39:11 -03:00
Felipe Lessa
93b2c3acf1 wai-eventsource: Avoid mconcat and reverse on ioToRepEventSource. 2012-08-20 11:37:46 -03:00
Felipe Lessa
600fec4852 wai-eventsource: Do not Flush needlessly on ioToRepEventSource. 2012-08-20 11:34:50 -03:00
Felipe Lessa
e0462b294c wai-eventsource: Minor typo. 2012-08-20 11:32:13 -03:00
Michael Snoyman
8b320629b2 yesod-platform 1.1.1 2012-08-20 17:29:25 +03:00
Felipe Lessa
c8abfa15e3 wai-eventsource: Small doc fix. 2012-08-19 15:04:58 -03:00
Felipe Lessa
765fa90eae wai-eventsource: Fix incorrect naming of the Cabal file. 2012-08-19 15:00:35 -03:00
Felipe Lessa
b8b5ec49fb wai-eventsource: Add a Setup.lhs file. 2012-08-19 14:59:16 -03:00
Felipe Lessa
183b640a55 New yesod-eventsource package. 2012-08-19 14:53:15 -03:00
Michael Snoyman
79fcfe0707 Fix stupid bugs... 2012-08-17 07:35:01 +03:00
Michael Snoyman
83b10c4959 yesod devel catches all message file changes (#404) 2012-08-17 07:15:04 +03:00
Michael Snoyman
5da6d0d9ea Scaffolding: allow http-conduit 1.6 (snoyberg/http-conduit#44) 2012-08-15 17:52:46 +03:00
Michael Snoyman
ee4f89f053 http-conduit 1.6 (snoyberg/http-conduit#44) 2012-08-15 17:50:06 +03:00
Michael Snoyman
94ca240e5e http-conduit 1.6 (snoyberg/http-conduit#44) 2012-08-15 17:49:39 +03:00
Michael Snoyman
55264b1c6b Version bumps 2012-08-13 20:42:57 +03:00
Michael Snoyman
2e87e13347 Filter missing files (#403) 2012-08-12 17:36:26 +03:00
Felipe Lessa
47917ddd98 Merge pull request #402 from tlaitinen/master
Finnish translation for Yesod.Auth.Message
2012-08-10 04:17:28 -07:00
Tero Laitinen
0d417e5f69 Finnish translation for Yesod.Auth.Message 2012-08-10 12:33:11 +03:00
Michael Snoyman
0e17fcd0b4 Merge remote-tracking branch 'origin/master' 2012-08-08 17:04:59 +03:00
Michael Snoyman
28e0bf88aa Bootstrap friendly radio markup (#394) 2012-08-08 17:04:18 +03:00
Michael Snoyman
5bc6b501b2 Removed blaze-html 0.5 conditionals 2012-08-08 17:03:59 +03:00
Felipe Lessa
8d5cf836a7 Merge pull request #398 from ehamberg/patch-2
Some fixes for Norwegian translation
2012-08-07 14:16:28 -07:00
Erlend Hamberg
7451164451 Some fixes for Norwegian translation
“obligatoriskt” was probably left over from the Swedish translation and should   be “obligatorisk”
“sannhetsverdi” is the established term for a boolean
“Slett?” should be “Slette?” if the orignal string means “[Do you want to ]delete?”
2012-08-08 00:15:17 +03:00
Michael Snoyman
6e0daccfd9 A few yesod-platform changes 2012-08-07 08:21:43 +03:00
Greg Weber
4a1d480998 fix yesod-test scaffold for SQL 2012-08-06 11:21:46 -07:00
Greg Weber
840fa09e5b complete backend independent yesod-test 2012-08-06 11:01:38 -07:00
Greg Weber
25d7c2287d update scripts 2012-08-05 16:03:14 -07:00
Greg Weber
cbfaffe5a1 update yesod-test README 2012-08-05 13:48:50 -07:00
Greg Weber
68779e038d update scripts 2012-08-05 13:35:31 -07:00
Greg Weber
fa291bf9fe make yesod-test work with mongo
depends on resource-pool branch of persistent
2012-08-05 13:35:27 -07:00
Michael
d739955944 Expand yesod-platform package blacklist (#392) 2012-08-05 09:41:26 +03:00
Greg Weber
ac0cc6a143 update scripts 2012-08-03 09:07:26 -07:00
Greg Weber
65e6d3bf20 update Yesod README 2012-08-03 07:44:23 -07:00
Greg Weber
e2b704cf0a update scripts 2012-08-03 07:02:01 -07:00
Greg Weber
ad057abb1b avoid MongoDB warning 2012-08-03 07:01:47 -07:00
Greg Weber
25ce3cd5c0 update scripts 2012-08-03 06:46:50 -07:00
Greg Weber
82b3af5aec update scripts 2012-08-03 06:36:24 -07:00
Greg Weber
7fc7a97ffb update scripts submodule 2012-08-03 06:11:13 -07:00
Michael Snoyman
df5018a94c hspec 1.3 2012-08-03 15:40:36 +03:00
Michael Snoyman
60b7111529 Fix scaffolding tests 2012-08-03 11:32:13 +03:00
Michael Snoyman
dfcbd224e8 yesod-platform 1.1 2012-08-03 11:32:01 +03:00
Michael Snoyman
bc8e4b0588 Minor yesod-test fixes 2012-08-03 11:31:35 +03:00
Michael Snoyman
f80a810df9 yesod-test uses hspec 1.3 2012-08-03 08:41:45 +03:00
Michael Snoyman
da33be529d Deprecated addWidget 2012-08-03 07:38:21 +03:00
Michael Snoyman
5ece1e96e4 Rename blank to parseHelper (#354) 2012-08-01 15:57:06 +03:00
Michael Snoyman
aa93e562bb Merge pull request #381 from adamtulinius/master
export blank
2012-08-01 05:49:26 -07:00
Michael Snoyman
bce67135f0 Merge pull request #393 from ehamberg/patch-1
Correct filename for getHomeR handler in template
2012-07-31 23:32:30 -07:00
Greg Weber
ec78ad0e5e add note about using a VM 2012-07-31 17:35:31 -07:00
Greg Weber
8b9f86afad more build cleanup instructions 2012-07-31 16:52:40 -07:00
Greg Weber
ad13b5969b link to cabal-meta 2012-07-31 16:08:12 -07:00
Erlend Hamberg
f9e858446b Correct filename for getHomeR handler in template
When generating a project with `yesod init` and then issuing `yesod devel` to
run it, the “Welcome to Yesod!” page says the getHomeR handler is in
`Handler/Root.hs`, but this should have been `Handler/Home.hs`.
2012-07-31 23:25:17 +03:00
Michael Snoyman
3678b59d02 Merge branch 'maintain/1.0' 2012-07-29 14:24:27 +03:00
Michael Snoyman
00e12930c9 yesod-platform 1.0.6 2012-07-29 14:23:35 +03:00
Michael Snoyman
d6c1490b28 Merge pull request #390 from meteficha/yesod-form-constTimeEq
yesod-form: Use constTimeEq when checking XSRF token (fixes #388)
2012-07-27 07:56:48 -07:00
Felipe Lessa
d1f9a30efa yesod-form: Use constTimeEq when checking XSRF token (fixes #388). 2012-07-25 16:19:07 -03:00
Michael Snoyman
3e158ac4a5 Merge pull request #389 from mlinksva/master
hamlet->shakespeare in README.md
2012-07-25 06:48:44 -07:00
Michael Snoyman
b0c6651ac6 Strictness annotations on Content 2012-07-25 08:56:46 +03:00
Michael Snoyman
c009067b11 DontFullyEvaluate (Felipe's code) 2012-07-25 08:54:43 +03:00
Mike Linksvayer
7c09b105b0 hamlet->shakespeare 2012-07-24 19:35:04 -07:00
Michael Snoyman
f91ff4fde2 fullyEvaluateBody 2012-07-24 17:49:17 +03:00
Michael Snoyman
6c834ec0cc Put getExtra in scaffolded Foundation.hs 2012-07-24 10:38:05 +03:00
Hiromi Ishii
be48b67fbc resolved deps hell 2012-07-17 01:01:15 +09:00
Michael Snoyman
b4d1b2087c Fix for missing Read instance on Fixed 2012-07-14 21:54:52 +03:00
Michael Snoyman
d6f8ec8883 Merge pull request #387 from robertLeeGDM/patch-1
Additional tests on 12 am/pm variants.
2012-07-14 11:33:14 -07:00
Hiromi Ishii
1b38fc3199 Merge branch 'master' of github.com:yesodweb/authenticate 2012-07-14 02:40:10 +09:00
Hiromi Ishii
be9d2dad8f caught up with conduit-0.5 2012-07-14 02:38:45 +09:00
Michael Snoyman
b9d5890567 Add a type signature 2012-07-13 18:37:42 +03:00
Robert
128a9bd1d4 Additional tests on 12 am/pm variants. 2012-07-13 10:08:59 -05:00
Michael Snoyman
c005bc0aec Fix a warning 2012-07-13 16:26:32 +03:00
Michael Snoyman
14f1fd1e27 Better parseTime 2012-07-13 16:20:10 +03:00
Michael Snoyman
33c39662b9 Reflect wai changes for #262 2012-07-11 15:58:36 +03:00
Michael Snoyman
58647e4826 yesod keter (#359) 2012-07-11 15:10:38 +03:00
Michael Snoyman
699d76d13a Merge branch 'beta'
Conflicts:
	yesod-core/yesod-core.cabal
	yesod-json/yesod-json.cabal
	yesod-test/Yesod/Test.hs
	yesod-test/test/main.hs
	yesod-test/yesod-test.cabal
2012-07-11 08:48:09 +03:00
Michael Snoyman
fffb3028c9 Export FileUpload (#262) 2012-07-09 15:11:24 +03:00
Michael Snoyman
0dbd724155 Remove hxt dep from yesod-test (#382) 2012-07-09 14:15:10 +03:00
Michael Snoyman
288f3b36eb fast-logger/monad-logger 0.2 2012-07-09 14:14:45 +03:00
Michael Snoyman
debbdc4aed Removed HtmlParse 2012-07-09 13:40:24 +03:00
Michael Snoyman
d5c0418559 keter.conf -> keter.yaml 2012-07-09 09:45:23 +03:00
Michael Snoyman
f3a3408260 http-types 0.7 2012-07-06 16:24:24 +03:00
Michael Snoyman
7ec9af871e http-types 0.7 2012-07-06 16:01:05 +03:00
Michael Snoyman
ce6aabf82f hspec 1.2 (fixes warnings) 2012-07-06 15:03:25 +03:00
Michael Snoyman
e45933ec24 Merge pull request #384 from maxcan/patch-2
Added warning about Static embed.
2012-07-06 03:55:51 -07:00
Felipe Lessa
2f07a6a19f Bump yesod-json to 1.0.1.0. 2012-07-05 23:18:45 -03:00
Felipe Lessa
9f61b1da66 Export yesod-json's acceptsJson. 2012-07-05 23:18:45 -03:00
Max Cantor
5c4e5d989f Added warning about Static embed. Updated to address Felipe's very valid criticisms. 2012-07-05 09:45:47 -07:00
Michael Snoyman
29c242d03b monad-logger 2012-07-05 16:14:23 +03:00
Michael Snoyman
985dd6c924 Remainder of Logger changes, scaffolded site works (#360) 2012-07-05 13:37:54 +03:00
Michael Snoyman
9af79e4d13 Recognize 'on' for booleans 2012-07-05 11:58:53 +03:00
Michael Snoyman
ddd1059983 Updated fast-logger/wai-logger 2012-07-05 11:04:04 +03:00
Michael Snoyman
ed2c67ad79 yesod-core version bump 2012-07-04 20:45:38 +03:00
Adam Tulinius
2f6cdb1ced Export blank 2012-07-04 17:46:41 +02:00
Michael Snoyman
17ecff146d xml-conduit 1.0 2012-07-04 18:23:32 +03:00
Michael Snoyman
c611543a6f Javascript in Head (#380) 2012-07-04 17:53:56 +03:00
Michael Snoyman
9fdb8c9d2d Field names for GWData 2012-07-04 17:53:47 +03:00
Michael Snoyman
7c4d6b5e47 Javascript in Head (#380) 2012-07-04 17:53:24 +03:00
Michael Snoyman
dbf1961613 Remove duplicated language extensions from scaffolded cabal file 2012-07-02 18:17:46 +03:00
Michael Snoyman
e95492a586 add-handler (#362) 2012-07-02 18:14:35 +03:00
Michael Snoyman
4fbfca050e Scaffolding works 2012-07-02 17:32:36 +03:00
Michael Snoyman
ceecbb7301 Included keter.yaml in scaffolding 2012-07-02 17:17:42 +03:00
Michael Snoyman
2dc8e653ab Fix yesod-form for FileUpload change 2012-07-02 17:16:53 +03:00
Michael Snoyman
d38e9a8c0a FileUploadSource (#262) 2012-07-02 11:21:02 +03:00
Michael Snoyman
7efbab8846 Explicit exports for FileInfo fields 2012-07-02 11:20:17 +03:00
Michael Snoyman
8fac4917b5 FileUpload (#358) 2012-07-02 11:15:02 +03:00
Michael Snoyman
21a4360f74 Allow openid to use claimed IDs (#338) 2012-07-02 09:57:20 +03:00
Michael Snoyman
a5b4dd5d29 atom:author (#351) 2012-07-02 09:46:35 +03:00
Michael Snoyman
e8fb512107 Allow sitewide hamlet changes (#377) 2012-07-02 09:37:56 +03:00
Michael Snoyman
3ecbf43f5d $newline 2012-07-01 20:59:37 +03:00
Michael Snoyman
d92d367c2d new yesod-platform 2012-06-30 22:34:32 +03:00
Michael Snoyman
a0c26206e3 yesod-test uses hspec 1.2 as well 2012-06-30 22:17:49 +03:00
Michael Snoyman
a5361e44f2 checkM' (need to rename it) 2012-06-30 22:09:13 +03:00
Greg Weber
9414ec04a5 Merge pull request #375 from JanAhrens/patch-1
Updated and fixed Heroku Procfile instructions
2012-06-29 16:01:14 -07:00
Jan Ahrens
3fc643e0ba Updated and fixed Heroku Procfile instructions 2012-06-27 23:24:36 +02:00
Michael Snoyman
d465d30863 Remove some blaze conditionals 2012-06-26 22:54:12 +03:00
Michael Snoyman
4a6e027d29 maximumContentLength is Word64 (#365) 2012-06-26 22:52:56 +03:00
Michael Snoyman
014732dac8 hspec 1.2 2012-06-26 10:56:50 +03:00
Michael Snoyman
9df0dd0212 Remove bounds on data-default 2012-06-26 09:09:07 +03:00
Michael Snoyman
ebc737a5cb conduit 0.5 2012-06-22 15:28:14 +03:00
Michael Snoyman
2e5f3740f4 conduit 0.5 2012-06-22 14:13:34 +03:00
Hiromi Ishii
72191c634b Merge pull request #372 from rlpowell/master
Modifications to make oauth actually install
2012-06-19 03:02:53 -07:00
Luite Stegeman
f71704a7b7 Merge pull request #374 from HairyDude/master
Re-export (<>) from Data.Monoid in Import for GHC 7.4+
2012-06-18 15:08:32 -07:00
Peter Berry
6bb584a8ec import (<>) with GHC >= 7.0.4 2012-06-18 23:45:52 +02:00
Michael Snoyman
8b5fbb47af New jQuery (#371) 2012-06-18 10:03:54 +03:00
Michael Snoyman
4187c3cd41 Merge pull request #370 from JPMoresmau/master
Offer a method to render a form field in a div without a label
2012-06-18 00:01:10 -07:00
Robin Lee Powell
029fc9c9b7 This is what I had to do to get oauth to actually install/run. 2012-06-16 15:10:39 -07:00
JP Moresmau
ebd219cafe renderDivs without form labels 2012-06-15 08:52:10 +02:00
Michael
0e0880dfe4 Hierarchy dispatching 2012-06-13 10:00:20 +03:00
Michael
255d71171c Beginning of hierarchichal routes, not done 2012-06-13 09:26:21 +03:00
Hiromi Ishii
8311dc76ae Merge pull request #12 from trofi/master
caught up with RSA-1.2
2012-06-10 02:16:22 -07:00
Sergei Trofimovich
a053b3ced9 authenticate-oauth: port to RSA-1.2
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2012-06-10 10:09:55 +03:00
Hiromi Ishii
9dc668a754 changed dependencies 2012-06-07 12:37:09 +09:00
Hiromi Ishii
e62bae7254 relaxed version constraint 2012-06-05 19:55:59 +09:00
Michael Snoyman
83e6061944 Merge branch 'master' of https://github.com/tanakh/yesod
Conflicts:
	yesod-auth/Yesod/Auth/Message.hs
	yesod-form/yesod-form.cabal
2012-06-05 06:22:31 +03:00
Michael Snoyman
7d72e22892 Merge pull request #355 from chrra/master
Norwegian Bokmål translation of yesod-{form,auth}
2012-06-04 20:19:20 -07:00
Michael Snoyman
d64d4a583b Do not allow project name test (fixes #356) 2012-06-05 06:17:16 +03:00
Michael Snoyman
e99a852cfb Fix a typo 2012-06-05 06:14:45 +03:00
Michael Snoyman
0bbf0eb2cc New yesod-platform 2012-06-05 06:14:45 +03:00
Hideyuki Tanaka
7296b13fc3 japanese translation 2012-06-05 01:13:22 +09:00
Christian Rødli Amble
5a54cf0dbc Norwegian language support. 2012-06-04 11:03:04 +02:00
Michael
4929ece70c Added Ord instance for Textarea 2012-05-31 07:25:53 +03:00
Michael Snoyman
3a21986165 Merge pull request #350 from mikesteele81/googleauth
yesod-auth: change returned Creds identifier to "googleemail".
2012-05-27 19:52:06 -07:00
Michael Steele
faf60f623e yesod-auth: change returned Creds identifier to "googleemail". 2012-05-24 16:05:59 -07:00
Michael Snoyman
1edf9b2b1b Fix jQuery date picker for newer jQuery versions 2012-05-22 21:25:15 +03:00
Felipe Lessa
d4d69e8e3e Bump yesod-static's version to 1.0.0.3. 2012-05-21 21:31:27 -03:00
Michael Snoyman
80513d5286 Removed an unneeded import 2012-05-21 22:01:41 +03:00
Michael Snoyman
e0f4a7423f MySQL is not experimental 2012-05-21 18:07:25 +03:00
Greg Weber
04364dad65 test mongodb and yesod-test 2012-05-20 17:15:57 -07:00
Greg Weber
13c4e137a2 Merge pull request #348 from meteficha/yesod-static-fix
yesod-static: Correctly add the "etag" param to TH-generated routes.
2012-05-19 08:43:10 -07:00
Michael Snoyman
a919d1ef7e Scaffolded site: put -threaded on the executable 2012-05-18 16:59:34 +03:00
Felipe Lessa
a1203297b9 yesod-static: Correctly add the "etag" param to TH-generated routes.
The wai-app-static package expects the etag parameter to be
passed in the form of

  /...?etag=XXXX

but yesod-static was passing

  /...?XXXX

This commit fixes this bug.
2012-05-17 09:59:17 -03:00
Michael Snoyman
ef0a7f0518 Updated xml-conduit 2012-05-15 10:23:14 +03:00
Michael Snoyman
a84a9c8f70 Updated yesod-platform 2012-05-14 17:16:26 +03:00
Michael Snoyman
04c0a66f8f Remove containers upper bound 2012-05-14 15:07:17 +03:00
Michael Snoyman
61b5627e44 Version bumps 2012-05-14 12:33:44 +03:00
Michael Snoyman
74626f9cab Reference fb package 2012-05-11 12:38:11 +03:00
Michael Snoyman
f8c731534c yesod-test: use html-conduit 2012-05-09 10:37:19 +03:00
Michael Snoyman
d0a7447f56 Remove containers upper bounds 2012-05-09 10:25:19 +03:00
Michael Snoyman
468b013860 Turn on blaze-html 0.5 by default 2012-05-09 09:50:37 +03:00
Michael Snoyman
07d26c0b2c Merge pull request #347 from sol/master
Make sure that all tests work with hspec-1.1.0
2012-05-07 10:42:24 -07:00
Simon Hengel
c4863019d0 yesod-test: Adapt for hspec-1.1 2012-05-07 07:43:36 +02:00
Simon Hengel
ad93e8c729 yesod-static: Adapt tests for hspec-1.0 and hspec-1.1 2012-05-07 07:43:36 +02:00
Simon Hengel
543e815744 yesod-routes: Adapt cabal file for hspec-1.1 2012-05-07 07:43:36 +02:00
Simon Hengel
653ffd02fb yesod-core: Adapt tests for hspec-1.1
This is not strictly necessary, the `UnevaluatedSpec` is merely
deprecated.  But it is a good idea anyway.
2012-05-07 07:43:28 +02:00
Michael Snoyman
fd2efbde35 Merge pull request #346 from markwright/master
changes for hspec 1.0, include test/main.hs in yesod-test
2012-05-06 05:16:30 -07:00
Mark Wright
1b322d49c7 Include test/main.hs in the sdist tarball 2012-05-06 12:25:56 +10:00
Mark Wright
1c4bbd52a7 yesod-routes changes for hspec 1.0 2012-05-06 12:21:08 +10:00
Mark Wright
9f4c92f181 yesod-core changes for hspec 1.0 2012-05-06 12:18:49 +10:00
Michael Snoyman
a628705493 Added missing bootstrap images (#344) 2012-04-29 09:47:56 +03:00
Michael Snoyman
e18c678aed Remove upper bounds on bytestring (yesodweb/shakespeare#60) 2012-04-29 09:38:45 +03:00
Michael Snoyman
20015aa6ee Update license with MIT license 2012-04-29 09:38:45 +03:00
Michael Snoyman
d59cbab495 Updated yesod-platform 2012-04-29 09:38:45 +03:00
Michael Snoyman
b57bee2615 Merge pull request #343 from NeonGraal/patch-2
Protect touch call in test action with #ifndef WINDOWS macro
2012-04-27 06:48:43 -07:00
Michael Snoyman
953007735f #342 2012-04-26 02:26:51 +03:00
NeonGraal
a697c0581a Protect touch call in test action with #ifndef WINDOWS macro 2012-04-26 10:47:29 +12:00
Luite Stegeman
0f06c29949 Merge pull request #334 from hirschenberger/develbuildghcapi
Develbuildghcapi
2012-04-25 08:18:29 -07:00
Michael Snoyman
4c0f523457 APPROOT environment variable 2012-04-25 17:32:20 +03:00
Michael Snoyman
12f530a1e7 Remove ghc7 flag (#322) 2012-04-25 17:20:38 +03:00
Michael Snoyman
bea122cee9 Turn blaze-html 0.5 on by default 2012-04-25 17:20:18 +03:00
Michael Snoyman
2b4300ab0d Updated yesod-platform 2012-04-25 17:18:23 +03:00
Michael Snoyman
e1cfbf41f3 make-cabal includes yesod-test 2012-04-25 17:17:48 +03:00
Michael Snoyman
d956eb53d1 Test -> Testing in mysql 2012-04-25 17:15:55 +03:00
Michael Snoyman
d624cb744b Fixes for hspec 1.0 2012-04-25 12:02:27 +03:00
Michael Snoyman
a8b06e0e9a Fixed yesod devel flag checking 2012-04-25 10:43:21 +03:00
Michael Snoyman
fbc75699da Mention yesod test on homepage 2012-04-25 07:32:22 +03:00
Michael Snoyman
9c7b8db916 Merge remote-tracking branch 'parcs/purge-cpp' 2012-04-25 07:25:54 +03:00
Michael Snoyman
d3277efe8a Removed a file from cabal file 2012-04-25 07:21:15 +03:00
Michael Snoyman
4120d16b64 Added yesod test command 2012-04-25 07:20:03 +03:00
Michael Snoyman
a4052b2784 Improved scaffolded cabal file 2012-04-25 07:19:46 +03:00
Michael Snoyman
f99fe1983f Fix scaffolded tests 2012-04-25 07:00:43 +03:00
Michael Snoyman
d96a28a088 More yesod-test cabal changes 2012-04-25 06:59:06 +03:00
Michael Snoyman
797339cbd2 yesod-test: use correct nonce/token key 2012-04-25 06:54:13 +03:00
Michael Snoyman
0755761834 Fix tests in scaffolding a bit 2012-04-24 18:57:14 +03:00
Michael Snoyman
81e61c4b55 Merge remote-tracking branch 'origin/master' 2012-04-24 17:33:06 +03:00
Michael Snoyman
cb2700d005 yesod-test: support newest hspec 2012-04-24 17:31:53 +03:00
Felipe Lessa
68001ed057 Fix a fixme comment. 2012-04-24 09:55:47 -03:00
Michael Snoyman
2a4747cd36 yesod-test: blaze-html 0.5 2012-04-23 16:06:37 +03:00
Michael Snoyman
ed9cafbf8f Fix to-cabal script 2012-04-23 15:25:11 +03:00
Michael Snoyman
82cf5d5b61 yesod: blaze-html 0.5 2012-04-23 15:13:29 +03:00
Michael Snoyman
49ebe878f0 yesod-newsfeed: blaze-html 0.5 2012-04-23 14:18:41 +03:00
Michael Snoyman
c34a62e5ca yesod-platform: do not include text 2012-04-23 14:14:41 +03:00
Michael Snoyman
8802472344 yesod-auth: use blaze-html 0.5 2012-04-23 14:14:23 +03:00
Michael Snoyman
aa459bc8d8 Fixed some warnings 2012-04-23 14:01:25 +03:00
Michael Snoyman
4789a1d073 yesod-form: blaze-html 0.5 2012-04-23 13:49:52 +03:00
Michael Snoyman
4bb2c33bfe yesod-core for blaze-html 0.5 2012-04-23 11:12:02 +03:00
Michael Snoyman
416ffe99e7 Version bump 2012-04-20 10:26:06 +03:00
Michael Snoyman
e2c79f95bd OpenID claimed IDs 2012-04-20 10:14:32 +03:00
Michael Snoyman
a86bb5efb1 authenticateClaimed 2012-04-20 10:04:07 +03:00
Michael Snoyman
7dd118adb1 Set claimed_id correctly in forwarded URL 2012-04-20 10:04:07 +03:00
Michael Snoyman
cda399131b Better test program for OpenID 2012-04-20 10:04:07 +03:00
Michael Snoyman
e19597cbf7 Include yesod-platform.cabal 2012-04-19 11:36:10 +03:00
Michael Snoyman
dcbccfaa71 hjsmin bump 2012-04-19 11:07:48 +03:00
Michael Snoyman
9fbd9d239d Merge remote-tracking branch 'origin/master' 2012-04-19 07:59:06 +03:00
Michael Snoyman
a4920c46ca Version bumps 2012-04-19 07:57:43 +03:00
hirschen
101ef2497c Code cleanup and output exit status of build. 2012-04-18 08:59:35 +02:00
Michael Snoyman
15e6289fe1 Merge pull request #336 from SKAhack/master
Fixed comment of Yesod.Default.Util.widgetFileJsCss
2012-04-17 20:42:56 -07:00
Luite Stegeman
3ea7bcacaf add warning, this seems to bite many new users 2012-04-17 22:52:09 +03:00
Hiroki Sato
6f26f75064 Fixed comment 2012-04-18 02:41:59 +09:00
Michael Snoyman
4b6490e037 Generalize hiddenField to any PathPiece 2012-04-17 18:31:57 +03:00
Michael Snoyman
d1e29f958b Help out cabal a bit 2012-04-17 18:31:56 +03:00
Michael Snoyman
a3fdf21121 Auto-wrap SomeMessage on fieldSettingsLabel 2012-04-17 18:31:56 +03:00
hirschen
204c8cc744 Run the buildhook with 'system' 2012-04-17 14:16:32 +02:00
hirschen
ccb9d00191 Add success- and failhook options to cmdline 2012-04-17 10:40:04 +02:00
Michael Snoyman
ce1f691f43 Merge pull request #332 from markwright/master
Add missing test source files to extra-source-files
2012-04-16 06:28:39 -07:00
Mark Wright
745edc36b1 Add test/main.hs to extra-source-files: to hopefully fix https://github.com/yesodweb/yesod/issues/331 2012-04-16 21:15:58 +10:00
Mark Wright
f7b0f6ce12 Include missing test files and sort the list of test files 2012-04-16 21:10:52 +10:00
Michael Snoyman
b9e52bfec7 Include approot for dev by default (#329) 2012-04-15 09:47:26 +03:00
Michael Snoyman
b1e71b0a8a yesod-platform in scaffolded cabal 2012-04-15 06:45:27 +03:00
Luite Stegeman
2f5628d254 fix building with GHC API 2012-04-13 02:02:58 +02:00
Felipe Lessa
a485e5c33b Merge pull request #326 from Xarch/master
French translation of Yesod Auth.
2012-04-11 11:17:44 -07:00
Félix
856a25c67f Frencih -> French 2012-04-11 20:15:11 +02:00
Félix
e41a6aca80 Fixed module informations for the french translation of form messages 2012-04-11 19:49:11 +02:00
Felipe Lessa
a2cb436828 Fix FIXME comment on htmlField (fixes #328). 2012-04-11 08:34:55 -03:00
Félix
9ccd0e24a6 French support for forms 2012-04-10 20:27:10 +02:00
Félix
69871a030a Fixed some typos in the french translation 2012-04-10 19:14:41 +02:00
Patrick Palka
1b9b19bb64 [scaffold] use if-then-else instead of guards
While the guards solution was nice, it causes GHC to emit a
non-exhaustive pattern warning.
2012-04-10 12:12:54 -04:00
Michael Snoyman
74a826fbb4 clearSession 2012-04-10 18:56:30 +03:00
Félix
dd8ce35e74 French translation of Yesod Auth messages 2012-04-09 19:58:23 +02:00
Patrick Palka
7ce991d9cb [scaffold] fix typo in setLogger definition 2012-04-09 11:13:28 -04:00
Patrick Palka
78be263e02 [scaffold] remove the cryptic dev/prod combinators 2012-04-09 11:09:42 -04:00
gregwebs
ba4cd002e1 documentation cleanup 2012-04-09 05:54:53 -07:00
Greg Weber
44647eda1d Merge pull request #325 from acheshkov/patch-1
add additional documentation for language function
2012-04-09 05:52:16 -07:00
Michael Snoyman
7af5eef145 Version bump 2012-04-09 13:24:58 +03:00
Michael Snoyman
2aed359e44 Fix scaffolded settings.yml 2012-04-09 13:24:46 +03:00
Anton
09c461dd89 add additional documentation for language function 2012-04-09 14:02:09 +06:00
Michael Snoyman
5a716de3d0 Version bump 2012-04-09 10:17:53 +03:00
Michael Snoyman
285c3497f4 Version bump 2012-04-09 10:16:06 +03:00
Michael Snoyman
aed67fc680 Better scaffolded default-layout for Twitter Bootstrap 2012-04-09 10:16:06 +03:00
Patrick Palka
27d8f13e7f [yesod] update extra-source-files in cabal file 2012-04-08 00:58:19 -04:00
Patrick Palka
e341420596 Merge remote-tracking branch 'origin/master' into purge-cpp 2012-04-08 00:29:17 -04:00
Patrick Palka
5b8925962f [scaffold] make the scaffolding buildable 2012-04-08 00:27:22 -04:00
gregwebs
1f392d2b79 install yesod with cabal-meta 2012-04-07 17:40:55 -07:00
Michael Snoyman
4ac413e419 Configurable session name 2012-04-07 23:01:29 +03:00
Patrick Palka
55bd35fc5c [scaffold] add 'production' and 'prod' combinator 2012-04-06 12:21:03 -04:00
Patrick Palka
687961cd22 [scaffold] refactor uses of CPP into pure Haskell 2012-04-06 12:16:03 -04:00
Luite Stegeman
2ba9828295 add Types to other-modules 2012-04-06 06:38:46 +02:00
Luite Stegeman
d774c32680 include .cabal file in the watched files 2012-04-05 21:53:58 +02:00
Michael Snoyman
8d0f429c62 Merge remote-tracking branch 'origin/master' 2012-04-05 22:41:11 +03:00
Michael Snoyman
110b4a2b45 Relax some upper bounds 2012-04-05 22:40:51 +03:00
Michael Snoyman
f8c41eb5ac Doc fix 2012-04-05 22:39:39 +03:00
Luite Stegeman
4dc5e74f02 handle flag to disable GHC API recompilator 2012-04-05 21:37:30 +02:00
Luite Stegeman
7e2fce52b5 describe subcommands 2012-04-05 21:30:03 +02:00
Luite Stegeman
0fcb55960c use options library for command line options 2012-04-05 20:59:59 +02:00
Hiromi Ishii
c2d4f15cad removed extra file deps for qq.h 2012-04-05 16:23:25 +09:00
gregwebs
c1ff148cfd remove fromArgsWith from documentation 2012-04-04 14:23:32 -07:00
Michael Snoyman
487e5c9bc4 Don't test for tiny 2012-04-04 07:12:05 +03:00
Luite Stegeman
0ee840da44 use Cabal to determine location of ar' 2012-04-04 03:42:25 +02:00
Luite Stegeman
0b9edf6282 properly configure programs 2012-04-04 03:08:58 +02:00
Luite Stegeman
c097d289f8 use Cabal to determine program locations 2012-04-04 02:27:41 +02:00
Luite Stegeman
0c60da3472 nonblocking waitForProcess 2012-04-04 01:03:05 +02:00
Luite Stegeman
740f4d3843 default to nonthreaded, OS X doesn't like it 2012-04-03 22:49:34 +02:00
Luite Stegeman
9194e45f3b fix warnings (and disable some) 2012-04-03 21:07:18 +02:00
Luite Stegeman
69ce5fea57 make it work with GHC 7.0 2012-04-03 20:26:20 +02:00
Luite Stegeman
1cb7a494a9 rebuild application with GHC API (incomplete, only tested on linux, GHC 7.4.1 required) 2012-04-03 18:41:40 +02:00
Michael Snoyman
43d938bbe7 Switch from BSD3 to MIT 2012-04-03 10:45:51 +03:00
Michael Snoyman
6461edf00b Feeds use xml-conduit (#301) 2012-04-03 09:51:04 +03:00
Michael Snoyman
ddde7e1676 yesod devel prints error messages too 2012-04-03 09:49:22 +03:00
Michael Snoyman
9563865e30 sitemap uses xml-conduit 2012-04-03 09:19:55 +03:00
Michael Snoyman
742ffa4d14 Automatically apply toWidget to ^{} interpolations 2012-04-03 08:07:57 +03:00
Hiromi Ishii
182d193cbb Merge branch 'master' of github.com:yesodweb/authenticate 2012-04-03 14:05:51 +09:00
Hiromi Ishii
6eb329b361 changed type-class constraints 2012-04-03 14:05:38 +09:00
Hiromi Ishii
0b32519229 Revert "changed type-class constaring."
This reverts commit 73eb78c446.
2012-04-03 14:02:27 +09:00
Hiromi Ishii
73eb78c446 changed type-class constaring. 2012-04-03 14:02:14 +09:00
Michael Snoyman
fc29c153ed Removed dates from version numbers 2012-04-03 07:57:43 +03:00
Michael Snoyman
94bb9ce22c Removed submodules 2012-04-03 07:55:56 +03:00
Michael Snoyman
c00aa5971b yesod devel: hide "Loading package" messages 2012-04-03 07:45:13 +03:00
Michael Snoyman
53f8dc2fdb transformers 0.3 2012-04-03 07:41:15 +03:00
Michael Snoyman
c3f58479f9 Devel server prints URL, not just port (#306) 2012-04-03 07:02:12 +03:00
Michael Snoyman
4d7355cf33 Merge remote-tracking branch 'origin/master' into HEAD 2012-04-02 20:28:11 +03:00
Michael Snoyman
8639c54339 NoMonomorhpismRestriction in scaffolding 2012-04-02 18:33:30 +03:00
Michael Snoyman
94a844f9fe yesod devel handles Vim better 2012-04-02 18:33:14 +03:00
Michael Snoyman
1b985796ec Better generateFormPost 2012-04-02 18:32:53 +03:00
gregwebs
db55170dff fix import warnings 2012-04-02 07:35:30 -07:00
Michael Snoyman
fa1a03d420 Scaffolder: always use App as sitearg 2012-04-02 17:24:39 +03:00
gregwebs
0020feff62 still need to invoke cabal on 7.4 2012-04-02 07:11:19 -07:00
gregwebs
1ccbf5ce06 fix yesod devel file finding breakage 2012-04-02 06:47:41 -07:00
gregwebs
26a78f41ce Merge branch 'master' of github.com:yesodweb/yesod 2012-04-01 11:06:18 -07:00
gregwebs
3fbe4c8f62 ignore lower case directories 2012-04-01 07:19:14 -07:00
gregwebs
8b3adbb01e use hs-source-dirs, no hamlet deps in 7.4
* pass along hs-source-dirs to the dependency finders
* 7.4 tracks hamlet dependencies already
2012-04-01 06:58:23 -07:00
gregwebs
9621d12b9f Merge branch 'master' of github.com:yesodweb/yesod 2012-03-31 15:40:48 -07:00
Luite Stegeman
396644081c make SessionBackend more flexible 2012-03-31 01:36:44 +02:00
gregwebs
0c6a319ae6 use setLogger 2012-03-30 09:16:53 -07:00
Hiromi Ishii
65b085e568 caught up with conduit-0.4 and yesod-1.0 2012-03-30 18:20:37 +09:00
Hiromi Ishii
cd0afdf2d5 Merge branch 'master' of github.com:yesodweb/authenticate 2012-03-30 17:10:09 +09:00
Hiromi Ishii
5f30bcbb2c changed versions 2012-03-30 17:09:07 +09:00
Luite Stegeman
9071875e67 properly hide other packages when running yesod --dev devel 2012-03-30 08:50:25 +02:00
Luite Stegeman
10f3f81920 add # to prevent fusing words at line breaks (only one actual problem on line 5) 2012-03-29 17:45:46 +03:00
Michael Snoyman
be5999d2b0 yesod-test version number 2012-03-29 11:30:33 +02:00
Michael Snoyman
75b6173f7d Fixed all warnings, should finally build on Jenkins 2012-03-29 10:14:44 +02:00
Michael Snoyman
03cf2d170c Fix a warning 2012-03-29 09:03:22 +02:00
Michael Snoyman
7c65829f03 Fix some warnings 2012-03-29 08:44:01 +02:00
Michael Snoyman
6e17c1ae17 Fixed scaffolding; removed tiny; added bootstrap.css 2012-03-29 08:43:37 +02:00
Michael Snoyman
95cbf51b95 yaml is a submodule 2012-03-29 08:22:21 +02:00
Michael Snoyman
37ad3c045b Merge remote-tracking branch 'origin/master'
Conflicts:
	yesod-test/yesod-test.cabal
2012-03-29 07:47:38 +02:00
Michael Snoyman
690b017f02 Get everything to build 2012-03-29 07:45:04 +02:00
Michael Snoyman
d142d8c214 Merge branch 'beta' 2012-03-29 07:07:35 +02:00
Michael Snoyman
25ec577449 transformers 0.3 2012-03-28 16:23:00 +02:00
Michael Snoyman
a42d4d6282 Remove unneeded line from scaffolding 2012-03-28 13:35:26 +02:00
Michael Snoyman
1c28ca8744 Initial migration to xml-conduit 2012-03-28 09:14:43 +02:00
Michael Snoyman
940c1dddcd Parse HTML to an XML document via xml-conduit 2012-03-28 08:43:36 +02:00
Michael Snoyman
5e068b32b7 Added some simple selector test cases 2012-03-28 08:18:19 +02:00
Michael Snoyman
0201415b05 Migrated yesod-test to attoparsec 2012-03-28 08:14:51 +02:00
Michael Snoyman
a3e27a3d57 Started yesod-test test suite (yo dawg...) 2012-03-28 08:03:47 +02:00
Michael Snoyman
0131750a42 Updated scaffolded version bounds 2012-03-28 07:44:19 +02:00
Michael Snoyman
64b8a7be0f Build yesod-test 2012-03-28 07:43:36 +02:00
Michael Snoyman
4649c587fd Update yesod-test bounds 2012-03-28 07:42:41 +02:00
Michael Snoyman
9b9a3ad605 Fix a bug in IsString instance of FieldSettings 2012-03-28 07:41:49 +02:00
Michael Snoyman
4cc933b21a conduit 0.4 2012-03-28 07:19:58 +02:00
Michael Snoyman
7419d01ba3 conduit 0.4 2012-03-27 19:22:10 +02:00
gregwebs
4545b2a91d fix need form import 2012-03-26 11:18:24 -07:00
gregwebs
127ddf7181 scaffolding fixes
breakup getApplication into makeFoundation and makeApplication
that way tests can re-use makeFoundation
2012-03-26 09:23:35 -07:00
gregwebs
a3cdb27ff0 hlint 2012-03-26 09:23:07 -07:00
gregwebs
40cfd1f857 build yesod-test 2012-03-25 21:21:59 -07:00
gregwebs
cff17e6321 ignore .virthualenv 2012-03-25 17:22:53 -07:00
gregwebs
3f0848121c Session -> BackendSession 2012-03-25 13:31:02 -07:00
gregwebs
f147e76231 Revert "Session and Headers exportet"
This reverts commit f58a695c84.
2012-03-25 13:31:02 -07:00
gregwebs
3bb3db16b1 Revert "fix Session export"
This reverts commit 03634a13b8.
2012-03-25 13:31:02 -07:00
gregwebs
47b89724e8 Revert "fix tests: import Yesod.Core hiding (Session)"
This reverts commit f548a4c566.
2012-03-25 13:31:02 -07:00
gregwebs
469d58cf6d Revert "another Session hide"
This reverts commit 589ab4a547.
2012-03-25 13:31:02 -07:00
Michael Snoyman
edc2d49b9b update browserid check 2012-03-25 18:54:25 +02:00
Michael Snoyman
d464f85f9d fsLabel and fsTooltip are SomeMessage 2012-03-25 18:49:35 +02:00
Michael Snoyman
46308c8d1f fsClass to fsAttrs 2012-03-25 17:57:40 +02:00
gregwebs
2bb39530d6 fix RootR -> HomeR 2012-03-25 08:43:25 -07:00
gregwebs
2baeddd698 fix doctype 5 2012-03-25 08:21:21 -07:00
gregwebs
589ab4a547 another Session hide 2012-03-25 08:13:03 -07:00
gregwebs
f548a4c566 fix tests: import Yesod.Core hiding (Session) 2012-03-25 08:08:19 -07:00
gregwebs
b1bc42a8bd use doctype 5 instead of !!! 2012-03-25 07:49:35 -07:00
gregwebs
03634a13b8 fix Session export 2012-03-25 07:49:35 -07:00
Michael Snoyman
a5cc05a22f Merge pull request #314 from scan/master
Exported Session and Headers(..)
2012-03-25 06:57:27 -07:00
Tom Streller
f58a695c84 Session and Headers exportet 2012-03-25 13:30:56 +02:00
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
Michael Snoyman
c8668c549c Updated scaffolding dependencies 2012-03-25 10:13:46 +02:00
Michael Snoyman
bed6aa629a Removed modernizr 2012-03-25 10:08:22 +02:00
Michael Snoyman
958d9dcf2f Removed submodules 2012-03-25 00:36:45 +02:00
Greg Weber
81db921c85 Merge pull request #302 from MichaelXavier/yesod-test-more-assertions
Add more assertions to yesod-test
2012-03-23 08:55:17 -07:00
Michael Snoyman
d7b515cd5b Fix an extra close angle bracket 2012-03-23 17:34:26 +02:00
gregwebs
b16436f476 simplify documentation 2012-03-23 07:34:07 -07:00
Michael Snoyman
1f1c6ca9d4 Fixes 2012-03-23 16:02:50 +02:00
Michael Xavier
e18253e6e9 Expose withResponse in yesod-test 2012-03-22 19:58:18 -07:00
Michael Xavier
05ed37807b Port assertHeader/assertNoHeader from wai-test 2012-03-22 19:47:10 -07:00
Michael Xavier
f035b1fc22 Add bodyEquals assertion 2012-03-22 19:23:31 -07:00
Hiromi Ishii
fd67f12be9 Merge branch 'master' of github.com:yesodweb/authenticate 2012-03-22 16:06:50 +09:00
Hiromi Ishii
519f857007 removed unnecessary parts 2012-03-22 15:58:52 +09:00
Hiromi Ishii
ab821a32a9 catched up with conduit-0.3 2012-03-22 15:56:44 +09:00
Michael Snoyman
f69f0b0cba Merge pull request #300 from meteficha/cookieDomain
Session cookie domain
2012-03-21 21:31:06 -07:00
Felipe Lessa
9cd7a0ba14 Add cookieDomain to Yesod type class. 2012-03-21 14:36:46 -03:00
Felipe Lessa
1216c472c7 Remove trailing whitespace. 2012-03-21 14:36:30 -03:00
Michael Snoyman
fa997d74d5 conduit update 2012-03-21 08:32:49 +02:00
Michael Snoyman
ca49415938 Added missing test file 2012-03-20 17:30:18 +02:00
Michael Snoyman
22cd28b8f4 shakespeare 1.0 bump 2012-03-20 17:30:06 +02:00
Michael Snoyman
b0b755cd80 Merge remote-tracking branch 'origin/master'
Conflicts:
	yesod/scaffold/Handler/Home.hs.cg
	yesod/scaffold/config/routes.cg
	yesod/scaffold/project.cabal.cg
	yesod/yesod.cabal
2012-03-20 17:01:06 +02:00
Michael Snoyman
0618c5f6a5 WaiSubsite 2012-03-20 15:23:27 +02:00
Michael Snoyman
6c492d2e0b Merge pull request #295 from piyush-kurur/master
Some clarification of the documentation of mkDispatchClause in yesod-routes package
2012-03-17 13:44:05 -07:00
gregwebs
32d11e886d more testing cleanup 2012-03-16 23:21:46 -07:00
gregwebs
17cecdad80 add documentation 2012-03-16 23:21:45 -07:00
gregwebs
494b2be299 cleanup test branch 2012-03-16 23:21:45 -07:00
Nubis
7803cbb10e deleted old tests module 2012-03-16 23:21:45 -07:00
Nubis
a7ce59cd2a integrated scaffold and improved scaffolded site 2012-03-16 23:21:45 -07:00
Nubis
a72a62827b Fixed dependencies 2012-03-16 23:21:45 -07:00
Nubis
b13a3d3858 integrated yesod tests to scaffolder. still work in progress 2012-03-16 23:21:45 -07:00
Piyush P Kurur
4676331db3 some documentation fixes to mkDispatchClause 2012-03-17 05:34:15 +05:30
Michael Snoyman
ec62f6f68c nonce -> token (#214) 2012-03-16 06:39:30 +02:00
Pascal Wittmann
e4e2dd75cc removed QQ hacks from yesod-auth-oauth 2012-03-15 22:18:56 +01:00
Pascal Wittmann
a3c307070c removed QQ hacks from yesod-sitemap 2012-03-15 22:14:57 +01:00
Pascal Wittmann
6155e135b0 removed QQ hacks from yesod-newsfeed 2012-03-15 22:13:02 +01:00
Pascal Wittmann
f4e743e50d removed QQ hacks from yesod-auth 2012-03-15 22:08:19 +01:00
Pascal Wittmann
ba1e083edc removed QQ hacks from yesod-form 2012-03-15 21:57:32 +01:00
Michael Snoyman
f11656f73a Compiler error if no templates found (#289) 2012-03-15 18:48:27 +02:00
Michael Snoyman
0257c9a0de Fix scaffolded cabal file 2012-03-15 18:44:42 +02:00
Michael Snoyman
937d2e7c2c Remove email code from scaffolding (#204) 2012-03-15 18:43:33 +02:00
Michael Snoyman
2c66202e4a Include date in version of yesod-default 2012-03-15 18:41:43 +02:00
Michael Snoyman
757af0e32f Remove problematic toWidget wrapper 2012-03-15 18:41:14 +02:00
Michael Snoyman
21c9e84d4e Fix logic of warning messages for widgetFile 2012-03-15 18:35:53 +02:00
Michael Snoyman
83b719f534 Fix widgetFile, slightly more efficient too 2012-03-15 18:35:09 +02:00
Michael Snoyman
2c823943af Including yaml subrepo 2012-03-15 17:28:43 +02:00
Michael Snoyman
014cb80031 Including xml-conduit 2012-03-15 17:25:39 +02:00
Michael Snoyman
04251be00a Updated sources.txt 2012-03-15 17:24:38 +02:00
Michael Snoyman
ca5d35ca3f Updated scripts 2012-03-15 17:09:05 +02:00
Michael Snoyman
072df2f06a Merge branch 'master' into beta
Conflicts:
	yesod/scaffold/project.cabal.cg
	yesod/scaffold/tiny/project.cabal.cg
2012-03-15 14:33:12 +02:00
Michael Snoyman
18d4b98d41 Added yesod-platform and creation scripts 2012-03-15 14:02:07 +02:00
Greg Weber
94f85edea2 use #ifdef not #if 2012-03-14 09:27:29 -07:00
Greg Weber
28cf60e6e7 Merge branch 'master' of github.com:yesodweb/yesod 2012-03-14 09:26:45 -07:00
Greg Weber
14104c4adf Merge pull request #290 from asmyers/updated-heroku-code
Updated Heroku code for Yesod 0.10.2.1
2012-03-14 08:41:23 -07:00
Greg Weber
bc7e8f3643 be clear that we are using the yesod-core version 2012-03-14 08:37:53 -07:00
Greg Weber
437a82d6c4 scaffold version bounds for shakespeare-text 2012-03-14 08:34:49 -07:00
Hiromi Ishii
228770a191 Merge pull request #292 from scan/a65a9bd5ff0c805bbd1f791caaab12b9bce03bc9
Added Tumblr OAuth
2012-03-14 06:01:13 -07:00
Michael Snoyman
e0fda35a55 Removed deprecated methods from Yesod typeclass 2012-03-13 21:46:06 +02:00
Michael Snoyman
ee81979430 Merge remote-tracking branch 'origin/master' into beta 2012-03-13 15:14:49 +02:00
Michael Snoyman
3a04e1b835 Merge branch 'master' into beta 2012-03-13 13:11:27 +02:00
Michael Snoyman
e62e4b8721 Finished deprecating old Widget functions 2012-03-13 13:11:05 +02:00
Luite Stegeman
6ea8e65761 Merge pull request #263 from yesodweb/session
Make session storage configurable
2012-03-13 03:25:33 -07:00
Luite Stegeman
3775552d87 improve nonce key code as per @gregwebs' suggestion 2012-03-13 11:19:16 +01:00
Luite Stegeman
344a884656 improve makeSessionBackend comment in scaffold 2012-03-13 11:09:18 +01:00
Luite Stegeman
00b9acd98d merge master branch 2012-03-13 11:02:33 +01:00
Michael Snoyman
4cc468ca3b Beginning of old widget function deprecation, not complete 2012-03-13 06:36:27 +02:00
Andrew Myers
65a0c0f198 Updated Heroku code for Yesod 0.10.2.1 2012-03-12 19:02:27 -04:00
Greg Weber
6c406f89d5 use proper GHC version number. 704 means 7.4 2012-03-12 13:58:57 -07:00
Michael Snoyman
0b9ced7f6c Updated favicon 2012-03-12 16:23:06 +02:00
Michael Snoyman
c65053ec64 Simplified host/port/approot settings, solves #274 2012-03-12 15:35:43 +02:00
Michael Snoyman
c3a9c845e9 More Root to Home fixes 2012-03-12 14:59:28 +02:00
Michael Snoyman
5b07edd2db RootR to HomeR #267 2012-03-12 13:42:04 +02:00
Michael Snoyman
cbd0719f37 conduit 0.3 2012-03-12 13:40:04 +02:00
Michael Snoyman
c61c883be0 conduit 0.3 2012-03-12 12:50:36 +02:00
Greg Weber
64a52a1f49 update scripts 2012-03-12 00:30:12 -07:00
Michael Snoyman
b5f2e4863d Remove some QQ hacks #288 2012-03-12 08:50:15 +02:00
Michael Snoyman
320b71d3ac yesod-newsfeed: replace String with Text 2012-03-12 08:50:15 +02:00
Greg Weber
eeea0292ad update scripts 2012-03-11 23:46:41 -07:00
Greg Weber
096a84cec1 version bumps for new shakespeare 2012-03-11 23:12:24 -07:00
Greg Weber
6394483c31 allow newer version of shakespeare(-text) 2012-03-11 12:13:33 -07:00
Greg Weber
6baedfecea Merge pull request #286 from piyush-kurur/master
mkRenderRouteInstance with context
2012-03-10 22:20:15 -08:00
Michael Snoyman
3c9a4d6604 Merge pull request #11 from Tarrasch/master
Remove kerberos support for authenticate
2012-03-10 09:33:01 -08:00
Michael Snoyman
65bf960e44 Merge pull request #287 from Tarrasch/master
Remove kerberos support for yesod-auth
2012-03-10 09:32:25 -08:00
Arash Rouhani
54fd31669c Remove kerberos authentication 2012-03-09 21:29:35 +01:00
Arash Rouhani
d6f1821170 Remove kerberos support for yesod-auth
New repo at Tarrasch/yesod-auth-kerberos
2012-03-09 21:20:39 +01:00
Piyush P Kurur
9c26f86f91 added mkRenderRouteInstance' a more general version of mkRenderRouteInstance 2012-03-09 15:34:00 +05:30
Tom Streller
a65a9bd5ff tumblr oauth 2012-03-07 22:15:19 +01:00
Greg Weber
74f289d2e3 update sources.txt 2012-03-05 13:16:10 -08:00
Felipe Lessa
02d3b702aa Small doc fix on Yesod.Form.Fields.Textarea. 2012-03-02 17:32:00 -03:00
Greg Weber
4d4a1a7fec update sources.txt 2012-03-02 09:38:24 -08:00
Hiromi Ishii
df89f0c312 (maybe) resolved oauth-1.0 problem 2012-03-02 16:28:21 +09:00
Hiromi Ishii
f86bd28b45 Merge branch 'master' of github.com:yesodweb/authenticate 2012-03-02 16:25:33 +09:00
Hiromi Ishii
f7fcea4a5a Added OAuth version data-type 2012-03-02 16:24:58 +09:00
Greg Weber
30f6348e56 get rid of StaticFiles import warnings 2012-03-01 11:03:49 -08:00
Greg Weber
92d3af002e Merge pull request #282 from milaz/patch-1
Enable all necessary extensions for `ghci ./main.hs` to work in a scaffolded project
2012-03-01 10:57:29 -08:00
Greg Weber
3f8bc5b79d version bump 2012-03-01 10:37:46 -08:00
Greg Weber
3290f5339e < 7.4, not <= 7.4 for (<>) 2012-03-01 10:24:44 -08:00
Greg Weber
42cfed8c81 version bump 2012-03-01 10:05:17 -08:00
Greg Weber
031d38d392 fix yesod --dev devel. closes #283 2012-03-01 08:52:15 -08:00
Greg Weber
3d59a32ef3 bump wai-extra 2012-02-29 13:13:06 -08:00
Greg Weber
9ecaa4a54c version bump 2012-02-29 11:01:39 -08:00
Greg Weber
2b96ab590f update scripts submodule 2012-02-29 10:44:20 -08:00
Michael Lazarev
5a9dee949d Enable all necessary extensions for ghci ./main.hs to work in a scaffolded project 2012-02-29 22:40:00 +04:00
Greg Weber
c2ee1d4cbe 7.4 ships with (<>) = mappend 2012-02-29 09:42:50 -08:00
Michael Snoyman
fe67a28c19 Merge pull request #281 from scan/master
German auth messages and tiny scaffold .cabal correction
2012-02-29 07:17:55 -08:00
Tom Streller
f9dde86025 germanMessage added to the export list 2012-02-29 12:28:57 +01:00
Michael Snoyman
d4d223f97f Fix OpenID for Wordpress 2012-02-29 07:06:30 +02:00
Tom Streller
0361f01dd2 Added StaticFiles to Import.hs 2012-02-28 21:01:01 +01:00
Tom Streller
f941dad48d Added StaticFiles to Import 2012-02-28 20:48:34 +01:00
Tom Streller
7b90f10f14 german auth messages 2012-02-28 19:38:46 +01:00
Tom Streller
65a64f5ab5 removed double occurence in scaffolded cabal file 2012-02-28 19:28:47 +01:00
Greg Weber
ca20827bc5 fix use analytics varialbe in google tracking 2012-02-28 08:50:56 -08:00
Michael
b28ea24b1c Remove a few more unsafe functions from Import 2012-02-28 14:36:02 +02:00
Greg Weber
22200b910b add widgetFileJsCss for exact cs/js specification
I can set it to coffeescript.

widgetFile = Yesod.Default.Util.widgetFileJsCss $ globFile
  ("coffee", coffeeFileReload) ("cassius", cassiusFileReload)

Should we put code like this as the scaffold default?
Obviously, we can keep it defaulted to "julius"
2012-02-26 16:41:15 -08:00
Greg Weber
ffaa1d6a32 favor BottomOfBody 2012-02-26 16:41:15 -08:00
Hiromi Ishii
a569c7f960 * Catch up with new version of authenticate-oauth.
* Changed Interface of authOAuth.
* Chagned urls about authTwitter.
2012-02-26 18:28:48 +09:00
Greg Weber
d602606bb6 don't use Yepnope for google analytics
it is already at the bottom of the body
2012-02-25 15:23:38 -08:00
Greg Weber
9372daf892 Merge pull request #279 from jgrocho/bug/modernizr_line_endings
Remove CRLF line endings from modernizr.js
2012-02-24 18:50:37 -08:00
Jonathan Grochowski
a304c0daa5 Remove CRLF line endings from modernizr.js
This is a minor pet peeve, but the modernizr.js included in the scaffold
has CRLF line endings in the repository, and thus any scaffolded sites.
This appears to be the only affected file in this repo.
2012-02-24 17:01:28 -08:00
Michael Snoyman
2a7d0d3beb Merge pull request #10 from ahodgen/heimdal-kinit
Support Heimdal Kerberos.
2012-02-23 02:08:44 -08:00
Aaron Hodgen
5c2f7bd4a6 Support Heimdal Kerberos. 2012-02-22 15:42:53 -05:00
Michael Snoyman
e3a07d2b80 Version bump 2012-02-21 15:17:56 +02:00
Michael Snoyman
4c21c092ab Fix Haddocks (#277) 2012-02-21 15:17:36 +02:00
Felipe Lessa
8a3024113f Bump yesod-form to 0.4.2. 2012-02-20 16:32:55 -02:00
Greg Weber
2fac449ad6 Merge pull request #276 from scan/master
Added SVG image content type
2012-02-19 14:56:45 -08:00
Tom Streller
44119c6e02 added svg content type 2012-02-19 23:09:12 +01:00
Michael Snoyman
2e74df8e79 Merge pull request #273 from Tarrasch/master
Swedish message in yesod-auth
2012-02-18 08:48:45 -08:00
Arash Rouhani
2914025202 Include Swedish support in yesod-auth 2012-02-17 23:22:39 +01:00
Greg Weber
e1d584cf1f pass through args to yesod devel 2012-02-16 19:03:37 -08:00
Greg Weber
9b8b20e058 tests and better docs for jsLoader 2012-02-16 16:11:10 -08:00
Felipe Lessa
5b75d6758a Fix small typo on renderBootstrap's doc. 2012-02-16 12:21:16 -02:00
Felipe Lessa
124d142119 Bump yesod-core to 0.10.2. 2012-02-16 12:19:50 -02:00
Felipe Lessa
99fa1a07c4 yesod-form requires yesod-core >= 0.10.2.
Commit 651a1f8abd introduced
this dependency without stating it on the build-depends.
2012-02-16 12:13:12 -02:00
Felipe Lessa
4ebaa31d90 Support Bootstrap 2.0 on renderBootstrap. 2012-02-16 12:11:57 -02:00
Felipe Lessa
e1066b622a Update renderBootstrap's docs for Bootstrap 2.0. 2012-02-16 11:47:27 -02:00
Michael Snoyman
221c5a35c7 EmptyDataDecls in scaffolding (needed by GHC 7.4) 2012-02-16 06:58:15 +02:00
Michael Snoyman
a98c73a4c9 Fix a warning 2012-02-16 06:58:01 +02:00
Luite Stegeman
16fe5330c0 Merge pull request #266 from khanage/master
handle persistFileWith in yesod devel
2012-02-12 09:08:55 -08:00
Khan Thompson
2c597fe01f Revert "Adding a comment to the models config file for the scaffolded site to help avoid gotcha"
This reverts commit f1474f4432.
2012-02-13 03:21:28 +11:00
Khan Thompson
68e8bfd2c1 Add in handling for the persistFileWith case in determining dependent files for the yesod devel server 2012-02-13 03:19:01 +11:00
Greg Weber
651a1f8abd more flexible js loading
* write your own async jsLoader widget.
* Suport loading from the bottom of body tag.

Bottom of the page is actually the best default until you profile your
application.
2012-02-12 08:11:45 -08:00
Khan Thompson
f1474f4432 Adding a comment to the models config file for the scaffolded site to help avoid gotcha 2012-02-13 01:09:01 +11:00
Michael Snoyman
a58f859d41 Fix warnings 2012-02-12 15:35:44 +02:00
Michael Snoyman
2e71fb0a28 GoogleEmail skips unnecessary parameter 2012-02-12 15:23:41 +02:00
Luite Stegeman
32d5c3f5f1 Improve makeSessionBackend documentation 2012-02-11 20:37:40 +01:00
Luite Stegeman
a37beb3447 Add encryptKey and clientSessionDuration for 0.10 compatibility 2012-02-11 20:33:26 +01:00
Luite Stegeman
4a53d48bb5 Merge pull request #265 from hirschenberger/master
German spelling fix
2012-02-11 10:53:02 -08:00
Falco Hirschenberger
9b7ebbabe5 Fix german grammar, no I'm no grammar-nazi, just improving things in the details ;-) 2012-02-11 19:30:45 +01:00
Luite Stegeman
2d3e10b372 Check cabal build exit code, don't try to start application if build failed 2012-02-11 04:26:26 +01:00
Luite Stegeman
f2d7b0bda0 Bugfixes and better error reporting for yesod devel 2012-02-11 03:56:07 +01:00
Greg Weber
c782b9a8ba READMED: add --clean, improve cabal-dev 2012-02-10 13:27:30 -08:00
Luite Stegeman
b5b27f2b15 Make session storage configurable 2012-02-10 19:22:31 +01:00
Hiromi Ishii
3a7d5d3a05 Modified expose list. 2012-02-03 18:29:08 +09:00
Hiromi Ishii
d68d7b0d72 * Hide the constructor of 'OAuth' and make it an instance of 'Default' instead.
* Added compatibility modules for ResourceIO data types.
* Modified 'authorizeUrl' and added 'authorizeUrl'' function. thx!>darrint
2012-02-02 20:39:09 +09:00
Michael Snoyman
b631fa4a02 conduit 0.2 2012-01-29 07:50:29 +02:00
Michael Snoyman
32c76842f1 authenticate-kerberos 2012-01-24 04:57:46 +02:00
Michael Snoyman
3d1be6132e authenticate-oauth 2012-01-24 04:52:48 +02:00
Michael Snoyman
acdc3d52ec Beginning of megarepo 2012-01-24 04:47:58 +02:00
Michael Snoyman
22f331b726 Removed Facebook 2012-01-24 04:38:58 +02:00
Michael Snoyman
35b7cf61c2 Keep cabal quiet 2012-01-19 19:25:10 +02:00
Michael Snoyman
3faeb28164 cabal 2012-01-18 14:00:02 +02:00
Michael Snoyman
09d4081079 Use newer http-conduit 2012-01-18 12:40:28 +02:00
Michael Snoyman
e1a2d68cdd Bump http-conduit version 2012-01-15 12:21:12 +02:00
Michael Snoyman
07a408951b Fix all warnings 2012-01-10 12:13:26 +02:00
Michael Snoyman
2a903feca1 All functions take Manager (where relevant) 2012-01-09 16:07:30 +02:00
Michael Snoyman
36d811c582 cabal file cleanup 2012-01-09 15:22:52 +02:00
Michael Snoyman
262d06e045 Version bump 2012-01-06 13:21:52 +02:00
Michael Snoyman
5a4c6325b0 http-conduit 1.1 2012-01-06 13:20:10 +02:00
Michael Snoyman
6bff24868f Merge pull request #4 from konn/master
Modification for pull request #3
2012-01-01 00:05:16 -08:00
Hiromi Ishii
e33b3a8efb added newOAuth and newCredential 2012-01-01 15:04:19 +09:00
Michael Snoyman
38c1fba4f0 Merge pull request #3 from qzchenwl/master
Add optional realm support for OAuth
2011-12-30 00:21:15 -08:00
Michael
1e095162d0 http-conduit queryString change 2011-12-29 13:38:26 +02:00
Michael Snoyman
dca8501d7f Move to conduits 2011-12-27 23:40:30 +02:00
Chen Wenlong
69823a20aa remove realm from filter list 2011-12-23 16:06:35 +08:00
Chen Wenlong
c3a3ba3930 add optional realm for OAuth 2011-12-23 00:34:11 +08:00
Chen Wenlong
3891e66164 fix realm empty string 2011-12-20 22:47:25 +08:00
Chen Wenlong
23a8c303f4 add empty realm field to header 2011-12-20 22:42:34 +08:00
Michael
88c14135b3 Switch repo location to yesodweb 2011-12-19 17:11:00 +02:00
Michael
5f40e44370 Merge remote branch 'yesodweb/master' 2011-12-19 17:10:09 +02:00
Michael Snoyman
b8e1d97064 Merge pull request #15 from qzchenwl/master
Add query `oauth_callback` to authorizeUrl
2011-12-19 07:07:43 -08:00
Michael Snoyman
36d52cce76 Merge pull request #2 from meteficha/facebook-logout
Facebook logout support.
2011-12-19 07:01:12 -08:00
Chen Wenlong
d244e03c79 add "oauth_callback" query to authorizeUrl 2011-12-19 22:21:52 +08:00
Felipe Lessa
2df6650172 Add getLogoutUrl to Facebook. 2011-12-19 09:49:11 -02:00
Michael Snoyman
717d4deda5 Avoid ++ 2011-12-02 11:36:43 +02:00
Michael Snoyman
3b9f45b1c1 Merge branch 'master' of https://github.com/rianhunter/authenticate 2011-12-02 11:34:14 +02:00
Michael Snoyman
fd129fce1a aeson 0.4 2011-12-01 12:43:26 +02:00
Rian Hunter
db89e940a5 Add new functions, getForwardUrlWithState that takes an extra state query arg for authenticating with facebook, also getForwardUrlParams that takes arbitrary query params for future-proofing 2011-11-29 15:31:58 -08:00
Michael Snoyman
0d4d377c8e Relaxed upper bounds 2011-11-27 15:50:14 +02:00
Michael Snoyman
7e7d3e6437 aeson-native => aeson 2011-11-27 15:37:54 +02:00
Michael Snoyman
6ff0292ce2 tls bump 2011-10-11 12:05:14 +02:00
Michael Snoyman
360896e113 Removed spurious print 2011-09-11 08:51:29 +03:00
Michael Snoyman
153e52b85b Fix for http-enum 0.7 2011-09-05 19:56:57 +03:00
Michael Snoyman
53933b3b8e xml/http-enumerator bumps 2011-09-05 19:17:03 +03:00
Michael Snoyman
084f118ff1 Version bump 2011-08-29 09:23:40 +03:00
Michael Snoyman
c20fc1fa3c Remove warnings 2011-08-28 12:38:48 +03:00
Michael Snoyman
fdd279583e Added source-repository 2011-08-28 09:59:18 +03:00
Hiromi Ishii
0d7c6a222b Merge branch 'master' of git://github.com/snoyberg/authenticate into proposed 2011-08-25 11:32:53 +09:00
Michael Snoyman
a32a2b284e Version bump 2011-08-23 08:18:03 +03:00
Michael Snoyman
4c60715026 process bump 2011-08-22 23:18:42 +03:00
Michael Snoyman
a4bfbdae2c time bump 2011-08-19 08:35:20 +03:00
Michael Snoyman
d1f54b23d2 Version bump 2011-08-18 15:57:49 +03:00
Michael Snoyman
eddb9bb082 Merge pull request #12 from Tarrasch/master
Addition of Kerberos module
2011-08-17 09:59:03 -07:00
Arash Rouhani
36b2221b81 version bump 2011-08-14 23:56:12 +02:00
Arash Rouhani
bb20bd8c67 Updated authors 2011-08-14 21:26:31 +02:00
Arash Rouhani
0a653feba4 Added Kerberos source file and added to modules 2011-08-14 21:25:27 +02:00
Arash Rouhani
e3afa5ad33 Added process to build depends 2011-08-14 21:24:04 +02:00
Michael Snoyman
1f866e0972 tagsoup version bump 2011-07-24 15:47:15 +03:00
Michael Snoyman
925c2df506 BrowserID: Switch from GET to POST 2011-07-24 07:13:12 +03:00
Michael Snoyman
a25be7d884 Version bump 2011-07-21 18:04:32 +03:00
Michael Snoyman
5e3ae824da Added BrowserId support 2011-07-21 18:03:59 +03:00
Michael Snoyman
a713f6af2d Remove qsUrl and utf8-string 2011-07-19 17:57:31 +03:00
Michael Snoyman
e2eee534c1 OpenId uses xml-enumerator and tagsoup 2011-07-19 17:44:53 +03:00
Michael Snoyman
655ab103fd openid sample works with newest Yesod 2011-07-19 15:29:44 +03:00
Hiromi Ishii
ab087a3e38 FIXED: fixed applying hook twice 2011-07-15 21:54:52 +09:00
Michael Snoyman
dffd1e8d40 case-insensitive bump 2011-07-15 08:32:54 +03:00
Hiromi Ishii
588cf6ab58 - Changed to include "oauth_callback" only in the temporary credential phase.
- Proxy & Scope parameter support in OAuth by hook (thx!> pqwy & himura).
2011-07-15 01:14:41 +09:00
Hiromi Ishii
e762a42f23 Pulled some requests 2011-07-14 19:51:43 +09:00
Takahiro HIMURA
e598a9fcbb Added Proxy support to OAuth client 2011-07-11 22:02:00 +09:00
Michael Snoyman
0711268650 Version bump 2011-06-21 20:45:46 +03:00
Michael Snoyman
ad2d05934d Merge pull request #9 from konn/master
Fixed the problem in getAccessToken
2011-06-21 10:45:00 -07:00
Hiromi Ishii
050cdcd350 modified filtering method 2011-06-22 02:32:30 +09:00
Michael Snoyman
07a0863150 Version bump 2011-06-21 10:10:55 +03:00
Michael Snoyman
2bd593fe89 Merge pull request #8 from konn/master
Fixed Two bugs in OAuth
2011-06-21 00:09:39 -07:00
Hiromi Ishii
2a8de3c35c changed how to render the Authentication Header 2011-06-21 04:23:15 +09:00
Hiromi Ishii
5bb9932919 removed redundant import 2011-06-21 03:12:19 +09:00
Hiromi Ishii
d9be899bf5 Fiexed bug: cannot escape request including multi-byte sequence correctly 2011-06-21 03:10:16 +09:00
Michael Snoyman
b06c4f5428 Dependency bump 2011-06-19 12:07:02 +03:00
Michael Snoyman
df24f34775 Fixed rpxnow JSON code 2011-06-13 07:04:53 +03:00
Michael Snoyman
56d84c5d8b Missing records in Rpxnow module 2011-06-12 20:09:53 +03:00
Michael Snoyman
ea33d8e8ac Fixed facebook tokens 2011-06-10 08:25:45 +03:00
Michael Snoyman
0c0b133446 Version bump 2011-06-09 16:51:21 +03:00
Michael Snoyman
4c0a704bb9 Merge pull request #7 from konn/master
Changed to see Response Status
2011-06-09 06:50:38 -07:00
Michael Snoyman
5e59d0165f Version bump 2011-06-09 16:36:56 +03:00
Michael Snoyman
6232f52aa0 Fix Facebook code 2011-06-09 16:36:34 +03:00
Hiromi Ishii
6b63940345 changed to see Response Status 2011-05-19 20:58:09 +09:00
Hiromi Ishii
f3d305506c changed to see Response Status 2011-05-19 20:53:09 +09:00
Michael
f3997728f6 Version bump 2011-05-02 15:35:27 +03:00
Michael Snoyman
47317556a9 Merged pull request #5 from MichaelXavier/master.
Decoupling OAuth signing from the request
2011-04-27 21:47:40 -07:00
Michael Xavier
480d6d3410 Add genSign to OAuth exports
This decouples the signing process from Requests a bit. Some services
require the signature to be somwehere other than in request headers,
such as in url parameters. Exposing genSign solves this.
2011-04-27 21:25:50 -07:00
Michael Snoyman
705528277c OpenId uses Text 2011-04-07 23:04:34 +03:00
Michael Snoyman
72281c7fa0 Export AccessToken 2011-04-07 22:28:37 +03:00
Michael Snoyman
35b3e31a45 Drop wai-extra dependency 2011-04-05 00:37:15 +03:00
Michael Snoyman
5fa2e390c1 http-enumerator 0.6 2011-04-05 00:35:00 +03:00
Michael Snoyman
bd9ea53ea8 Move Facebook to Text 2011-04-01 11:20:48 +03:00
Michael Snoyman
572df52d03 http-enumerator 0.5 2011-03-28 07:22:53 +02:00
Michael Snoyman
fb9ec3c412 Migrate to aeson 2011-03-28 06:41:09 +02:00
Michael Snoyman
5ca48e8524 Version bump 2011-03-10 10:06:55 +02:00
Hiromi Ishii
ae8e028117 Changed to specify oauth_version parameter everytime (measure for Twitter's Streaming API) 2011-03-10 15:23:49 +09:00
Michael Snoyman
eac9ea6e41 Version bump 2011-03-09 21:32:09 +02:00
Greg Weber
fad6d1bd3c allow time-1.2 2011-03-09 11:24:59 -08:00
Michael Snoyman
0b09a4f66b Added getTokenCredential = getAccessToken 2011-03-09 17:53:59 +02:00
Hiromi Ishii
4d87d3b2c6 Fixed Haddock notation in OAuth 2011-03-07 17:04:21 +09:00
Hiromi Ishii
db6f72995d Added OAuth Client Support 2011-03-07 16:57:10 +09:00
Michael Snoyman
39611958d0 Proper support for OP identifiers in Yadis 2011-02-07 06:56:53 +02:00
Michael Snoyman
d32d16b693 Remove Realm and Params function names in OpenId 2010-12-26 05:51:22 +02:00
Michael Snoyman
d7c19fb6ae Jeremy Shaw's error handling patch 2010-12-26 05:49:37 +02:00
Michael Snoyman
800283dcc6 http-enumerator 0.3 2010-12-26 05:49:37 +02:00
Michael Snoyman
6615274cc8 getForwardUrlRealm and authenticateParams 2010-12-23 11:26:54 +02:00
Michael Snoyman
a38000b2f3 Fixed myspace 2010-12-23 08:10:32 +02:00
Michael Snoyman
772afa0224 tagsoup 0.12 2010-12-13 23:34:35 +02:00
Michael Snoyman
5f68cf25e5 network 2.3 2010-11-11 19:44:05 +02:00
Michael Snoyman
40e75f625b Type signatures for Providers 2010-10-29 08:12:57 +02:00
Michael Snoyman
752abf0cd1 Web.Authenticate.OpenId.Providers 2010-10-24 10:58:57 +02:00
Michael Snoyman
221ee0ad17 Deriving more instances- from Jeremy Shaw 2010-10-23 19:33:52 +02:00
Michael Snoyman
b901357db4 Warnings 2010-10-10 10:20:57 +02:00
Michael Snoyman
0571daf1ff Consolidated exception types 2010-10-07 23:34:18 +02:00
Michael Snoyman
a2eb422a2a Cap YADIS redirects to 10 2010-10-06 19:59:47 +02:00
Michael Snoyman
e0011ad2b5 Prevent endless YADIS-redirect loop 2010-10-06 05:55:25 +02:00
Michael Snoyman
63853a78df Proper exception propogation 2010-10-05 11:16:42 +02:00
Michael Snoyman
48f31ed6de Merged OpenId and OpenId2 2010-10-05 11:11:35 +02:00
Michael Snoyman
6e575cf027 OpenID 1 support built into OpenID 2 code 2010-10-05 11:02:49 +02:00
Michael Snoyman
0da51855ec Slimmed down code 2010-10-05 09:10:50 +02:00
Michael Snoyman
17b5406fce OpenID v2 support.
All of the heavy lifting was taken directly from the openid package, and
lives in the OpenId2.* module hierarchy. The difference here is that we
don't use associations at all, removing the need for some hefty
dependencies. I've also gutted MonadLib dependencies.
2010-10-05 08:37:04 +02:00
Michael Snoyman
2a65b1f016 Checking openid.mode=id_res 2010-10-04 07:21:10 +02:00
Michael Snoyman
d6f0d2ee09 OpenID uses same qsEncode as Facebook 2010-10-04 07:12:59 +02:00
Michael Snoyman
d742893f04 Percent encoding for Facebook 2010-10-04 07:05:53 +02:00
Michael Snoyman
bdb6f2011f MissingVar for OpenID 2010-10-03 09:59:41 +02:00
Michael Snoyman
7ebf584f52 Migrate to http-enumerator 2010-09-28 14:23:20 +02:00
Michael Snoyman
8227bb17a9 tagsoup 0.11 2010-09-28 11:24:18 +02:00
Michael Snoyman
0d34332182 Some extra deriving of typeclasses 2010-06-29 09:36:33 +03:00
Michael Snoyman
b05722e218 A working Facebook API and simple sample application 2010-06-25 15:07:12 +03:00
Michael Snoyman
4c00bd2058 Switch to data-object-json 2010-05-13 23:33:38 +03:00
Michael Snoyman
a8800d61d7 Bumped tagsoup 2010-05-09 22:46:26 +03:00
Michael Snoyman
4590d4afad Add back transformers 0.1 support 2010-04-25 11:12:56 -07:00
Michael Snoyman
59753521a2 transformers 0.2 2010-04-11 13:20:04 -07:00
Michael Snoyman
ad243856a2 Allow tagsoup 0.8 2010-02-09 17:20:03 +02:00
Michael Snoyman
cb7bdb6567 c-m-f to failure 2009-12-06 00:43:24 +02:00
Michael Snoyman
83d2d25d34 Migration to control-monad-failure 2009-11-13 15:13:36 +02:00
Michael Snoyman
e60354ebe1 data -> newtype for Identifier 2009-10-25 22:59:05 +02:00
Michael Snoyman
9fe332dc33 Switch to MonadAttempt for error handling 2009-10-21 00:58:34 +02:00
Michael Snoyman
edd163da33 Formatted README a bit 2009-07-14 20:52:09 +03:00
dbpatterson
1b55ea26ee troubleshooting info for Rpxnow 2009-07-12 17:21:55 -04:00
Michael Snoyman
1f3d9e8791 Removed the (Either String) monad instance for better interop with mtl 2009-06-01 23:24:28 +03:00
Snoyman
c856808955 Added link to github page in cabal file 2009-05-08 13:21:01 +03:00
Snoyman
d920705bde Added openid authentication 2009-05-08 10:29:35 +03:00
Snoyman
082e3241c7 Rpxnow module written. 2009-05-08 09:08:46 +03:00
Snoyman
3ef8cc642d initial commit 2009-05-08 06:39:35 +03:00
413 changed files with 28957 additions and 11621 deletions

29
.github/ISSUE_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,29 @@
<!---
### Bug Reports
Reporting a bug? If relevant, we recommend including:
* Your OS name and version
* The versions of tools you're using (e.g. `stack`, `yesod` `ghc`).
* The versions of dependencies you're using
For your convenience, we recommend pasting this script into bash and uploading the output [as a gist](https://gist.github.com/).
```
command -v sw_vers && sw_vers # OS X only
command -v uname && uname -a # Kernel version
command -v stack && stack --version
command -v stack && stack ghc -- --version
command -v stack && stack ls dependencies
command -v yesod && yesod version
```
* Also, is there anything custom or unusual about your setup? i.e. new or prerelease versions of GHC, stack, etc.
* Finally, if possible, please reproduce the error in a small script, or if necessary create a new Github repo with the smallest possible reproducing case. [Stack's scripting support](https://docs.haskellstack.org/en/stable/GUIDE/#script-interpreter) might be useful for creating your reproduction example.
### Support
Please direct support questions to [Stack Overflow](https://stackoverflow.com/questions/tagged/yesod+haskell) or the [Yesod Google Group](https://groups.google.com/forum/#!forum/yesodweb). If you don't get a response there, or you suspect there may be a bug in Yesod causing your problem, you're welcome to ask here.
-->

14
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,14 @@
Before submitting your PR, check that you've:
- [ ] Bumped the version number
- [ ] Documented new APIs with [Haddock markup](https://www.haskell.org/haddock/doc/html/index.html)
- [ ] Added [`@since` declarations](http://haskell-haddock.readthedocs.io/en/latest/markup.html#since) to the Haddocks for new, public APIs
After submitting your PR:
- [ ] Update the Changelog.md file with a link to your PR
- [ ] Check that CI passes (or if it fails, for reasons unrelated to your change, like CI timeouts)
<!---Thanks so much for contributing! :)
_If these checkboxes don't apply to your PR, you can delete them_-->

56
.github/workflows/tests.yml vendored Normal file
View File

@ -0,0 +1,56 @@
name: Tests
on:
pull_request:
push:
branches:
- master
jobs:
build:
name: CI
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
args:
#- "--resolver nightly"
- "--resolver nightly-2022-02-11"
- "--resolver lts-18"
- "--resolver lts-16"
- "--resolver lts-14"
- "--resolver lts-12"
- "--resolver lts-11"
# Bugs in GHC make it crash too often to be worth running
exclude:
- os: windows-latest
args: "--resolver nightly"
- os: macos-latest
args: "--resolver lts-16"
- os: macos-latest
args: "--resolver lts-14"
- os: macos-latest
args: "--resolver lts-12"
- os: macos-latest
args: "--resolver lts-11"
steps:
- name: Clone project
uses: actions/checkout@v2
# Getting weird OS X errors...
# - name: Cache dependencies
# uses: actions/cache@v1
# with:
# path: ~/.stack
# key: ${{ runner.os }}-${{ matrix.resolver }}-${{ hashFiles('stack.yaml') }}
# restore-keys: |
# ${{ runner.os }}-${{ matrix.resolver }}-
- name: Build and run tests
shell: bash
run: |
set -ex
stack --version
stack test --fast --no-terminal ${{ matrix.args }}

23
.gitignore vendored
View File

@ -1,8 +1,29 @@
*~
*.o
*.o_p
*.hi
dist
dist/
dist-stack/
stack.yaml.lock
.stack-work
*.swp
client_session_key.aes
cabal-dev/
yesod/foobar/
.hsenv/
.cabal-sandbox/
cabal.sandbox.config
/vendor/
.shelly/
tarballs/
# useful when mounting into docker
.cabal
.ghc
.stackage
.bash_history
# OS X
.DS_Store
*.yaml.lock
dist-newstyle/

18
.gitmodules vendored
View File

@ -1,18 +0,0 @@
[submodule "scripts"]
path = scripts
url = git://github.com/yesodweb/scripts.git
[submodule "authenticate"]
path = authenticate
url = https://github.com/yesodweb/authenticate.git
[submodule "http-conduit"]
path = http-conduit
url = https://github.com/snoyberg/http-conduit
[submodule "xml"]
path = xml
url = https://github.com/snoyberg/xml
[submodule "crypto-conduit"]
path = crypto-conduit
url = https://github.com/snoyberg/crypto-conduit
[submodule "yaml"]
path = yaml
url = https://github.com/snoyberg/yaml

74
CODE_OF_CONDUCT.md Normal file
View File

@ -0,0 +1,74 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
education, socio-economic status, nationality, personal appearance, race,
religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at `michael at snoyman dot com`. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org

95
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,95 @@
# Contributing
Thanks for your interest in contributing to Yesod! This file has some tips for developing Yesod and getting a pull request accepted.
## Development
Yesod is a mega-repo that contains many Haskell packages, each in a different directory. All the subprojects can be developed with Stack, using `stack <command> <subproject>`, e.g.
* `stack build yesod-form`
* `stack test yesod-auth`
* `stack haddock yesod-websockets`
If you'd like to test your changes in a full-fledged Yesod app, you can use Stack to build against it, e.g.:
```
packages:
- '/path/to/this/repo/yesod-auth'
```
## Coding Guidelines
### Safety
Avoid partial functions. Even if you know the partial function is safe in your instance, partial functions require more reasoning from the programmer and are not resilient to refactoring. For the rare cases where a partial function is appropriate, a custom `error` should be used.
### Style
Keep coding style consistent with the rest of the file, but don't worry about style too much otherwise. PRs changing code style are viewed skeptically.
### Dependencies
Avoid adding unnecessary dependencies. If a dependency provides only a minor convenience for your implementation, it's probably better to skip it.
If you do add a new dependency, try to support a wide range of versions of it.
### Backwards Compatibility
Backwards incompatible changes are viewed skeptically—best to ask in an issue to see if a particular backwards incompatible change would be approved. If possible keep backwards compatibility by adding new APIs and deprecating old ones.
Keep backwards compatibility with old versions of dependencies when possible.
## PR Guidelines
### PR Scope
As much as possible, keep separate changes in separate PRs.
### Testing
Tests are recommended, but not required.
### Documentation
All public APIs must be documented. Documenting private functions is optional, but may be nice depending on their complexity. Example documentation:
```
-- | Looks up the hidden input named "_token" and adds its value to the params.
--
-- ==== __Examples__
--
-- > request $ do
-- > addToken_ "#formID"
--
-- @since 1.5.4
addToken_ :: Query -- ^ CSS selector that resolves to the @<form>@ containing the token.
-> RequestBuilder site ()
```
Examples are recommended, but not required, in documentation. Marking new APIs with `@since <version number>` is required.
### Versioning
Yesod packages roughly follow the Haskell Package Versioning Policy style of A.B.C.[D] (MAJOR.MAJOR.MINOR.[PATCH])
* A - Used for massive changes in the library. (Example: 1.2.3.4 becomes 2.0.0)
* B - Used for smaller breaking changes, like removing, renaming, or changing behavior of existing public API. (Example: 1.2.3.4 becomes 1.3.0)
* C - Used for new public APIs (Example: 1.2.3.4 becomes 1.2.4)
* D - Used for bug fixes (Example: 1.2.3.4 becomes 1.2.3.5).
* D is optional in the version number, so 2.0.0 is a valid version.
Documentation changes don't require a new version.
If you feel there is ambiguity to a change (e.g. fixing a bug in a function, when people may be relying on the old broken behavior), you can ask in an issue or pull request.
Unlike in the Package Versioning Policy, deprecations are not counted as MAJOR changes.
In some cases, dropping compatibility with a major version of a dependency (e.g. changing from transformers >= 0.3 to transformers >= 0.4), is considered a breaking change.
### Changelog
After you submit a PR, update the subproject's Changelog.md file with the new version number and a link to your PR. If your PR does not need to bump the version number, include the change in an "Unreleased" section at the top.
### Releases
Releases should be done as soon as possible after a pull request is merged—don't be shy about reminding us to make a release if we forget.

36
Dockerfile Normal file
View File

@ -0,0 +1,36 @@
FROM haskell:7.10
MAINTAINER Greg Weber
# Intended as a development environment
#
# docker build -t yesod .
# docker run --rm -i -t -v `pwd`:/home/haskell yesod /bin/bash
# stackage update
#
RUN apt-get update && apt-get install sudo \
# ssl stuff that you may find useful
&& apt-get install -y libssl-dev ca-certificates libcurl4-openssl-dev \
# stackage-cli uses git. authbind can be useful for exposing ports
&& apt-get install -y git authbind \
&& apt-get clean
# run as a user named "haskell"
RUN useradd -m -d /home/haskell -s /bin/bash haskell
RUN mkdir -p /etc/sudoers.d && echo "haskell ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/haskell && chmod 0440 /etc/sudoers.d/haskell
ENV HOME /home/haskell
WORKDIR /home/haskell
USER haskell
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
# install stackage binaries to /opt/stackage
RUN sudo mkdir -p /opt/stackage/bin
ENV PATH /opt/stackage/bin:.cabal-sandbox/bin:.cabal/bin:$PATH:./
RUN sudo chown haskell:haskell /opt/stackage/bin
RUN cabal update \
&& cabal install stackage-update && stackage-update \
&& cabal install stackage-install \
&& stackage-install stackage-cli stackage-cabal stackage-sandbox stackage-upload \
&& mv /home/haskell/.cabal/bin/* /opt/stackage/bin/ \
&& rm -r /home/haskell/.cabal

39
LICENSE
View File

@ -1,25 +1,20 @@
The following license covers this documentation, and the source code, except
where otherwise indicated.
Copyright (c) 2012-2017 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.

138
README.md
View File

@ -1,3 +1,7 @@
![Tests](https://github.com/yesodweb/yesod/workflows/Tests/badge.svg)
# Yesod Web Framework
An advanced web framework using the Haskell programming language. Featuring:
* safety & security guaranteed at compile time
@ -7,119 +11,51 @@ An advanced web framework using the Haskell programming language. Featuring:
* techniques for constant-space memory consumption
* asynchronous IO
* 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/
## Getting Started
## Installation: http://www.yesodweb.com/page/five-minutes
Learn more about Yesod on [its main website](http://www.yesodweb.com/). If you
want to get started using Yesod, we strongly recommend the [quick start
guide](http://www.yesodweb.com/page/quickstart), based on [the Haskell build
tool stack](https://github.com/commercialhaskell/stack#readme).
cabal update && cabal install yesod
Here's a minimal example!
## Create a new project after installing
```haskell
{-# LANGUAGE OverloadedStrings, QuasiQuotes, TemplateHaskell, TypeFamilies #-}
yesod init
import Yesod
data App = App -- Put your config, database connection pool, etc. in here.
## Using cabal-dev
-- Derive routes and instances for App.
mkYesod "App" [parseRoutes|
/ HomeR GET
|]
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.
instance Yesod App -- Methods in here can be overridden as needed.
Use `yesod-devel --dev` when developing your application.
-- The handler for the GET request at /, corresponds to HomeR.
getHomeR :: Handler Html
getHomeR = defaultLayout [whamlet|Hello World!|]
## Installing the latest development version from github
main :: IO ()
main = warp 3000 App
```
Yesod is broken up into 4 separate code repositories each built upon many smaller packages.
To read about each of the concepts in use above (routing, handlers,
linking, JSON), in detail, visit
[Basics in the Yesod book](https://www.yesodweb.com/book/basics#basics_routing).
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.
## Hacking on Yesod
Please note that cabal-dev will not work in a virthualenv shell - you can't use both at the same time.
Yesod consists mostly of four repositories:
### virthualenv
```bash
git clone --recurse-submodules http://github.com/yesodweb/shakespeare
git clone --recurse-submodules http://github.com/yesodweb/persistent
git clone --recurse-submodules http://github.com/yesodweb/wai
git clone --recurse-submodules http://github.com/yesodweb/yesod
```
virthualenv will not work on Windows - Windows users should use only cabal-dev.
To just install Yesod from github, we only need cabal-dev. However, cabal-dev may be more hassle than it is worth when hacking on Yesod.
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.
virthualenv creates an isolated environment like cabal-dev.
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
virthualenv works at the shell level, so every shell must activate the virthualenv.
### cabal-src
Michael Snoyman just released the cabal-src tool, which helps resolve dependency conflicts when installing local packages.
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.
### Building Yesod
~~~ { .bash }
# update your package database if you haven't recently
cabal update
# install required libraries
cabal install Cabal cabal-install cabal-src virthualenv
# clone and install all repos
# see below about first using virthualenv before running ./scripts/install
for repo in hamlet persistent wai yesod; do
git clone http://github.com/yesodweb/$repo
(
cd $repo
git submodule update --init
./scripts/install
)
done
~~~
### Hacking on Yesod
To prevent Yesod from conflicting with your other installs, you should use virthualenv, although it is optional.
#### virthualenv
~~~ { .bash }
cabal update
cabal install virthualenv
cd yesodweb # the folder where you put the yesod, persistent, hamlet & wai repos
virthualenv --name=yesod
. .virthualenv/bin/activate
~~~
#### individual cabal packages
~~~ { .bash }
# install and test all packages
./scripts/install
# move to the individual package you are working on
cd shakespeare-text
# build and test the individual package
cabal configure -ftest --enable-tests
cabal build
cabal test
~~~
#### cabal-dev
cabal-dev works very well if you are working on a single package, but it can be very cumbersome to work on multiple packages at once.
### 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 `cabal-dev install` to retrieve these packages.
cd to your application directory, and the reference the source list.
~~~ { .bash }
cabal-dev install /path/to/yesodweb/yesod/*(/)
~~~
Each repository can be built with `stack build`.

View File

@ -1,12 +0,0 @@
Yesod 0.10
=======================
* Replace lift with liftHandler and liftWidget
* No more GGHandler or GGWidget
* No more liftIOHandler
* Enumerators are gone, in come conduits, now you can catch exceptions!
* Move from pool to resource-pool
* Rework of the redirect system
* Configure database parameters via environment variables.
* Fully reworked routing, much more efficient.
* Cleaned up EntityDef, making it more resilient to renamings.

15
cabal.project Normal file
View File

@ -0,0 +1,15 @@
packages:
yesod-core
yesod-static
yesod-persistent
yesod-newsfeed
yesod-form
yesod-form-multi
yesod-auth
yesod-auth-oauth
yesod-sitemap
yesod-test
yesod-bin
yesod
yesod-eventsource
yesod-websockets

60
demo/appcache/AppCache.hs Normal file
View File

@ -0,0 +1,60 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
module AppCache where
import Control.Monad (when)
import Control.Monad.Trans.Writer
import Data.Hashable (hashWithSalt)
import Data.List (intercalate)
import qualified Data.Set as Set
import Data.Text (Text)
import Data.Text (pack)
import Language.Haskell.TH.Syntax
import Yesod.Core
import Yesod.Routes.TH
newtype AppCache = AppCache { unAppCache :: Text }
appCache :: [ResourceTree String] -> Q Exp
appCache trees = do
piecesSet <- execWriterT $ mapM_ (goTree id) trees
let body = unlines $ map toPath $ Set.toList piecesSet
hash = hashWithSalt 0 body
total = concat
[ "CACHE MANIFEST\n# Version: "
, show hash
, "\n\nCACHE:\n"
, body
]
[|return (AppCache (pack total))|]
where
toPath [] = "/"
toPath x = concatMap ('/':) x
goTree :: Monad m
=> ([String] -> [String])
-> ResourceTree String
-> WriterT (Set.Set [String]) m ()
goTree front (ResourceLeaf res) = do
pieces' <- goPieces (resourceName res) $ resourcePieces res
when ("CACHE" `elem` resourceAttrs res) $
tell $ Set.singleton $ front pieces'
goTree front (ResourceParent name pieces trees) = do
pieces' <- goPieces name pieces
mapM_ (goTree $ front . (pieces' ++)) trees
goPieces :: Monad m => String -> [(CheckOverlap, Piece String)] -> m [String]
goPieces name =
mapM (goPiece . snd)
where
goPiece (Static s) = return s
goPiece (Dynamic _) = fail $ concat
[ "AppCache only applies to fully-static paths, but "
, name
, " has dynamic pieces."
]
instance ToContent AppCache where
toContent = toContent . unAppCache
instance ToTypedContent AppCache where
toTypedContent = TypedContent "text/cache-manifest" . toContent

23
demo/appcache/Main.hs Normal file
View File

@ -0,0 +1,23 @@
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
import AppCache
import Routes
import Yesod.Core
instance Yesod App
mkYesodDispatch "App" resourcesApp
getHomeR :: Handler String
getHomeR = return "Hello"
getSomethingR :: Handler String
getSomethingR = return "Hello"
getAppCacheR :: Handler AppCache
getAppCacheR = $(appCache resourcesApp)
main :: IO ()
main = warp 3000 App

15
demo/appcache/Routes.hs Normal file
View File

@ -0,0 +1,15 @@
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
module Routes where
import Yesod.Core
data App = App
mkYesodData "App" [parseRoutes|
/ HomeR GET
/some/thing SomethingR GET !CACHE
/appcache AppCacheR GET
|]

View File

@ -0,0 +1,2 @@
accessKey: <your access key>
secretKey: <your secret key>

View File

@ -0,0 +1,205 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE OverloadedStrings #-}
import Control.Monad (join)
import Control.Monad.Logger (runNoLoggingT)
import Data.Maybe (isJust)
import Data.Yaml
import Data.Text (Text)
import qualified Data.Text.Encoding as TE
import qualified Data.Text.Lazy.Encoding as LTE
import Database.Persist.Sqlite
import Database.Persist.TH
import Network.Mail.Mime
import Text.Blaze.Html.Renderer.Utf8 (renderHtml)
import Text.Shakespeare.Text (stext)
import Yesod
import Yesod.Auth
import Yesod.Auth.Email
import Network.Mail.Mime.SES
import Data.ByteString.Char8
import Control.Monad (mzero)
import Network.HTTP.Client.Conduit (Manager, newManager, HasHttpManager (getHttpManager))
import System.Exit (exitWith, ExitCode( ExitFailure ))
share [mkPersist sqlSettings { mpsGeneric = False }, mkMigrate "migrateAll"] [persistLowerCase|
User
email Text
password Text Maybe -- Password may not be set yet
verkey Text Maybe -- Used for resetting passwords
verified Bool
UniqueUser email
|]
data App = App
{ sqlBackend :: SqlBackend
, appHttpManager :: Manager
}
instance HasHttpManager App where
getHttpManager = appHttpManager
mkYesod "App" [parseRoutes|
/ HomeR GET
/auth AuthR Auth getAuth
|]
instance Yesod App where
-- Emails will include links, so be sure to include an approot so that
-- the links are valid!
approot = ApprootStatic "http://localhost:3000"
instance RenderMessage App FormMessage where
renderMessage _ _ = defaultFormMessage
-- Set up Persistent
instance YesodPersist App where
type YesodPersistBackend App = SqlBackend
runDB f = do
App conn _ <- getYesod
runSqlConn f conn
instance YesodAuth App where
type AuthId App = UserId
loginDest _ = HomeR
logoutDest _ = HomeR
authPlugins _ = [authEmail]
-- Need to find the UserId for the given email address.
getAuthId creds = runDB $ do
x <- insertBy $ User (credsIdent creds) Nothing Nothing False
return $ Just $
case x of
Left (Entity userid _) -> userid -- newly added user
Right userid -> userid -- existing user
authHttpManager = error "Email doesn't need an HTTP manager"
instance YesodAuthPersist App
-- Here's all of the email-specific code
data SesKeys = SesKeys { accessKey :: !Text, secretKey :: !Text }
instance FromJSON SesKeys where
parseJSON (Object v) =
SesKeys <$> v .: "accessKey"
<*> v .: "secretKey"
parseJSON _ = mzero
instance YesodAuthEmail App where
type AuthEmailId App = UserId
afterPasswordRoute _ = HomeR
addUnverified email verkey =
runDB $ insert $ User email Nothing (Just verkey) False
-- Send the verification email with your SES credentials located in config/secrets.yaml
-- NOTE: The email address you're sending from will have to be verified on SES
sendVerifyEmail email _ verurl = do
h <- getYesod
sesCreds <- liftIO $ getSESCredentials
liftIO $ renderSendMailSES (getHttpManager h) sesCreds (emptyMail $ Address Nothing "noreply@example.com")
{ mailTo = [Address Nothing email]
, mailHeaders =
[ ("Subject", "Verify your email address")
]
, mailParts = [[textPart, htmlPart]]
}
where
getSESCredentials :: IO SES
getSESCredentials = do
key <- getsesAccessKey
return SES {
sesTo = [(TE.encodeUtf8 email)],
sesFrom = "noreply@example.com",
sesAccessKey = TE.encodeUtf8 $ accessKey key,
sesSecretKey = TE.encodeUtf8 $ secretKey key,
sesRegion = usWest2 }
getsesAccessKey :: IO SesKeys
getsesAccessKey = do
ymlConfig <- Data.ByteString.Char8.readFile "config/secrets.yaml"
case decode ymlConfig of
Nothing -> do Data.ByteString.Char8.putStrLn "Error while parsing secrets.yaml"; System.Exit.exitWith (ExitFailure 1)
Just c -> return c
textPart = Part
{ partType = "text/plain; charset=utf-8"
, partEncoding = None
, partFilename = Nothing
, partContent = LTE.encodeUtf8 $
[stext|
Please confirm your email address by clicking on the link below.
#{verurl}
Thank you
|]
, partHeaders = []
}
htmlPart = Part
{ partType = "text/html; charset=utf-8"
, partEncoding = None
, partFilename = Nothing
, partContent = renderHtml
[shamlet|
<p>Please confirm your email address by clicking on the link below.
<p>
<a href=#{verurl}>#{verurl}
<p>Thank you
|]
, partHeaders = []
}
getVerifyKey = runDB . fmap (join . fmap userVerkey) . get
setVerifyKey uid key = runDB $ update uid [UserVerkey =. Just key]
verifyAccount uid = runDB $ do
mu <- get uid
case mu of
Nothing -> return Nothing
Just u -> do
update uid [UserVerified =. True]
return $ Just uid
getPassword = runDB . fmap (join . fmap userPassword) . get
setPassword uid pass = runDB $ update uid [UserPassword =. Just pass]
getEmailCreds email = runDB $ do
mu <- getBy $ UniqueUser email
case mu of
Nothing -> return Nothing
Just (Entity uid u) -> return $ Just EmailCreds
{ emailCredsId = uid
, emailCredsAuthId = Just uid
, emailCredsStatus = isJust $ userPassword u
, emailCredsVerkey = userVerkey u
, emailCredsEmail = email
}
getEmail = runDB . fmap (fmap userEmail) . get
getHomeR :: Handler Html
getHomeR = do
maid <- maybeAuthId
defaultLayout
[whamlet|
<p>Your current auth ID: #{show maid}
$maybe _ <- maid
<p>
<a href=@{AuthR LogoutR}>Logout
$nothing
<p>
<a href=@{AuthR LoginR}>Go to the login page
|]
main :: IO ()
main = runNoLoggingT $ withSqliteConn "email.db3" $ \conn -> liftIO $ do
runSqlConn (runMigration migrateAll) conn
httpManager <- newManager
warp 3000 $ App conn httpManager

21
demo/lite/lite.hs Normal file
View File

@ -0,0 +1,21 @@
{-# LANGUAGE OverloadedStrings #-}
import Yesod.Core
import Data.Aeson
import Data.Monoid ((<>))
import Data.Text (Text, pack)
people :: [(Text, Int)]
people = [("Alice", 25), ("Bob", 43), ("Charlie", 37)]
main = warp 3000 $ liteApp $ do
onStatic "people" $ dispatchTo getPeople
onStatic "person" $ withDynamic $ dispatchTo . getPerson
getPeople = return $ toJSON $ map fst people
getPerson name =
case lookup name people of
Nothing -> notFound
Just age -> selectRep $ do
provideRep $ return $ object ["name" .= name, "age" .= age]
provideRep $ return $ name <> " is " <> pack (show age) <> " years old"

View File

@ -0,0 +1,67 @@
{-# LANGUAGE EmptyDataDecls #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
import Control.Monad.Logger (runNoLoggingT)
import Data.Conduit (awaitForever, runResourceT, ($=))
import Data.Text (Text)
import Database.Persist.Sqlite (ConnectionPool, SqlPersist,
SqliteConf (..), runMigration,
runSqlPool)
import Database.Persist.Store (createPoolConfig)
import Yesod.Core
import Yesod.Persist
share [mkPersist sqlSettings, mkMigrate "migrateAll"] [persist|
Person
name Text
|]
data App = App
{ appConfig :: SqliteConf
, appPool :: ConnectionPool
}
mkYesod "App" [parseRoutes|
/ HomeR GET
|]
instance Yesod App
instance YesodPersist App where
type YesodPersistBackend App = SqlPersist
runDB = defaultRunDB appConfig appPool
instance YesodPersistRunner App where
getDBRunner = defaultGetDBRunner appPool
getHomeR :: Handler TypedContent
getHomeR = do
runDB $ do
runMigration migrateAll
deleteWhere ([] :: [Filter Person])
insert_ $ Person "Charlie"
insert_ $ Person "Alice"
insert_ $ Person "Bob"
respondSourceDB typePlain $ selectSource [] [Asc PersonName] $= awaitForever toBuilder
where
toBuilder (Entity _ (Person name)) = do
sendChunkText name
sendChunkText "\n"
sendFlush
main :: IO ()
main = do
let config = SqliteConf ":memory:" 1
pool <- createPoolConfig config
runNoLoggingT $ runResourceT $ flip runSqlPool pool $ do
runMigration migrateAll
deleteWhere ([] :: [Filter Person])
insert_ $ Person "Charlie"
insert_ $ Person "Alice"
insert_ $ Person "Bob"
warp 3000 App
{ appConfig = config
, appPool = pool
}

View File

@ -0,0 +1,48 @@
{-# LANGUAGE OverloadedStrings, TemplateHaskell, QuasiQuotes, TypeFamilies #-}
import Yesod.Core
import Data.Conduit
import qualified Data.Conduit.Binary as CB
import Control.Concurrent.Lifted (threadDelay)
import Data.Monoid ((<>))
import qualified Data.Text as T
import Control.Monad (forM_)
data App = App
mkYesod "App" [parseRoutes|
/ HomeR GET
|]
instance Yesod App
fibs :: [Int]
fibs = 1 : 1 : zipWith (+) fibs (tail fibs)
getHomeR :: Handler TypedContent
getHomeR = do
value <- lookupGetParam "x"
case value of
Just "file" -> respondSource typePlain $ do
sendChunkText "Going to read a file\n\n"
CB.sourceFile "streaming.hs" $= awaitForever sendChunkBS
sendChunkText "Finished reading the file\n"
Just "fibs" -> respondSource typePlain $ do
forM_ fibs $ \fib -> do
$logError $ "Got fib: " <> T.pack (show fib)
sendChunkText $ "Next fib is: " <> T.pack (show fib) <> "\n"
yield Flush
sendFlush
threadDelay 1000000
_ -> fmap toTypedContent $ defaultLayout $ do
setTitle "Streaming"
[whamlet|
<p>Notice how in the code above we perform selection before starting the stream.
<p>Anyway, choose one of the options below.
<ul>
<li>
<a href=?x=file>Read a file
<li>
<a href=?x=fibs>See the fibs
|]
main = warp 3000 App

40
demo/subsite/Main.hs Normal file
View File

@ -0,0 +1,40 @@
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
module Main where
import Control.Applicative ((<$>))
import Wiki
import Yesod
-- A very simple App, doesn't do anything except provide the Wiki.
data App = App
{ appWiki :: Wiki
}
mkYesod "App" [parseRoutes|
/ HomeR GET
/wiki WikiR Wiki appWiki
|]
instance Yesod App
instance YesodWiki App -- Just use the defaults
instance RenderMessage App FormMessage where
renderMessage _ _ = defaultFormMessage
getHomeR :: Handler Html
getHomeR = defaultLayout
[whamlet|
<p>
Welcome to my test application.
The application is pretty boring.
You probably want to go to
<a href=@{WikiR WikiHomeR}>the wiki#
.
|]
main :: IO ()
main = do
app <- App <$> newWiki
warp 3000 app

147
demo/subsite/Wiki.hs Normal file
View File

@ -0,0 +1,147 @@
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
-- | Define the dispatch for a Wiki. You should probably start off by reading
-- WikiRoutes.
module Wiki
( module WikiRoutes
) where
import Control.Applicative ((<$>))
import Control.Monad (unless)
import Data.IORef.Lifted (readIORef, atomicModifyIORef)
import Data.Map (Map)
import qualified Data.Map as Map
import Data.Text (Text)
import WikiRoutes
import Yesod
-- | A subsite needs to be an instance of YesodSubDispatch, which states how to
-- dispatch. By using constraints, we can make requirements of our master site.
-- In this example, we're saying that the master site must be an instance of
-- YesodWiki.
instance YesodWiki master => YesodSubDispatch Wiki (HandlerT master IO) where
-- | This is all the TH magic for dispatch. WikiRoutes provides the
-- resourcesWiki value automatically, and mkYesodSubDispatch will generate
-- a dispatch function that will call out to the appropriate handler
-- functions.
yesodSubDispatch = $(mkYesodSubDispatch resourcesWiki)
-- | Helper type synonym to be used below.
type WikiHandler a = forall master. YesodWiki master
=> HandlerT Wiki (HandlerT master IO) a
------------- Helper functions
-- | Get all of the content in the Wiki.
getContent :: WikiHandler (Map Texts Textarea)
getContent = getYesod >>= readIORef . wikiContent
-- | Put a single new value into the Wiki.
putContent :: Texts -> Textarea -> WikiHandler ()
putContent k v = do
refMap <- wikiContent <$> getYesod
atomicModifyIORef refMap $ \m -> (Map.insert k v m, ())
-- | Gets the homepage, which lists all of the pages available.
getWikiHomeR :: WikiHandler TypedContent
getWikiHomeR = do
content <- getContent
-- We use the new selectRep/provideRep functionality to provide either an
-- HTML or JSON representation of the page. You could just as easily
-- provide YAML, plain text, RSS, or anything else.
selectRep $ do
provideRep $ do
-- We'll use toParent to convert Wiki routes into our master site
-- routes.
toParent <- getRouteToParent
-- Run the master site's defaultLayout to style the page.
lift $ defaultLayout
[whamlet|
<p>This wiki has the following pages:
<ul>
$forall page <- Map.keys content
<li>
-- Notice the usage of toParent!
<a href=@{toParent $ WikiReadR page}>#{show page}
|]
-- You provide a JSON representation just by returning a JSON value.
-- aeson's toJSON make it easy to convert a list of values into JSON.
provideRep $ return $ toJSON $ Map.keys content
getWikiReadR :: Texts -> WikiHandler TypedContent
getWikiReadR page = do
content <- getContent
selectRep $ do
provideRep $
case Map.lookup page content of
Nothing -> do
setMessage $ "Page does not exist, please create it."
-- We don't need to convert or lift here: we're using a
-- route from our subsite, and redirect lives in our
-- subsite.
redirect $ WikiEditR page
Just t -> do
toParent <- getRouteToParent
-- Notice that we lift the canEditPage function from the
-- master site.
canEdit <- lift $ canEditPage page
lift $ defaultLayout
[whamlet|
<article>#{t}
$if canEdit
<p>
<a href=@{toParent $ WikiEditR page}>Edit
|]
provideRep $ return $ toJSON $
case Map.lookup page content of
-- Our HTML representation sends a redirect if the page isn't
-- found, but our JSON representation just returns a JSON value
-- instead.
Nothing -> object ["error" .= ("Page not found" :: Text)]
Just (Textarea t) -> object ["content" .= t]
getWikiEditR :: Texts -> WikiHandler Html
getWikiEditR page = do
canEdit <- lift $ canEditPage page
unless canEdit $ permissionDenied "You do not have permissions to edit this page."
content <- getContent
let form = renderTable
$ areq textareaField "Content" (Map.lookup page content)
-- We need to use lift here since the widget will be used below.
-- Practically speaking, this means that we'll be rendering form messages
-- using the master site's translation functions.
((res, widget), enctype) <- lift $ runFormPost form
case res of
FormSuccess t -> do
putContent page t
setMessage "Content updated"
redirect $ WikiEditR page
_ -> do
toParent <- getRouteToParent
lift $ defaultLayout
[whamlet|
<p>
<a href=@{toParent $ WikiReadR page}>Read page
<form method=post action=@{toParent $ WikiEditR page} enctype=#{enctype}>
<table>
^{widget}
<tr>
<td colspan=2>
<button>Update page
|]
postWikiEditR :: Texts -> WikiHandler Html
postWikiEditR = getWikiEditR

View File

@ -0,0 +1,41 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
-- | Define our Wiki data type, routes, and the YesodWiki typeclass. Due to the
-- GHC stage restriction, the routes must be declared in a separate module from
-- our dispatch instance.
module WikiRoutes where
import Control.Monad (liftM)
import Control.Monad.IO.Class (MonadIO)
import Data.IORef (IORef, newIORef)
import Data.Map (Map, empty)
import Yesod
-- | Simple Wiki datatype: just store a Map from Wiki path to the contents of
-- the page.
data Wiki = Wiki
{ wikiContent :: IORef (Map Texts Textarea)
}
-- | A typeclass that all master sites that want a Wiki must implement. A
-- master must be able to render form messages, as we use yesod-form for
-- processing user input.
class (RenderMessage master FormMessage, Yesod master) => YesodWiki master where
-- | Write protection. By default, no protection.
canEditPage :: Texts -> HandlerT master IO Bool
canEditPage _ = return True
-- | Define our routes. We'll have a homepage that lists all of the pages, a
-- read route for reading a page, and an edit route.
mkYesodSubData "Wiki" [parseRoutes|
/ WikiHomeR GET
/read/*Texts WikiReadR GET
/edit/*Texts WikiEditR GET POST
|]
-- | A convenience function for creating an empty Wiki.
newWiki :: MonadIO m => m Wiki
newWiki = Wiki `liftM` liftIO (newIORef empty)

View File

@ -1,13 +0,0 @@
#!/bin/bash
pkgs=( ./yesod-routes
./yesod-core
./yesod-json
./yesod-static
./yesod-persistent
./yesod-newsfeed
./yesod-form
./yesod-auth
./yesod-sitemap
./yesod-default
./yesod )

@ -1 +0,0 @@
Subproject commit d4cb555ca5fd6bc67f7da484a63d1fcdb149eac9

View File

@ -1,10 +0,0 @@
yesod-core
yesod-json
yesod-static
yesod-persistent
yesod-newsfeed
yesod-form
yesod-auth
yesod-sitemap
yesod-default
yesod

19
stack.yaml Normal file
View File

@ -0,0 +1,19 @@
resolver: lts-18.3
packages:
- ./yesod-core
- ./yesod-static
- ./yesod-persistent
- ./yesod-newsfeed
- ./yesod-form
- ./yesod-form-multi
- ./yesod-auth
- ./yesod-auth-oauth
- ./yesod-sitemap
- ./yesod-test
- ./yesod-bin
- ./yesod
- ./yesod-eventsource
- ./yesod-websockets
extra-deps:
- attoparsec-aeson-2.1.0.0

19
stack.yaml.lock Normal file
View File

@ -0,0 +1,19 @@
# This file was autogenerated by Stack.
# You should not edit this file by hand.
# For more information, please see the documentation at:
# https://docs.haskellstack.org/en/stable/lock_files
packages:
- completed:
hackage: attoparsec-aeson-2.1.0.0@sha256:fa83aba43bfa58490de8f274d19b9d58b6403a207b12cac5f93922102b084c52,1154
pantry-tree:
sha256: 294c3a8a19a7ddad58097e18c624c6b34894b3c4a4cc490759cb31d842db242a
size: 114
original:
hackage: attoparsec-aeson-2.1.0.0
snapshots:
- completed:
sha256: 694573e96dca34db5636edb1fe6c96bb233ca0f9fb96c1ead1671cdfa9bd73e9
size: 585603
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/18/3.yaml
original: lts-18.3

View File

@ -1,25 +0,0 @@
The following license covers this documentation, and the source code, except
where otherwise indicated.
Copyright 2010, Michael Snoyman. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* 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.

View File

@ -1,123 +0,0 @@
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE OverloadedStrings #-}
-- | In-built kerberos authentication for Yesod.
--
-- Please note that all configuration should have been done
-- manually on the machine prior to running the code.
--
-- On linux machines the configuration might be in /etc/krb5.conf.
-- It's worth checking if the Kerberos service provider (e.g. your university)
-- already provide a complete configuration file.
--
-- Be certain that you can manually login from a shell by typing
--
-- > kinit username
--
-- If you fill in your password and the program returns no error code,
-- then your kerberos configuration is setup properly.
-- Only then can this module be of any use.
module Yesod.Auth.Kerberos
( authKerberos,
genericAuthKerberos,
KerberosConfig(..),
defaultKerberosConfig
) where
#include "qq.h"
import Yesod.Auth
import Yesod.Auth.Message
import Web.Authenticate.Kerberos
import Data.Text (Text)
import qualified Data.Text as T
import Text.Hamlet
import Yesod.Handler
import Yesod.Widget
import Control.Monad.IO.Class (liftIO)
import Yesod.Form
import Control.Applicative ((<$>), (<*>))
data KerberosConfig = KerberosConfig {
-- | When a user gives username x, f(x) will be passed to Kerberos
usernameModifier :: Text -> Text
-- | When a user gives username x, f(x) will be passed to Yesod
, identifierModifier :: Text -> Text
}
-- | A configuration where the username the user provides is the one passed
-- to both kerberos and yesod
defaultKerberosConfig :: KerberosConfig
defaultKerberosConfig = KerberosConfig id id
-- | A configurable version of 'authKerberos'
genericAuthKerberos :: YesodAuth m => KerberosConfig -> AuthPlugin m
genericAuthKerberos config = AuthPlugin "kerberos" dispatch $ \tm -> addHamlet
[QQ(hamlet)|
<div id="header">
<h1>Login
<div id="login">
<form method="post" action="@{tm login}">
<table>
<tr>
<th>Username:
<td>
<input id="x" name="username" autofocus="" required>
<tr>
<th>Password:
<td>
<input type="password" name="password" required>
<tr>
<td>&nbsp;
<td>
<input type="submit" value="Login">
<script>
if (!("autofocus" in document.createElement("input"))) {
document.getElementById("x").focus();
}
|]
where
dispatch "POST" ["login"] = postLoginR config >>= sendResponse
dispatch _ _ = notFound
login :: AuthRoute
login = PluginR "kerberos" ["login"]
-- | Kerberos with 'defaultKerberosConfig'
authKerberos :: YesodAuth m => AuthPlugin m
authKerberos = genericAuthKerberos defaultKerberosConfig
-- | Handle the login form
postLoginR :: (YesodAuth y) => KerberosConfig -> GHandler Auth y ()
postLoginR config = do
(mu,mp) <- runInputPost $ (,)
<$> iopt textField "username"
<*> iopt textField "password"
let errorMessage (message :: Text) = do
setMessage [QQ(shamlet)|Error: #{message}|]
toMaster <- getRouteToMaster
redirect $ toMaster LoginR
case (mu,mp) of
(Nothing, _ ) -> do
mr <- getMessageRender
errorMessage $ mr PleaseProvideUsername
(_ , Nothing) -> do
mr <- getMessageRender
errorMessage $ mr PleaseProvidePassword
(Just u , Just p ) -> do
result <- liftIO $ loginKerberos (usernameModifier config u) p
case result of
Ok -> do
let creds = Creds
{ credsIdent = identifierModifier config u
, credsPlugin = "Kerberos"
, credsExtra = []
}
setCreds True creds
kerberosError -> errorMessage (T.pack $ show kerberosError)

View File

@ -1,10 +0,0 @@
-- CPP macro which choses which quasyquotes syntax to use depending
-- on GHC version.
--
-- QQ stands for quasyquote.
#if GHC7
# define QQ(x) x
#else
# define QQ(x) $x
#endif

View File

@ -1,39 +0,0 @@
name: yesod-auth-kerberos
version: 0.8.0
license: BSD3
license-file: LICENSE
author: Arash Rouhani
maintainer: Arash Rouhani
synopsis: Kerberos Authentication for Yesod.
category: Web, Yesod
stability: Stable
cabal-version: >= 1.6.0
build-type: Simple
homepage: http://www.yesodweb.com/
extra-source-files: include/qq.h
description: Kerberos Authentication for Yesod.
flag ghc7
library
if flag(ghc7)
build-depends: base >= 4.3 && < 5
cpp-options: -DGHC7
else
build-depends: base >= 4 && < 4.3
build-depends: authenticate-kerberos >= 1.0 && < 1.1
, bytestring >= 0.9.1.4 && < 0.10
, yesod-core >= 0.10 && < 0.11
, yesod-auth >= 0.8 && < 0.9
, text >= 0.7 && < 0.12
, hamlet >= 0.10 && < 0.11
, yesod-form >= 0.4 && < 0.5
, transformers >= 0.2.2 && < 0.3
exposed-modules: Yesod.Auth.Kerberos
ghc-options: -Wall
include-dirs: include
source-repository head
type: git
location: https://github.com/yesodweb/yesod

View File

@ -0,0 +1,33 @@
# ChangeLog for yesod-auth-oauth
## 1.6.1
* Allow newer GHC
## 1.6.0.3
* Allow yesod-form 1.7
## 1.6.0.2
* Remove unnecessary deriving of Typeable
## 1.6.0.1
* Compile with GHC 8.6 [#1561](https://github.com/yesodweb/yesod/pull/1561)
## 1.6.0
* Upgrade to yesod-core 1.6.0
## 1.4.2
* Fix warnings
## 1.4.1
* change OAuth Twitter ID, screen_name → user_id [#1168](https://github.com/yesodweb/yesod/pull/1168)
## 1.4.0.2
* Compile with GHC 7.10

View File

@ -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.

View File

@ -0,0 +1,3 @@
## yesod-auth-oauth
Oauth Authentication for Yesod.

View File

@ -1,89 +1,163 @@
{-# LANGUAGE CPP, QuasiQuotes, OverloadedStrings #-}
{-# OPTIONS_GHC -fwarn-unused-imports #-}
{-# LANGUAGE OverloadedStrings, QuasiQuotes #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Yesod.Auth.OAuth
( authOAuth
, oauthUrl
, authTwitter
, authTwitterUsingUserId
, twitterUrl
, authTumblr
, tumblrUrl
, module Web.Authenticate.OAuth
) where
import Control.Applicative as A ((<$>), (<*>))
import Control.Arrow ((***))
import UnliftIO.Exception
import Control.Monad.IO.Class
import Data.ByteString (ByteString)
import Data.Maybe
import Data.Text (Text)
import qualified Data.Text as T
import Data.Text.Encoding (decodeUtf8With, encodeUtf8)
import Data.Text.Encoding.Error (lenientDecode)
import Web.Authenticate.OAuth
import Yesod.Auth
import Yesod.Form
import Yesod.Core
#include "qq.h"
data YesodOAuthException = CredentialError String Credential
| SessionError String
deriving Show
import Yesod.Auth
import Yesod.Form
import Yesod.Handler
import Yesod.Widget
import Text.Hamlet (shamlet)
import Web.Authenticate.OAuth
import Data.Maybe
import Data.String
import Data.ByteString.Char8 (pack)
import Control.Arrow ((***))
import Data.Text (Text, unpack)
import Data.Text.Encoding (encodeUtf8, decodeUtf8With)
import Data.Text.Encoding.Error (lenientDecode)
import Data.ByteString (ByteString)
import Control.Applicative ((<$>), (<*>))
instance Exception YesodOAuthException
oauthUrl :: Text -> AuthRoute
oauthUrl name = PluginR name ["forward"]
authOAuth :: YesodAuth m =>
Text -- ^ Service Name
-> String -- ^ OAuth Parameter Name to use for identify
-> String -- ^ Request URL
-> String -- ^ Access Token URL
-> String -- ^ Authorize URL
-> String -- ^ Consumer Key
-> String -- ^ Consumer Secret
-> AuthPlugin m
authOAuth name ident reqUrl accUrl authUrl key sec = AuthPlugin name dispatch login
authOAuth :: forall master. YesodAuth master
=> OAuth -- ^ 'OAuth' data-type for signing.
-> (Credential -> IO (Creds master)) -- ^ How to extract ident.
-> AuthPlugin master
authOAuth oauth mkCreds = AuthPlugin name dispatch login
where
name = T.pack $ oauthServerName oauth
url = PluginR name []
oauth = OAuth { oauthServerName = unpack name, oauthRequestUri = reqUrl
, oauthAccessTokenUri = accUrl, oauthAuthorizeUri = authUrl
, oauthSignatureMethod = HMACSHA1
, oauthConsumerKey = fromString key, oauthConsumerSecret = fromString sec
, oauthCallback = Nothing
, oauthRealm = Nothing
}
lookupTokenSecret = bsToText . fromMaybe "" . lookup "oauth_token_secret" . unCredential
oauthSessionName :: Text
oauthSessionName = "__oauth_token_secret"
dispatch
:: Text
-> [Text]
-> AuthHandler master TypedContent
dispatch "GET" ["forward"] = do
render <- getUrlRender
tm <- getRouteToMaster
tm <- getRouteToParent
let oauth' = oauth { oauthCallback = Just $ encodeUtf8 $ render $ tm url }
master <- getYesod
tok <- lift $ getTemporaryCredential oauth' (authHttpManager master)
manager <- authHttpManager
tok <- getTemporaryCredential oauth' manager
setSession oauthSessionName $ lookupTokenSecret tok
redirect $ authorizeUrl oauth' tok
dispatch "GET" [] = do
(verifier, oaTok) <- runInputGet $ (,)
<$> ireq textField "oauth_verifier"
<*> ireq textField "oauth_token"
let reqTok = Credential [ ("oauth_verifier", encodeUtf8 verifier), ("oauth_token", encodeUtf8 oaTok)
tokSec <- lookupSession oauthSessionName >>= \case
Just t -> return t
Nothing -> liftIO $ fail "lookupSession could not find session"
deleteSession oauthSessionName
reqTok <-
if oauthVersion oauth == OAuth10
then do
oaTok <- runInputGet $ ireq textField "oauth_token"
return $ Credential [ ("oauth_token", encodeUtf8 oaTok)
, ("oauth_token_secret", encodeUtf8 tokSec)
]
master <- getYesod
accTok <- lift $ getAccessToken oauth reqTok (authHttpManager master)
let crId = decodeUtf8With lenientDecode $ fromJust $ lookup (pack ident) $ unCredential accTok
creds = Creds name crId $ map (bsToText *** bsToText ) $ unCredential accTok
setCreds True creds
else do
(verifier, oaTok) <-
runInputGet $ (,) A.<$> ireq textField "oauth_verifier"
A.<*> ireq textField "oauth_token"
return $ Credential [ ("oauth_verifier", encodeUtf8 verifier)
, ("oauth_token", encodeUtf8 oaTok)
, ("oauth_token_secret", encodeUtf8 tokSec)
]
manager <- authHttpManager
accTok <- getAccessToken oauth reqTok manager
creds <- liftIO $ mkCreds accTok
setCredsRedirect creds
dispatch _ _ = notFound
login tm = do
render <- lift getUrlRender
let oaUrl = render $ tm $ oauthUrl name
addHtml
[QQ(shamlet)| <a href=#{oaUrl}>Login with #{name} |]
authTwitter :: YesodAuth m =>
String -- ^ Consumer Key
-> String -- ^ Consumer Secret
login tm = do
render <- getUrlRender
let oaUrl = render $ tm $ oauthUrl name
[whamlet| <a href=#{oaUrl}>Login via #{name} |]
mkExtractCreds :: Text -> String -> Credential -> IO (Creds m)
mkExtractCreds name idName (Credential dic) = do
let mcrId = decodeUtf8With lenientDecode <$> lookup (encodeUtf8 $ T.pack idName) dic
case mcrId of
Just crId -> return $ Creds name crId $ map (bsToText *** bsToText) dic
Nothing -> throwIO $ CredentialError ("key not found: " ++ idName) (Credential dic)
authTwitter' :: YesodAuth m
=> ByteString -- ^ Consumer Key
-> ByteString -- ^ Consumer Secret
-> String
-> AuthPlugin m
authTwitter' key secret idName = authOAuth
(newOAuth { oauthServerName = "twitter"
, oauthRequestUri = "https://api.twitter.com/oauth/request_token"
, oauthAccessTokenUri = "https://api.twitter.com/oauth/access_token"
, oauthAuthorizeUri = "https://api.twitter.com/oauth/authorize"
, oauthSignatureMethod = HMACSHA1
, oauthConsumerKey = key
, oauthConsumerSecret = secret
, oauthVersion = OAuth10a
})
(mkExtractCreds "twitter" idName)
-- | This plugin uses Twitter's /screen_name/ as ID, which shouldn't be used for authentication because it is mutable.
authTwitter :: YesodAuth m
=> ByteString -- ^ Consumer Key
-> ByteString -- ^ Consumer Secret
-> AuthPlugin m
authTwitter = authOAuth "twitter"
"screen_name"
"http://twitter.com/oauth/request_token"
"http://twitter.com/oauth/access_token"
"http://twitter.com/oauth/authorize"
authTwitter key secret = authTwitter' key secret "screen_name"
{-# DEPRECATED authTwitter "Use authTwitterUsingUserId instead" #-}
-- | Twitter plugin which uses Twitter's /user_id/ as ID.
--
-- For more information, see: https://github.com/yesodweb/yesod/pull/1168
--
-- @since 1.4.1
authTwitterUsingUserId :: YesodAuth m
=> ByteString -- ^ Consumer Key
-> ByteString -- ^ Consumer Secret
-> AuthPlugin m
authTwitterUsingUserId key secret = authTwitter' key secret "user_id"
twitterUrl :: AuthRoute
twitterUrl = oauthUrl "twitter"
authTumblr :: YesodAuth m
=> ByteString -- ^ Consumer Key
-> ByteString -- ^ Consumer Secret
-> AuthPlugin m
authTumblr key secret = authOAuth
(newOAuth { oauthServerName = "tumblr"
, oauthRequestUri = "http://www.tumblr.com/oauth/request_token"
, oauthAccessTokenUri = "http://www.tumblr.com/oauth/access_token"
, oauthAuthorizeUri = "http://www.tumblr.com/oauth/authorize"
, oauthSignatureMethod = HMACSHA1
, oauthConsumerKey = key
, oauthConsumerSecret = secret
, oauthVersion = OAuth10a
})
(mkExtractCreds "tumblr" "name")
tumblrUrl :: AuthRoute
tumblrUrl = oauthUrl "tumblr"
bsToText :: ByteString -> Text
bsToText = decodeUtf8With lenientDecode

View File

@ -1,10 +0,0 @@
-- CPP macro which choses which quasyquotes syntax to use depending
-- on GHC version.
--
-- QQ stands for quasyquote.
#if GHC7
# define QQ(x) x
#else
# define QQ(x) $x
#endif

View File

@ -1,37 +1,30 @@
cabal-version: >= 1.10
name: yesod-auth-oauth
version: 0.8.0
version: 1.6.1
license: BSD3
license-file: LICENSE
author: Hiromi Ishii
maintainer: Hiromi Ishii
maintainer: Michael Litchard
synopsis: OAuth Authentication for Yesod.
category: Web, Yesod
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.
flag ghc7
description: API docs and the README are available at <http://www.stackage.org/package/yesod-auth-oauth>
extra-source-files: README.md ChangeLog.md
library
if flag(ghc7)
build-depends: base >= 4.3 && < 5
cpp-options: -DGHC7
else
build-depends: base >= 4 && < 4.3
build-depends: authenticate-oauth >= 1.0 && < 1.1
, bytestring >= 0.9.1.4 && < 0.10
, yesod-core >= 0.10 && < 0.11
, yesod-auth >= 0.8 && < 0.9
, text >= 0.7 && < 0.12
, hamlet >= 0.10 && < 0.11
, yesod-form >= 0.4 && < 0.5
default-language: Haskell2010
build-depends: authenticate-oauth >= 1.5 && < 1.8
, base >= 4.10 && < 5
, bytestring >= 0.9.1.4
, text >= 0.7
, unliftio
, yesod-auth >= 1.6 && < 1.7
, yesod-core >= 1.6 && < 1.7
, yesod-form >= 1.6 && < 1.8
exposed-modules: Yesod.Auth.OAuth
ghc-options: -Wall
include-dirs: include
source-repository head
type: git

225
yesod-auth/ChangeLog.md Normal file
View File

@ -0,0 +1,225 @@
# ChangeLog for yesod-auth
## 1.6.11.2
* Add support for aeson 2.2 [#1820](https://github.com/yesodweb/yesod/pull/1820)
## 1.6.11.1
* No star is type [#1797](https://github.com/yesodweb/yesod/pull/1797)
## 1.6.11
* Add support for aeson 2
## 1.6.10.5
* Fix German translations of AuthMessage [#1741](https://github.com/yesodweb/yesod/pull/1741)
## 1.6.10.4
* Add support for GHC 9 [#1737](https://github.com/yesodweb/yesod/pull/1737)
## 1.6.10.3
* Relax bounds for yesod-form 1.7
## 1.6.10.2
* Relax bounds for persistent 2.12
## 1.6.10.1
* Add support for Persistent 2.11 [#1701](https://github.com/yesodweb/yesod/pull/1701)
## 1.6.10
* Updated `AuthMessage` data type in `Yesod.Auth.Message` to accommodate registration flow where password is supplied initially: deprecated `AddressVerified` and split into `EmailVerifiedChangePass` and `EmailVerified`
* Fixed a bug in `getVerifyR` related to the above, where the incorrect message was displayed when password was set during registration
* Added `sendForgotPasswordEmail` to `YesodAuthEmail` typeclass, allowing for different emails for account registration vs. forgot password
* See pull request [#1662](https://github.com/yesodweb/yesod/pull/1662)
## 1.6.9
* Added `registerHelper` and `passwordResetHelper` methods to the `YesodAuthEmail` class, allowing for customizing behavior for user registration and forgot password requests [#1660](https://github.com/yesodweb/yesod/pull/1660)
* Exposed `defaultRegisterHelper` as default implementation for the above methods
## 1.6.8.1
* Email: Fix typo in `defaultEmailLoginHandler` template [#1605](https://github.com/yesodweb/yesod/pull/1605)
* Remove unnecessary deriving of Typeable
## 1.6.8
* Dummy: Add support for JSON submissions [#1619](https://github.com/yesodweb/yesod/pull/1619)
## 1.6.7
* Redirect behavior of `clearCreds` depends on request type [#1598](https://github.com/yesodweb/yesod/pull/1598)
## 1.6.6
* Deprecated `Yesod.Auth.GoogleEmail2`, see [#1579](https://github.com/yesodweb/yesod/issues/1579) and [migration blog post](https://pbrisbin.com/posts/googleemail2_deprecation/)
## 1.6.5
* Add support for persistent 2.9 [#1516](https://github.com/yesodweb/yesod/pull/1516), [#1561](https://github.com/yesodweb/yesod/pull/1561)
## 1.6.4.1
* Email: Fix forgot-password endpoint [#1537](https://github.com/yesodweb/yesod/pull/1537)
## 1.6.4
* Make `registerHelper` configurable [#1524](https://github.com/yesodweb/yesod/issues/1524)
* Email: Immediately register with a password [#1389](https://github.com/yesodweb/yesod/issues/1389)
To configure this new functionality:
1. Define `addUnverifiedWithPass`, e.g:
```
addUnverified email verkey = liftHandler $ runDB $ do
void $ insert $ UserLogin email Nothing (Just verkey) False
return email
addUnverifiedWithPass email verkey pass = liftHandler $ runDB $ do
void $ insert $ UserLogin email (Just pass) (Just verkey) False
return email
```
2. Add a `password` field to your client forms.
## 1.6.3
* Generalize GoogleEmail2.getPerson [#1501](https://github.com/yesodweb/yesod/pull/1501)
## 1.6.2
* Remove MINIMAL praggma for authHttpManager [#1489](https://github.com/yesodweb/yesod/issues/1489)
## 1.6.1
* Relax a number of type signatures [#1488](https://github.com/yesodweb/yesod/issues/1488)
## 1.6.0
* Upgrade to yesod-core 1.6.0
## 1.4.21
* Add redirectToCurrent to Yesod.Auth module for controlling setUltDestCurrent in redirectLogin [#1461](https://github.com/yesodweb/yesod/pull/1461)
## 1.4.20
* Extend `YesodAuthEmail` to support extensible password hashing via
`hashAndSaltPassword` and `verifyPassword` functions
## 1.4.19
* Adjust English localization to distinguish between "log in" (verb) and "login" (noun)
## 1.4.18
* Expose Yesod.Auth.Util.PasswordStore
## 1.4.17.3
* Some translation fixes
## 1.4.17.2
* Move to cryptonite from cryptohash
## 1.4.17.1
* Some translation fixes
## 1.4.17
* Add Show instance for user credentials `Creds`
* Export pid type for identifying plugin
* Fix warnings
* Allow for a custom Email Login DOM with `emailLoginHandler`
## 1.4.16
* Fix email provider [#1330](https://github.com/yesodweb/yesod/issues/1330)
* Document JSON endpoints of Yesod.Auth.Email
## 1.4.15
* Add JSON endpoints to Yesod.Auth.Email module
* Export croatianMessage from Message module
* Minor Haddock rendering fixes at Auth.Email module
## 1.4.14
* Remove Google OpenID link [#1309](https://github.com/yesodweb/yesod/pull/1309)
* Add CSRF Security check in `registerHelperFunction` [#1302](https://github.com/yesodweb/yesod/pull/1302)
## 1.4.13.5
* Translation fix
## 1.4.13.4
* Improved translations
* peristent 2.6
## 1.4.13.3
* Doc update (and a warning)
## 1.4.13.1
* Add CSRF token to login form from `Yesod.Auth.Dummy` [#1205](https://github.com/yesodweb/yesod/pull/1205)
## 1.4.13
* Add a CSRF token to the login form from `Yesod.Auth.Hardcoded`, making it compatible with the CSRF middleware [#1161](https://github.com/yesodweb/yesod/pull/1161)
* Multiple session messages. [#1187](https://github.com/yesodweb/yesod/pull/1187)
## 1.4.12
* Deprecated Yesod.Auth.GoogleEmail
## 1.4.11
Add Yesod.Auth.Hardcoded
## 1.4.9
* Expose defaultLoginHandler
## 1.4.8
* GoogleEmail2: proper error message when permission denied
## 1.4.7
* add a runHttpRequest function for handling HTTP errors
## 1.4.6
* Use nonce package to generate verification keys and CSRF tokens [#1011](https://github.com/yesodweb/yesod/pull/1011)
## 1.4.5
* Adds export of email verify route [#980](https://github.com/yesodweb/yesod/pull/980)
## 1.4.4
* Add AuthenticationResult and authenticate function [#959](https://github.com/yesodweb/yesod/pull/959)
## 1.4.3
* Added means to fetch user's Google profile [#936](https://github.com/yesodweb/yesod/pull/936)
## 1.4.2
* Perform `onLogout` before session cleaning [#923](https://github.com/yesodweb/yesod/pull/923)
## 1.4.1.3
[Updated french translation of Yesod.Auth.Message. #904](https://github.com/yesodweb/yesod/pull/904)
## 1.4.1
Dutch translation added.

View File

@ -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.

View File

12
yesod-auth/README.md Normal file
View File

@ -0,0 +1,12 @@
## yesod-auth
This package provides a pluggable mechanism for allowing users to authenticate
with your site. It comes with a number of common plugins, such as OpenID,
BrowserID (a.k.a., Mozilla Persona), and email. Other packages are available
from Hackage as well. If you've written such an add-on, please notify me so
that it can be added to this description.
* [yesod-auth-oauth2](https://hackage.haskell.org/package/yesod-auth-oauth2): Library to authenticate with OAuth 2.0.
* [yesod-auth-account](http://hackage.haskell.org/package/yesod-auth-account): An account authentication plugin for Yesod
* [yesod-auth-hashdb](http://www.stackage.org/package/yesod-auth-hashdb): The HashDB module previously packaged in yesod-auth, now with stronger, but compatible, security.
* [yesod-auth-bcrypt](https://hackage.haskell.org/package/yesod-auth-bcrypt): An alternative to the HashDB module.

View File

@ -1,11 +1,14 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE QuasiQuotes, TypeFamilies, TemplateHaskell #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE UndecidableInstances #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Yesod.Auth
( -- * Subsite
@ -15,161 +18,433 @@ module Yesod.Auth
, AuthPlugin (..)
, getAuth
, YesodAuth (..)
, YesodAuthPersist (..)
-- * Plugin interface
, Creds (..)
, setCreds
, setCredsRedirect
, clearCreds
, loginErrorMessage
, loginErrorMessageI
-- * User functions
, maybeAuthId
, AuthenticationResult (..)
, defaultMaybeAuthId
, defaultLoginHandler
, maybeAuthPair
, maybeAuth
, requireAuthId
, requireAuthPair
, requireAuth
-- * Exception
, AuthException (..)
-- * Helper
, MonadAuthHandler
, AuthHandler
-- * Internal
, credsKey
, provideJsonMessage
, messageJson401
, asHtml
) where
#include "qq.h"
import Control.Monad (when)
import Control.Monad (when)
import Control.Monad.Trans.Maybe
import UnliftIO (withRunInIO, MonadUnliftIO)
import Data.Aeson
import Yesod.Auth.Routes
import Data.Text.Encoding (decodeUtf8With)
import Data.Text.Encoding.Error (lenientDecode)
import Data.Text (Text)
import qualified Data.Text as T
import qualified Data.HashMap.Lazy as Map
import Network.HTTP.Conduit (Manager)
import Language.Haskell.TH.Syntax hiding (lift)
import Data.Monoid (Endo)
import Network.HTTP.Client (Manager, Request, withResponse, Response, BodyReader)
import Network.HTTP.Client.TLS (getGlobalManager)
import qualified Network.Wai as W
import Text.Hamlet (shamlet)
import Yesod.Core
import Yesod.Persist
import Yesod.Json
import Yesod.Auth.Message (AuthMessage, defaultMessage)
import qualified Yesod.Auth.Message as Msg
import Yesod.Form (FormMessage)
import Data.Typeable (Typeable)
import Control.Exception (Exception)
data Auth = Auth
import Network.HTTP.Types (Status, internalServerError500, unauthorized401)
import qualified Control.Monad.Trans.Writer as Writer
import Control.Monad (void)
import Data.Kind (Type)
type AuthRoute = Route Auth
type MonadAuthHandler master m = (MonadHandler m, YesodAuth master, master ~ HandlerSite m, Auth ~ SubHandlerSite m, MonadUnliftIO m)
type AuthHandler master a = forall m. MonadAuthHandler master m => m a
type Method = Text
type Piece = Text
data AuthPlugin m = AuthPlugin
-- | The result of an authentication based on credentials
--
-- @since 1.4.4
data AuthenticationResult master
= Authenticated (AuthId master) -- ^ Authenticated successfully
| UserError AuthMessage -- ^ Invalid credentials provided by user
| ServerError Text -- ^ Some other error
data AuthPlugin master = AuthPlugin
{ apName :: Text
, apDispatch :: Method -> [Piece] -> GHandler Auth m ()
, apLogin :: forall s. (Route Auth -> Route m) -> GWidget s m ()
, apDispatch :: Method -> [Piece] -> AuthHandler master TypedContent
, apLogin :: (Route Auth -> Route master) -> WidgetFor master ()
}
getAuth :: a -> Auth
getAuth = const Auth
-- | User credentials
data Creds m = Creds
data Creds master = Creds
{ credsPlugin :: Text -- ^ How the user was authenticated
, credsIdent :: Text -- ^ Identifier. Exact meaning depends on plugin.
, credsExtra :: [(Text, Text)]
}
} deriving (Show)
class (Yesod m, PathPiece (AuthId m), RenderMessage m FormMessage) => YesodAuth m where
type AuthId m
class (Yesod master, PathPiece (AuthId master), RenderMessage master FormMessage) => YesodAuth master where
type AuthId master
-- | specify the layout. Uses defaultLayout by default
authLayout :: (MonadHandler m, HandlerSite m ~ master) => WidgetFor master () -> m Html
authLayout = liftHandler . defaultLayout
-- | Default destination on successful login, if no other
-- destination exists.
loginDest :: m -> Route m
loginDest :: master -> Route master
-- | Default destination on successful logout, if no other
-- destination exists.
logoutDest :: m -> Route m
logoutDest :: master -> Route master
-- | Perform authentication based on the given credentials.
--
-- Default implementation is in terms of @'getAuthId'@
--
-- @since: 1.4.4
authenticate :: (MonadHandler m, HandlerSite m ~ master) => Creds master -> m (AuthenticationResult master)
authenticate creds = do
muid <- getAuthId creds
return $ maybe (UserError Msg.InvalidLogin) Authenticated muid
-- | Determine the ID associated with the set of credentials.
getAuthId :: Creds m -> GHandler s m (Maybe (AuthId m))
--
-- Default implementation is in terms of @'authenticate'@
--
getAuthId :: (MonadHandler m, HandlerSite m ~ master) => Creds master -> m (Maybe (AuthId master))
getAuthId creds = do
auth <- authenticate creds
return $ case auth of
Authenticated auid -> Just auid
_ -> Nothing
-- | Which authentication backends to use.
authPlugins :: m -> [AuthPlugin m]
authPlugins :: master -> [AuthPlugin master]
-- | What to show on the login page.
loginHandler :: GHandler Auth m RepHtml
loginHandler = defaultLayout $ do
setTitleI Msg.LoginTitle
tm <- lift getRouteToMaster
master <- lift getYesod
mapM_ (flip apLogin tm) (authPlugins master)
--
-- By default this calls 'defaultLoginHandler', which concatenates
-- plugin widgets and wraps the result in 'authLayout'. Override if
-- you need fancy widget containers, additional functionality, or an
-- entirely custom page. For example, in some applications you may
-- want to prevent the login page being displayed for a user who is
-- already logged in, even if the URL is visited explicitly; this can
-- be done by overriding 'loginHandler' in your instance declaration
-- with something like:
--
-- > instance YesodAuth App where
-- > ...
-- > loginHandler = do
-- > ma <- lift maybeAuthId
-- > when (isJust ma) $
-- > lift $ redirect HomeR -- or any other Handler code you want
-- > defaultLoginHandler
--
loginHandler :: AuthHandler master Html
loginHandler = defaultLoginHandler
-- | Used for i18n of messages provided by this package.
renderAuthMessage :: m
renderAuthMessage :: master
-> [Text] -- ^ languages
-> AuthMessage -> Text
-> AuthMessage
-> Text
renderAuthMessage _ _ = defaultMessage
-- | After login and logout, redirect to the referring page, instead of
-- 'loginDest' and 'logoutDest'. Default is 'False'.
redirectToReferer :: m -> Bool
redirectToReferer :: master -> Bool
redirectToReferer _ = False
-- | When being redirected to the login page should the current page
-- be set to redirect back to. Default is 'True'.
--
-- @since 1.4.21
redirectToCurrent :: master -> Bool
redirectToCurrent _ = True
-- | Return an HTTP connection manager that is stored in the foundation
-- type. This allows backends to reuse persistent connections. If none of
-- the backends you're using use HTTP connections, you can safely return
-- @error \"authHttpManager"@ here.
authHttpManager :: m -> Manager
-- @error \"authHttpManager\"@ here.
authHttpManager :: (MonadHandler m, HandlerSite m ~ master) => m Manager
authHttpManager = liftIO getGlobalManager
-- | Called on a successful login. By default, calls
-- @setMessageI NowLoggedIn@.
onLogin :: GHandler s m ()
onLogin = setMessageI Msg.NowLoggedIn
-- @addMessageI "success" NowLoggedIn@.
onLogin :: (MonadHandler m, master ~ HandlerSite m) => m ()
onLogin = addMessageI "success" Msg.NowLoggedIn
-- | Called on logout. By default, does nothing
onLogout :: GHandler s m ()
onLogout :: (MonadHandler m, master ~ HandlerSite m) => m ()
onLogout = return ()
mkYesodSub "Auth"
[ ClassP ''YesodAuth [VarT $ mkName "master"]
]
#define STRINGS *Texts
[QQ(parseRoutes)|
/check CheckR GET
/login LoginR GET
/logout LogoutR GET POST
/page/#Text/STRINGS PluginR
|]
-- | Retrieves user credentials, if user is authenticated.
--
-- By default, this calls 'defaultMaybeAuthId' to get the user ID from the
-- session. This can be overridden to allow authentication via other means,
-- such as checking for a special token in a request header. This is
-- especially useful for creating an API to be accessed via some means
-- other than a browser.
--
-- @since 1.2.0
maybeAuthId :: (MonadHandler m, master ~ HandlerSite m) => m (Maybe (AuthId master))
default maybeAuthId
:: (MonadHandler m, master ~ HandlerSite m, YesodAuthPersist master, Typeable (AuthEntity master))
=> m (Maybe (AuthId master))
maybeAuthId = defaultMaybeAuthId
-- | Called on login error for HTTP requests. By default, calls
-- @addMessage@ with "error" as status and redirects to @dest@.
onErrorHtml :: (MonadHandler m, HandlerSite m ~ master) => Route master -> Text -> m Html
onErrorHtml dest msg = do
addMessage "error" $ toHtml msg
fmap asHtml $ redirect dest
-- | runHttpRequest gives you a chance to handle an HttpException and retry
-- The default behavior is to simply execute the request which will throw an exception on failure
--
-- The HTTP 'Request' is given in case it is useful to change behavior based on inspecting the request.
-- This is an experimental API that is not broadly used throughout the yesod-auth code base
runHttpRequest
:: (MonadHandler m, HandlerSite m ~ master, MonadUnliftIO m)
=> Request
-> (Response BodyReader -> m a)
-> m a
runHttpRequest req inner = do
man <- authHttpManager
withRunInIO $ \run -> withResponse req man $ run . inner
{-# MINIMAL loginDest, logoutDest, (authenticate | getAuthId), authPlugins #-}
{-# DEPRECATED getAuthId "Define 'authenticate' instead; 'getAuthId' will be removed in the next major version" #-}
-- | Internal session key used to hold the authentication information.
--
-- @since 1.2.3
credsKey :: Text
credsKey = "_ID"
-- | FIXME: won't show up till redirect
setCreds :: YesodAuth m => Bool -> Creds m -> GHandler s m ()
setCreds doRedirects creds = do
y <- getYesod
maid <- getAuthId creds
case maid of
Nothing ->
when doRedirects $ do
case authRoute y of
Nothing -> do rh <- defaultLayout $ addHtml [QQ(shamlet)| <h1>Invalid login |]
sendResponse rh
Just ar -> do setMessageI Msg.InvalidLogin
redirect ar
Just aid -> do
setSession credsKey $ toPathPiece aid
when doRedirects $ do
onLogin
redirectUltDest $ loginDest y
-- | Retrieves user credentials from the session, if user is authenticated.
--
-- This function does /not/ confirm that the credentials are valid, see
-- 'maybeAuthIdRaw' for more information. The first call in a request
-- does a database request to make sure that the account is still in the database.
--
-- @since 1.1.2
defaultMaybeAuthId
:: (MonadHandler m, HandlerSite m ~ master, YesodAuthPersist master, Typeable (AuthEntity master))
=> m (Maybe (AuthId master))
defaultMaybeAuthId = runMaybeT $ do
s <- MaybeT $ lookupSession credsKey
aid <- MaybeT $ return $ fromPathPiece s
_ <- MaybeT $ cachedAuth aid
return aid
getCheckR :: YesodAuth m => GHandler Auth m RepHtmlJson
cachedAuth
:: ( MonadHandler m
, YesodAuthPersist master
, Typeable (AuthEntity master)
, HandlerSite m ~ master
)
=> AuthId master
-> m (Maybe (AuthEntity master))
cachedAuth
= fmap unCachedMaybeAuth
. cached
. fmap CachedMaybeAuth
. getAuthEntity
-- | Default handler to show the login page.
--
-- This is the default 'loginHandler'. It concatenates plugin widgets and
-- wraps the result in 'authLayout'. See 'loginHandler' for more details.
--
-- @since 1.4.9
defaultLoginHandler :: AuthHandler master Html
defaultLoginHandler = do
tp <- getRouteToParent
authLayout $ do
setTitleI Msg.LoginTitle
master <- getYesod
mapM_ (flip apLogin tp) (authPlugins master)
loginErrorMessageI
:: Route Auth
-> AuthMessage
-> AuthHandler master TypedContent
loginErrorMessageI dest msg = do
toParent <- getRouteToParent
loginErrorMessageMasterI (toParent dest) msg
loginErrorMessageMasterI
:: (MonadHandler m, HandlerSite m ~ master, YesodAuth master)
=> Route master
-> AuthMessage
-> m TypedContent
loginErrorMessageMasterI dest msg = do
mr <- getMessageRender
loginErrorMessage dest (mr msg)
-- | For HTML, set the message and redirect to the route.
-- For JSON, send the message and a 401 status
loginErrorMessage
:: (MonadHandler m, YesodAuth (HandlerSite m))
=> Route (HandlerSite m)
-> Text
-> m TypedContent
loginErrorMessage dest msg = messageJson401 msg (onErrorHtml dest msg)
messageJson401
:: MonadHandler m
=> Text
-> m Html
-> m TypedContent
messageJson401 = messageJsonStatus unauthorized401
messageJson500 :: MonadHandler m => Text -> m Html -> m TypedContent
messageJson500 = messageJsonStatus internalServerError500
messageJsonStatus
:: MonadHandler m
=> Status
-> Text
-> m Html
-> m TypedContent
messageJsonStatus status msg html = selectRep $ do
provideRep html
provideRep $ do
let obj = object ["message" .= msg]
void $ sendResponseStatus status obj
return obj
provideJsonMessage :: Monad m => Text -> Writer.Writer (Endo [ProvidedRep m]) ()
provideJsonMessage msg = provideRep $ return $ object ["message" .= msg]
setCredsRedirect
:: (MonadHandler m, YesodAuth (HandlerSite m))
=> Creds (HandlerSite m) -- ^ new credentials
-> m TypedContent
setCredsRedirect creds = do
y <- getYesod
auth <- authenticate creds
case auth of
Authenticated aid -> do
setSession credsKey $ toPathPiece aid
onLogin
res <- selectRep $ do
provideRepType typeHtml $
fmap asHtml $ redirectUltDest $ loginDest y
provideJsonMessage "Login Successful"
sendResponse res
UserError msg ->
case authRoute y of
Nothing -> do
msg' <- renderMessage' msg
messageJson401 msg' $ authLayout $ -- TODO
toWidget [whamlet|<h1>_{msg}|]
Just ar -> loginErrorMessageMasterI ar msg
ServerError msg -> do
$(logError) msg
case authRoute y of
Nothing -> do
msg' <- renderMessage' Msg.AuthError
messageJson500 msg' $ authLayout $
toWidget [whamlet|<h1>_{Msg.AuthError}|]
Just ar -> loginErrorMessageMasterI ar Msg.AuthError
where
renderMessage' msg = do
langs <- languages
master <- getYesod
return $ renderAuthMessage master langs msg
-- | Sets user credentials for the session after checking them with authentication backends.
setCreds :: (MonadHandler m, YesodAuth (HandlerSite m))
=> Bool -- ^ if HTTP redirects should be done
-> Creds (HandlerSite m) -- ^ new credentials
-> m ()
setCreds doRedirects creds =
if doRedirects
then void $ setCredsRedirect creds
else do auth <- authenticate creds
case auth of
Authenticated aid -> setSession credsKey $ toPathPiece aid
_ -> return ()
-- | same as defaultLayoutJson, but uses authLayout
authLayoutJson
:: (ToJSON j, MonadAuthHandler master m)
=> WidgetFor master () -- ^ HTML
-> m j -- ^ JSON
-> m TypedContent
authLayoutJson w json = selectRep $ do
provideRep $ authLayout w
provideRep $ fmap toJSON json
-- | Clears current user credentials for the session.
--
-- @since 1.1.7
clearCreds :: (MonadHandler m, YesodAuth (HandlerSite m))
=> Bool -- ^ if HTTP, redirect to 'logoutDest'
-> m ()
clearCreds doRedirects = do
onLogout
deleteSession credsKey
y <- getYesod
aj <- acceptsJson
case (aj, doRedirects) of
(True, _) -> sendResponse successfulLogout
(False, True) -> redirectUltDest (logoutDest y)
_ -> return ()
where successfulLogout = object ["message" .= msg]
msg :: Text
msg = "Logged out successfully!"
getCheckR :: AuthHandler master TypedContent
getCheckR = do
creds <- maybeAuthId
defaultLayoutJson (do
authLayoutJson (do
setTitle "Authentication Status"
addHtml $ html' creds) (jsonCreds creds)
toWidget $ html' creds) (return $ jsonCreds creds)
where
html' creds =
[QQ(shamlet)|
[shamlet|
$newline never
<h1>Authentication Status
$maybe _ <- creds
<p>Logged in.
@ -177,29 +452,27 @@ $nothing
<p>Not logged in.
|]
jsonCreds creds =
Object $ Map.fromList
toJSON $ Map.fromList
[ (T.pack "logged_in", Bool $ maybe False (const True) creds)
]
setUltDestReferer' :: YesodAuth master => GHandler sub master ()
setUltDestReferer' :: (MonadHandler m, YesodAuth (HandlerSite m)) => m ()
setUltDestReferer' = do
m <- getYesod
when (redirectToReferer m) setUltDestReferer
master <- getYesod
when (redirectToReferer master) setUltDestReferer
getLoginR :: YesodAuth m => GHandler Auth m RepHtml
getLoginR :: AuthHandler master Html
getLoginR = setUltDestReferer' >> loginHandler
getLogoutR :: YesodAuth m => GHandler Auth m ()
getLogoutR = setUltDestReferer' >> postLogoutR -- FIXME redirect to post
getLogoutR :: AuthHandler master ()
getLogoutR = do
tp <- getRouteToParent
setUltDestReferer' >> redirectToPost (tp LogoutR)
postLogoutR :: YesodAuth m => GHandler Auth m ()
postLogoutR = do
y <- getYesod
deleteSession credsKey
onLogout
redirectUltDest $ logoutDest y
postLogoutR :: AuthHandler master ()
postLogoutR = clearCreds True
handlePluginR :: YesodAuth m => Text -> [Text] -> GHandler Auth m ()
handlePluginR :: Text -> [Text] -> AuthHandler master TypedContent
handlePluginR plugin pieces = do
master <- getYesod
env <- waiRequest
@ -208,52 +481,135 @@ handlePluginR plugin pieces = do
[] -> notFound
ap:_ -> apDispatch ap method pieces
-- | Retrieves user credentials, if user is authenticated.
maybeAuthId :: YesodAuth m => GHandler s m (Maybe (AuthId m))
maybeAuthId = do
ms <- lookupSession credsKey
case ms of
Nothing -> return Nothing
Just s -> return $ fromPathPiece s
maybeAuth :: ( YesodAuth m
, b ~ YesodPersistBackend m
, b ~ PersistEntityBackend val
, Key b val ~ AuthId m
, PersistStore b (GHandler s m)
-- | Similar to 'maybeAuthId', but additionally look up the value associated
-- with the user\'s database identifier to get the value in the database. This
-- assumes that you are using a Persistent database.
--
-- @since 1.1.0
maybeAuth :: ( YesodAuthPersist master
, val ~ AuthEntity master
, Key val ~ AuthId master
, PersistEntity val
, YesodPersist m
) => GHandler s m (Maybe (Entity val))
maybeAuth = runMaybeT $ do
aid <- MaybeT $ maybeAuthId
a <- MaybeT $ runDB $ get aid
return $ Entity aid a
, Typeable val
, MonadHandler m
, HandlerSite m ~ master
) => m (Maybe (Entity val))
maybeAuth = fmap (fmap (uncurry Entity)) maybeAuthPair
requireAuthId :: YesodAuth m => GHandler s m (AuthId m)
requireAuthId = maybeAuthId >>= maybe redirectLogin return
-- | Similar to 'maybeAuth', but doesnt assume that you are using a
-- Persistent database.
--
-- @since 1.4.0
maybeAuthPair
:: ( YesodAuthPersist master
, Typeable (AuthEntity master)
, MonadHandler m
, HandlerSite m ~ master
)
=> m (Maybe (AuthId master, AuthEntity master))
maybeAuthPair = runMaybeT $ do
aid <- MaybeT maybeAuthId
ae <- MaybeT $ cachedAuth aid
return (aid, ae)
requireAuth :: ( YesodAuth m
, b ~ YesodPersistBackend m
, b ~ PersistEntityBackend val
, Key b val ~ AuthId m
, PersistStore b (GHandler s m)
newtype CachedMaybeAuth val = CachedMaybeAuth { unCachedMaybeAuth :: Maybe val }
-- | Class which states that the given site is an instance of @YesodAuth@
-- and that its @AuthId@ is a lookup key for the full user information in
-- a @YesodPersist@ database.
--
-- The default implementation of @getAuthEntity@ assumes that the @AuthId@
-- for the @YesodAuth@ superclass is in fact a persistent @Key@ for the
-- given value. This is the common case in Yesod, and means that you can
-- easily look up the full information on a given user.
--
-- @since 1.4.0
class (YesodAuth master, YesodPersist master) => YesodAuthPersist master where
-- | If the @AuthId@ for a given site is a persistent ID, this will give the
-- value for that entity. E.g.:
--
-- > type AuthId MySite = UserId
-- > AuthEntity MySite ~ User
--
-- @since 1.2.0
type AuthEntity master :: Type
type AuthEntity master = KeyEntity (AuthId master)
getAuthEntity :: (MonadHandler m, HandlerSite m ~ master)
=> AuthId master -> m (Maybe (AuthEntity master))
default getAuthEntity
:: ( YesodPersistBackend master ~ backend
, PersistRecordBackend (AuthEntity master) backend
, Key (AuthEntity master) ~ AuthId master
, PersistStore backend
, MonadHandler m
, HandlerSite m ~ master
)
=> AuthId master -> m (Maybe (AuthEntity master))
getAuthEntity = liftHandler . runDB . get
type family KeyEntity key
type instance KeyEntity (Key x) = x
-- | Similar to 'maybeAuthId', but redirects to a login page if user is not
-- authenticated or responds with error 401 if this is an API client (expecting JSON).
--
-- @since 1.1.0
requireAuthId :: (MonadHandler m, YesodAuth (HandlerSite m)) => m (AuthId (HandlerSite m))
requireAuthId = maybeAuthId >>= maybe handleAuthLack return
-- | Similar to 'maybeAuth', but redirects to a login page if user is not
-- authenticated or responds with error 401 if this is an API client (expecting JSON).
--
-- @since 1.1.0
requireAuth :: ( YesodAuthPersist master
, val ~ AuthEntity master
, Key val ~ AuthId master
, PersistEntity val
, YesodPersist m
) => GHandler s m (Entity val)
requireAuth = maybeAuth >>= maybe redirectLogin return
, Typeable val
, MonadHandler m
, HandlerSite m ~ master
) => m (Entity val)
requireAuth = maybeAuth >>= maybe handleAuthLack return
redirectLogin :: Yesod m => GHandler s m a
-- | Similar to 'requireAuth', but not tied to Persistent's 'Entity' type.
-- Instead, the 'AuthId' and 'AuthEntity' are returned in a tuple.
--
-- @since 1.4.0
requireAuthPair
:: ( YesodAuthPersist master
, Typeable (AuthEntity master)
, MonadHandler m
, HandlerSite m ~ master
)
=> m (AuthId master, AuthEntity master)
requireAuthPair = maybeAuthPair >>= maybe handleAuthLack return
handleAuthLack :: (YesodAuth (HandlerSite m), MonadHandler m) => m a
handleAuthLack = do
aj <- acceptsJson
if aj then notAuthenticated else redirectLogin
redirectLogin :: (YesodAuth (HandlerSite m), MonadHandler m) => m a
redirectLogin = do
y <- getYesod
setUltDestCurrent
when (redirectToCurrent y) setUltDestCurrent
case authRoute y of
Just z -> redirect z
Nothing -> permissionDenied "Please configure authRoute"
instance YesodAuth m => RenderMessage m AuthMessage where
instance YesodAuth master => RenderMessage master AuthMessage where
renderMessage = renderAuthMessage
data AuthException = InvalidBrowserIDAssertion
| InvalidFacebookResponse
deriving (Show, Typeable)
data AuthException = InvalidFacebookResponse
deriving Show
instance Exception AuthException
instance YesodAuth master => YesodSubDispatch Auth master where
yesodSubDispatch = $(mkYesodSubDispatch resourcesAuth)
asHtml :: Html -> Html
asHtml = id

View File

@ -1,74 +1,170 @@
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE RecordWildCards #-}
-- | NOTE: Mozilla Persona will be shut down by the end of 2016, therefore this
-- module is no longer recommended for use.
module Yesod.Auth.BrowserId
{-# DEPRECATED "Mozilla Persona will be shut down by the end of 2016" #-}
( authBrowserId
, authBrowserIdAudience
, createOnClick, createOnClickOverride
, def
, BrowserIdSettings
, bisAudience
, bisLazyLoad
, forwardUrl
) where
import Yesod.Auth
import Web.Authenticate.BrowserId
import Data.Text (Text)
import Yesod.Core
import Text.Hamlet (hamlet)
import qualified Data.Text as T
import Data.Maybe (fromMaybe)
import Control.Monad.IO.Class (liftIO)
import Control.Exception (throwIO)
#include "qq.h"
import Control.Monad (when, unless)
import Text.Julius (rawJS)
import Network.URI (uriPath, parseURI)
import Data.FileEmbed (embedFile)
import Data.ByteString (ByteString)
import Data.Default
pid :: Text
pid = "browserid"
complete :: Route Auth
complete = PluginR pid []
forwardUrl :: AuthRoute
forwardUrl = PluginR pid []
-- | Log into browser ID with an audience value determined from the 'approot'.
authBrowserId :: YesodAuth m => AuthPlugin m
authBrowserId = helper Nothing
complete :: AuthRoute
complete = forwardUrl
-- | Log into browser ID with the given audience value. Note that this must be
-- your actual hostname, or login will fail.
authBrowserIdAudience
:: YesodAuth m
=> Text -- ^ audience
-> AuthPlugin m
authBrowserIdAudience = helper . Just
-- | A settings type for various configuration options relevant to BrowserID.
--
-- See: <http://www.yesodweb.com/book/settings-types>
--
-- Since 1.2.0
data BrowserIdSettings = BrowserIdSettings
{ bisAudience :: Maybe Text
-- ^ BrowserID audience value. If @Nothing@, will be extracted based on the
-- approot.
--
-- Default: @Nothing@
--
-- Since 1.2.0
, bisLazyLoad :: Bool
-- ^ Use asynchronous Javascript loading for the BrowserID JS file.
--
-- Default: @True@.
--
-- Since 1.2.0
}
helper :: YesodAuth m
=> Maybe Text -- ^ audience
-> AuthPlugin m
helper maudience = AuthPlugin
instance Default BrowserIdSettings where
def = BrowserIdSettings
{ bisAudience = Nothing
, bisLazyLoad = True
}
authBrowserId :: YesodAuth m => BrowserIdSettings -> AuthPlugin m
authBrowserId bis@BrowserIdSettings {..} = AuthPlugin
{ apName = pid
, apDispatch = \m ps ->
case (m, ps) of
("GET", [assertion]) -> do
master <- getYesod
audience <-
case maudience of
case bisAudience of
Just a -> return a
Nothing -> do
tm <- getRouteToMaster
r <- getUrlRender
tm <- getRouteToParent
return $ T.takeWhile (/= '/') $ stripScheme $ r $ tm LoginR
memail <- lift $ checkAssertion audience assertion (authHttpManager master)
manager <- authHttpManager
memail <- checkAssertion audience assertion manager
case memail of
Nothing -> liftIO $ throwIO InvalidBrowserIDAssertion
Just email -> setCreds True Creds
Nothing -> do
$logErrorS "yesod-auth" "BrowserID assertion failure"
tm <- getRouteToParent
loginErrorMessage (tm LoginR) "BrowserID login error."
Just email -> setCredsRedirect Creds
{ credsPlugin = pid
, credsIdent = email
, credsExtra = []
}
("GET", ["static", "sign-in.png"]) -> sendResponse
( "image/png" :: ByteString
, toContent $(embedFile "persona_sign_in_blue.png")
)
(_, []) -> badMethod
_ -> notFound
, apLogin = \toMaster -> do
addScriptRemote browserIdJs
addHamlet [QQ(hamlet)|
onclick <- createOnClick bis toMaster
autologin <- fmap (== Just "true") $ lookupGetParam "autologin"
when autologin $ toWidget [julius|#{rawJS onclick}();|]
toWidget [hamlet|
$newline never
<p>
<a href="javascript:navigator.id.getVerifiedEmail(function(a){if(a)document.location='@{toMaster complete}/'+a});">
<img src="https://browserid.org/i/sign_in_green.png">
<a href="javascript:#{onclick}()">
<img src=@{toMaster loginIcon}>
|]
}
where
loginIcon = PluginR pid ["static", "sign-in.png"]
stripScheme t = fromMaybe t $ T.stripPrefix "//" $ snd $ T.breakOn "//" t
-- | Generates a function to handle on-click events, and returns that function
-- name.
createOnClickOverride :: BrowserIdSettings
-> (Route Auth -> Route master)
-> Maybe (Route master)
-> WidgetFor master Text
createOnClickOverride BrowserIdSettings {..} toMaster mOnRegistration = do
unless bisLazyLoad $ addScriptRemote browserIdJs
onclick <- newIdent
render <- getUrlRender
let login = toJSON $ getPath $ render loginRoute -- (toMaster LoginR)
loginRoute = maybe (toMaster LoginR) id mOnRegistration
toWidget [julius|
function #{rawJS onclick}() {
if (navigator.id) {
navigator.id.watch({
onlogin: function (assertion) {
if (assertion) {
document.location = "@{toMaster complete}/" + assertion;
}
},
onlogout: function () {}
});
navigator.id.request({
returnTo: #{login} + "?autologin=true"
});
}
else {
alert("Loading, please try again");
}
}
|]
when bisLazyLoad $ toWidget [julius|
(function(){
var bid = document.createElement("script");
bid.async = true;
bid.src = #{toJSON browserIdJs};
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(bid, s);
})();
|]
autologin <- fmap (== Just "true") $ lookupGetParam "autologin"
when autologin $ toWidget [julius|#{rawJS onclick}();|]
return onclick
where
getPath t = fromMaybe t $ do
uri <- parseURI $ T.unpack t
return $ T.pack $ uriPath uri
-- | Generates a function to handle on-click events, and returns that function
-- name.
createOnClick :: BrowserIdSettings
-> (Route Auth -> Route master)
-> WidgetFor master Text
createOnClick bidSettings toMaster = createOnClickOverride bidSettings toMaster Nothing

View File

@ -1,34 +1,77 @@
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
-- | 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.
-- their identifier. This is not intended for real world use, just for
-- testing. This plugin supports form submissions via JSON (since 1.6.8).
--
-- = Using the JSON Login Endpoint
--
-- We are assuming that you have declared `authRoute` as follows
--
-- @
-- Just $ AuthR LoginR
-- @
--
-- If you are using a different one, then you have to adjust the
-- endpoint accordingly.
--
-- @
-- Endpoint: \/auth\/page\/dummy
-- Method: POST
-- JSON Data: {
-- "ident": "my identifier"
-- }
-- @
--
-- Remember to add the following headers:
--
-- - Accept: application\/json
-- - Content-Type: application\/json
module Yesod.Auth.Dummy
( authDummy
) where
#include "qq.h"
import Data.Aeson.Types (Parser, Result (..))
import qualified Data.Aeson.Types as A (parseEither, withObject)
import Data.Text (Text)
import Yesod.Auth
import Yesod.Core
import Yesod.Form (ireq, runInputPost, textField)
import Yesod.Auth
import Yesod.Form (runInputPost, textField, ireq)
import Yesod.Handler (notFound)
import Text.Hamlet (hamlet)
import Yesod.Widget (addHamlet)
identParser :: Value -> Parser Text
identParser = A.withObject "Ident" (.: "ident")
authDummy :: YesodAuth m => AuthPlugin m
authDummy =
AuthPlugin "dummy" dispatch login
where
dispatch :: Text -> [Text] -> AuthHandler m TypedContent
dispatch "POST" [] = do
ident <- runInputPost $ ireq textField "ident"
setCreds True $ Creds "dummy" ident []
(jsonResult :: Result Value) <- parseCheckJsonBody
eIdent <- case jsonResult of
Success val -> return $ A.parseEither identParser val
Error err -> return $ Left err
case eIdent of
Right ident ->
setCredsRedirect $ Creds "dummy" ident []
Left _ -> do
ident <- runInputPost $ ireq textField "ident"
setCredsRedirect $ Creds "dummy" ident []
dispatch _ _ = notFound
url = PluginR "dummy" []
login authToMaster =
addHamlet [QQ(hamlet)|
login authToMaster = do
request <- getRequest
toWidget [hamlet|
$newline never
<form method="post" action="@{authToMaster url}">
\Your new identifier is:
$maybe t <- reqToken request
<input type=hidden name=#{defaultCsrfParamName} value=#{t}>
Your new identifier is: #
<input type="text" name="ident">
<input type="submit" value="Dummy Login">
|]

File diff suppressed because it is too large Load Diff

View File

@ -1,101 +0,0 @@
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}
-- | 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
-- as a login system. By using this plugin, you are trusting Google to validate
-- an email address, and requiring users to have a Google account. On the plus
-- side, you get to use email addresses as the identifier, many users have
-- existing Google accounts, the login system has been long tested (as opposed
-- to BrowserID), and it requires no credential managing or setup (as opposed
-- to Email).
module Yesod.Auth.GoogleEmail
( authGoogleEmail
, forwardUrl
) where
import Yesod.Auth
import qualified Web.Authenticate.OpenId as OpenId
import Yesod.Form
import Yesod.Handler
import Yesod.Widget
import Yesod.Request
import Text.Blaze (toHtml)
import Data.Text (Text)
import qualified Yesod.Auth.Message as Msg
import qualified Data.Text as T
import Control.Exception.Lifted (try, SomeException)
forwardUrl :: AuthRoute
forwardUrl = PluginR "googleemail" ["forward"]
authGoogleEmail :: YesodAuth m => AuthPlugin m
authGoogleEmail =
AuthPlugin "googleemail" dispatch login
where
complete = PluginR "googleemail" ["complete"]
name = "openid_identifier"
login tm = do
[whamlet|
<form method=get action=@{tm forwardUrl}>
<input type=hidden name=openid_identifier value=https://www.google.com/accounts/o8/id>
<input type=submit value=_{Msg.LoginGoogle}>
|]
dispatch "GET" ["forward"] = do
roid <- runInputGet $ iopt textField name
case roid of
Just oid -> do
render <- getUrlRender
toMaster <- getRouteToMaster
let complete' = render $ toMaster complete
master <- getYesod
eres <- lift $ try $ OpenId.getForwardUrl oid complete' Nothing
[ ("openid.ax.type.email", "http://schema.openid.net/contact/email")
, ("openid.ns.ax", "http://openid.net/srv/ax/1.0")
, ("openid.ns.ax.required", "email")
, ("openid.ax.mode", "fetch_request")
, ("openid.ax.required", "email")
, ("openid.ui.icon", "true")
] (authHttpManager master)
either
(\err -> do
setMessage $ toHtml $ show (err :: SomeException)
redirect $ toMaster LoginR
)
redirect
eres
Nothing -> do
toMaster <- getRouteToMaster
setMessageI Msg.NoOpenID
redirect $ toMaster LoginR
dispatch "GET" ["complete", ""] = dispatch "GET" ["complete"] -- compatibility issues
dispatch "GET" ["complete"] = do
rr <- getRequest
completeHelper $ reqGetParams rr
dispatch "POST" ["complete", ""] = dispatch "POST" ["complete"] -- compatibility issues
dispatch "POST" ["complete"] = do
(posts, _) <- runRequestBody
completeHelper posts
dispatch _ _ = notFound
completeHelper :: YesodAuth m => [(Text, Text)] -> GHandler Auth m ()
completeHelper gets' = do
master <- getYesod
eres <- lift $ try $ OpenId.authenticate gets' (authHttpManager master)
toMaster <- getRouteToMaster
let onFailure err = do
setMessage $ toHtml $ show (err :: SomeException)
redirect $ toMaster LoginR
let onSuccess (OpenId.Identifier ident, _) = do
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 []
(_, False) -> do
setMessage "Only Google login is supported"
redirect $ toMaster LoginR
(Nothing, _) -> do
setMessage "No email address provided"
redirect $ toMaster LoginR
either onFailure onSuccess eres

View File

@ -0,0 +1,616 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeFamilies #-}
-- | Use an email address as an identifier via Google's login system.
--
-- Note that this is a replacement for "Yesod.Auth.GoogleEmail", which depends
-- on Google's now deprecated OpenID system. For more information, see
-- <https://developers.google.com/+/api/auth-migration>.
--
-- By using this plugin, you are trusting Google to validate an email address,
-- and requiring users to have a Google account. On the plus side, you get to
-- use email addresses as the identifier, many users have existing Google
-- accounts, the login system has been long tested (as opposed to BrowserID),
-- and it requires no credential managing or setup (as opposed to Email).
--
-- In order to use this plugin:
--
-- * Create an application on the Google Developer Console <https://console.developers.google.com/>
--
-- * Create OAuth credentials. The redirect URI will be <http://yourdomain/auth/page/googleemail2/complete>. (If you have your authentication subsite at a different root than \/auth\/, please adjust accordingly.)
--
-- * Enable the Google+ API.
--
-- @since 1.3.1
module Yesod.Auth.GoogleEmail2
{-# DEPRECATED "Google+ is being shut down, please migrate to Google Sign-in https://pbrisbin.com/posts/googleemail2_deprecation/" #-}
( -- * Authentication handlers
authGoogleEmail
, authGoogleEmailSaveToken
, forwardUrl
-- * User authentication token
, Token(..)
, getUserAccessToken
-- * Person
, getPerson
, Person(..)
, Name(..)
, Gender(..)
, PersonImage(..)
, resizePersonImage
, RelationshipStatus(..)
, PersonURI(..)
, PersonURIType(..)
, Organization(..)
, OrganizationType(..)
, Place(..)
, Email(..)
, EmailType(..)
-- * Other functions
, pid
) where
import Yesod.Auth (Auth, AuthHandler,
AuthPlugin (AuthPlugin),
AuthRoute, Creds (Creds),
Route (PluginR), YesodAuth,
logoutDest, runHttpRequest,
setCredsRedirect)
import qualified Yesod.Auth.Message as Msg
import Yesod.Core (HandlerSite, MonadHandler,
TypedContent, addMessage,
getRouteToParent, getUrlRender,
getYesod, invalidArgs, liftIO,
liftSubHandler, lookupGetParam,
lookupSession, notFound, redirect,
setSession, toHtml, whamlet, (.:))
import Blaze.ByteString.Builder (fromByteString, toByteString)
import Control.Applicative ((<$>), (<*>))
import Control.Arrow (second)
import Control.Monad (unless, when)
import Control.Monad.IO.Class (MonadIO)
import qualified Crypto.Nonce as Nonce
import Data.Aeson ((.:?))
import qualified Data.Aeson as A
#if MIN_VERSION_aeson(1,0,0)
import qualified Data.Aeson.Text as A
#else
import qualified Data.Aeson.Encode as A
#endif
import Data.Aeson.Parser (json')
import Data.Aeson.Types (FromJSON (parseJSON), parseEither,
parseMaybe, withObject, withText)
import Data.Conduit
import Data.Conduit.Attoparsec (sinkParser)
import Data.Maybe (fromMaybe)
import Data.Monoid (mappend)
import Data.Text (Text)
import qualified Data.Text as T
import Data.Text.Encoding (decodeUtf8, encodeUtf8)
import qualified Data.Text.Lazy as TL
import qualified Data.Text.Lazy.Builder as TL
import Network.HTTP.Client (Manager, requestHeaders,
responseBody, urlEncodedBody)
import qualified Network.HTTP.Client as HTTP
import Network.HTTP.Client.Conduit (Request, bodyReaderSource)
import Network.HTTP.Conduit (http)
import Network.HTTP.Types (renderQueryText)
import System.IO.Unsafe (unsafePerformIO)
#if MIN_VERSION_aeson(2, 0, 0)
import qualified Data.Aeson.Key
import qualified Data.Aeson.KeyMap
#else
import qualified Data.HashMap.Strict as M
#endif
-- | Plugin identifier. This is used to identify the plugin used for
-- authentication. The 'credsPlugin' will contain this value when this
-- plugin is used for authentication.
-- @since 1.4.17
pid :: Text
pid = "googleemail2"
forwardUrl :: AuthRoute
forwardUrl = PluginR pid ["forward"]
csrfKey :: Text
csrfKey = "_GOOGLE_CSRF_TOKEN"
getCsrfToken :: MonadHandler m => m (Maybe Text)
getCsrfToken = lookupSession csrfKey
accessTokenKey :: Text
accessTokenKey = "_GOOGLE_ACCESS_TOKEN"
-- | Get user's access token from the session. Returns Nothing if it's not found
-- (probably because the user is not logged in via 'Yesod.Auth.GoogleEmail2'
-- or you are not using 'authGoogleEmailSaveToken')
getUserAccessToken :: MonadHandler m => m (Maybe Token)
getUserAccessToken = fmap (\t -> Token t "Bearer") <$> lookupSession accessTokenKey
getCreateCsrfToken :: MonadHandler m => m Text
getCreateCsrfToken = do
mtoken <- getCsrfToken
case mtoken of
Just token -> return token
Nothing -> do
token <- Nonce.nonce128urlT defaultNonceGen
setSession csrfKey token
return token
authGoogleEmail :: YesodAuth m
=> Text -- ^ client ID
-> Text -- ^ client secret
-> AuthPlugin m
authGoogleEmail = authPlugin False
-- | An alternative version which stores user access token in the session
-- variable. Use it if you want to request user's profile from your app.
--
-- @since 1.4.3
authGoogleEmailSaveToken :: YesodAuth m
=> Text -- ^ client ID
-> Text -- ^ client secret
-> AuthPlugin m
authGoogleEmailSaveToken = authPlugin True
authPlugin :: YesodAuth m
=> Bool -- ^ if the token should be stored
-> Text -- ^ client ID
-> Text -- ^ client secret
-> AuthPlugin m
authPlugin storeToken clientID clientSecret =
AuthPlugin pid dispatch login
where
complete = PluginR pid ["complete"]
getDest :: MonadHandler m
=> (Route Auth -> Route (HandlerSite m))
-> m Text
getDest tm = do
csrf <- getCreateCsrfToken
render <- getUrlRender
let qs = map (second Just)
[ ("scope", "email profile")
, ("state", csrf)
, ("redirect_uri", render $ tm complete)
, ("response_type", "code")
, ("client_id", clientID)
, ("access_type", "offline")
]
return $ decodeUtf8
$ toByteString
$ fromByteString "https://accounts.google.com/o/oauth2/auth"
`Data.Monoid.mappend` renderQueryText True qs
login tm = do
[whamlet|<a href=@{tm forwardUrl}>_{Msg.LoginGoogle}|]
dispatch :: YesodAuth site
=> Text
-> [Text]
-> AuthHandler site TypedContent
dispatch "GET" ["forward"] = do
tm <- getRouteToParent
getDest tm >>= redirect
dispatch "GET" ["complete"] = do
mstate <- lookupGetParam "state"
case mstate of
Nothing -> invalidArgs ["CSRF state from Google is missing"]
Just state -> do
mtoken <- getCsrfToken
unless (Just state == mtoken) $ invalidArgs ["Invalid CSRF token from Google"]
mcode <- lookupGetParam "code"
code <-
case mcode of
Nothing -> do
merr <- lookupGetParam "error"
case merr of
Nothing -> invalidArgs ["Missing code paramter"]
Just err -> do
master <- getYesod
let msg =
case err of
"access_denied" -> "Access denied"
_ -> "Unknown error occurred: " `T.append` err
addMessage "error" $ toHtml msg
redirect $ logoutDest master
Just c -> return c
render <- getUrlRender
tm <- getRouteToParent
req' <- liftIO $
HTTP.parseUrlThrow
"https://accounts.google.com/o/oauth2/token" -- FIXME don't hardcode, use: https://accounts.google.com/.well-known/openid-configuration
let req =
urlEncodedBody
[ ("code", encodeUtf8 code)
, ("client_id", encodeUtf8 clientID)
, ("client_secret", encodeUtf8 clientSecret)
, ("redirect_uri", encodeUtf8 $ render $ tm complete)
, ("grant_type", "authorization_code")
]
req'
{ requestHeaders = []
}
value <- makeHttpRequest req
token@(Token accessToken' tokenType') <-
case parseEither parseJSON value of
Left e -> error e
Right t -> return t
unless (tokenType' == "Bearer") $ error $ "Unknown token type: " ++ show tokenType'
-- User's access token is saved for further access to API
when storeToken $ setSession accessTokenKey accessToken'
personValReq <- personValueRequest token
personValue <- makeHttpRequest personValReq
person <- case parseEither parseJSON personValue of
Left e -> error e
Right x -> return x
email <-
case map emailValue $ filter (\e -> emailType e == EmailAccount) $ personEmails person of
[e] -> return e
[] -> error "No account email"
x -> error $ "Too many account emails: " ++ show x
setCredsRedirect $ Creds pid email $ allPersonInfo personValue
dispatch _ _ = notFound
makeHttpRequest :: Request -> AuthHandler site A.Value
makeHttpRequest req =
liftSubHandler $ runHttpRequest req $ \res ->
runConduit $ bodyReaderSource (responseBody res) .| sinkParser json'
-- | Allows to fetch information about a user from Google's API.
-- In case of parsing error returns 'Nothing'.
-- Will throw 'HttpException' in case of network problems or error response code.
--
-- @since 1.4.3
getPerson :: MonadHandler m => Manager -> Token -> m (Maybe Person)
getPerson manager token = liftSubHandler $ parseMaybe parseJSON <$> (do
req <- personValueRequest token
res <- http req manager
runConduit $ responseBody res .| sinkParser json'
)
personValueRequest :: MonadIO m => Token -> m Request
personValueRequest token = do
req2' <- liftIO
$ HTTP.parseUrlThrow "https://www.googleapis.com/plus/v1/people/me"
return req2'
{ requestHeaders =
[ ("Authorization", encodeUtf8 $ "Bearer " `mappend` accessToken token)
]
}
--------------------------------------------------------------------------------
-- | An authentication token which was acquired from OAuth callback.
-- The token gets saved into the session storage only if you use
-- 'authGoogleEmailSaveToken'.
-- You can acquire saved token with 'getUserAccessToken'.
--
-- @since 1.4.3
data Token = Token { accessToken :: Text
, tokenType :: Text
} deriving (Show, Eq)
instance FromJSON Token where
parseJSON = withObject "Tokens" $ \o -> Token
Control.Applicative.<$> o .: "access_token"
Control.Applicative.<*> o .: "token_type"
--------------------------------------------------------------------------------
-- | Gender of the person
--
-- @since 1.4.3
data Gender = Male | Female | OtherGender deriving (Show, Eq)
instance FromJSON Gender where
parseJSON = withText "Gender" $ \t -> return $ case t of
"male" -> Male
"female" -> Female
_ -> OtherGender
--------------------------------------------------------------------------------
-- | URIs specified in the person's profile
--
-- @since 1.4.3
data PersonURI =
PersonURI { uriLabel :: Maybe Text
, uriValue :: Maybe Text
, uriType :: Maybe PersonURIType
} deriving (Show, Eq)
instance FromJSON PersonURI where
parseJSON = withObject "PersonURI" $ \o -> PersonURI <$> o .:? "label"
<*> o .:? "value"
<*> o .:? "type"
--------------------------------------------------------------------------------
-- | The type of URI
--
-- @since 1.4.3
data PersonURIType = OtherProfile -- ^ URI for another profile
| Contributor -- ^ URI to a site for which this person is a contributor
| Website -- ^ URI for this Google+ Page's primary website
| OtherURI -- ^ Other URL
| PersonURIType Text -- ^ Something else
deriving (Show, Eq)
instance FromJSON PersonURIType where
parseJSON = withText "PersonURIType" $ \t -> return $ case t of
"otherProfile" -> OtherProfile
"contributor" -> Contributor
"website" -> Website
"other" -> OtherURI
_ -> PersonURIType t
--------------------------------------------------------------------------------
-- | Current or past organizations with which this person is associated
--
-- @since 1.4.3
data Organization =
Organization { orgName :: Maybe Text
-- ^ The person's job title or role within the organization
, orgTitle :: Maybe Text
, orgType :: Maybe OrganizationType
-- ^ The date that the person joined this organization.
, orgStartDate :: Maybe Text
-- ^ The date that the person left this organization.
, orgEndDate :: Maybe Text
-- ^ If @True@, indicates this organization is the person's
-- ^ primary one, which is typically interpreted as the current one.
, orgPrimary :: Maybe Bool
} deriving (Show, Eq)
instance FromJSON Organization where
parseJSON = withObject "Organization" $ \o ->
Organization <$> o .:? "name"
<*> o .:? "title"
<*> o .:? "type"
<*> o .:? "startDate"
<*> o .:? "endDate"
<*> o .:? "primary"
--------------------------------------------------------------------------------
-- | The type of an organization
--
-- @since 1.4.3
data OrganizationType = Work
| School
| OrganizationType Text -- ^ Something else
deriving (Show, Eq)
instance FromJSON OrganizationType where
parseJSON = withText "OrganizationType" $ \t -> return $ case t of
"work" -> Work
"school" -> School
_ -> OrganizationType t
--------------------------------------------------------------------------------
-- | A place where the person has lived or is living at the moment.
--
-- @since 1.4.3
data Place =
Place { -- | A place where this person has lived. For example: "Seattle, WA", "Near Toronto".
placeValue :: Maybe Text
-- | If @True@, this place of residence is this person's primary residence.
, placePrimary :: Maybe Bool
} deriving (Show, Eq)
instance FromJSON Place where
parseJSON = withObject "Place" $ \o -> Place <$> (o .:? "value") <*> (o .:? "primary")
--------------------------------------------------------------------------------
-- | Individual components of a name
--
-- @since 1.4.3
data Name =
Name { -- | The full name of this person, including middle names, suffixes, etc
nameFormatted :: Maybe Text
-- | The family name (last name) of this person
, nameFamily :: Maybe Text
-- | The given name (first name) of this person
, nameGiven :: Maybe Text
-- | The middle name of this person.
, nameMiddle :: Maybe Text
-- | The honorific prefixes (such as "Dr." or "Mrs.") for this person
, nameHonorificPrefix :: Maybe Text
-- | The honorific suffixes (such as "Jr.") for this person
, nameHonorificSuffix :: Maybe Text
} deriving (Show, Eq)
instance FromJSON Name where
parseJSON = withObject "Name" $ \o -> Name <$> o .:? "formatted"
<*> o .:? "familyName"
<*> o .:? "givenName"
<*> o .:? "middleName"
<*> o .:? "honorificPrefix"
<*> o .:? "honorificSuffix"
--------------------------------------------------------------------------------
-- | The person's relationship status.
--
-- @since 1.4.3
data RelationshipStatus = Single -- ^ Person is single
| InRelationship -- ^ Person is in a relationship
| Engaged -- ^ Person is engaged
| Married -- ^ Person is married
| Complicated -- ^ The relationship is complicated
| OpenRelationship -- ^ Person is in an open relationship
| Widowed -- ^ Person is widowed
| DomesticPartnership -- ^ Person is in a domestic partnership
| CivilUnion -- ^ Person is in a civil union
| RelationshipStatus Text -- ^ Something else
deriving (Show, Eq)
instance FromJSON RelationshipStatus where
parseJSON = withText "RelationshipStatus" $ \t -> return $ case t of
"single" -> Single
"in_a_relationship" -> InRelationship
"engaged" -> Engaged
"married" -> Married
"its_complicated" -> Complicated
"open_relationship" -> OpenRelationship
"widowed" -> Widowed
"in_domestic_partnership" -> DomesticPartnership
"in_civil_union" -> CivilUnion
_ -> RelationshipStatus t
--------------------------------------------------------------------------------
-- | The URI of the person's profile photo.
--
-- @since 1.4.3
newtype PersonImage = PersonImage { imageUri :: Text } deriving (Show, Eq)
instance FromJSON PersonImage where
parseJSON = withObject "PersonImage" $ \o -> PersonImage <$> o .: "url"
-- | @resizePersonImage img 30@ would set query part to @?sz=30@ which would resize
-- the image under the URI. If for some reason you need to modify the query
-- part, you should do it after resizing.
--
-- @since 1.4.3
resizePersonImage :: PersonImage -> Int -> PersonImage
resizePersonImage (PersonImage uri) size =
PersonImage $ uri `mappend` "?sz=" `mappend` T.pack (show size)
--------------------------------------------------------------------------------
-- | Information about the user
-- Full description of the resource https://developers.google.com/+/api/latest/people
--
-- @since 1.4.3
data Person = Person
{ personId :: Text
-- | The name of this person, which is suitable for display
, personDisplayName :: Maybe Text
, personName :: Maybe Name
, personNickname :: Maybe Text
, personBirthday :: Maybe Text -- ^ Birthday formatted as YYYY-MM-DD
, personGender :: Maybe Gender
, personProfileUri :: Maybe Text -- ^ The URI of this person's profile
, personImage :: Maybe PersonImage
, personAboutMe :: Maybe Text -- ^ A short biography for this person
, personRelationshipStatus :: Maybe RelationshipStatus
, personUris :: [PersonURI]
, personOrganizations :: [Organization]
, personPlacesLived :: [Place]
-- | The brief description of this person
, personTagline :: Maybe Text
-- | Whether this user has signed up for Google+
, personIsPlusUser :: Maybe Bool
-- | The "bragging rights" line of this person
, personBraggingRights :: Maybe Text
-- | if a Google+ page, the number of people who have +1'd this page
, personPlusOneCount :: Maybe Int
-- | For followers who are visible, the number of people who have added
-- this person or page to a circle.
, personCircledByCount :: Maybe Int
-- | Whether the person or Google+ Page has been verified. This is used only
-- for pages with a higher risk of being impersonated or similar. This
-- flag will not be present on most profiles.
, personVerified :: Maybe Bool
-- | The user's preferred language for rendering.
, personLanguage :: Maybe Text
, personEmails :: [Email]
, personDomain :: Maybe Text
, personOccupation :: Maybe Text -- ^ The occupation of this person
, personSkills :: Maybe Text -- ^ The person's skills
} deriving (Show, Eq)
instance FromJSON Person where
parseJSON = withObject "Person" $ \o ->
Person <$> o .: "id"
<*> o .: "displayName"
<*> o .:? "name"
<*> o .:? "nickname"
<*> o .:? "birthday"
<*> o .:? "gender"
<*> (o .:? "url")
<*> o .:? "image"
<*> o .:? "aboutMe"
<*> o .:? "relationshipStatus"
<*> ((fromMaybe []) <$> (o .:? "urls"))
<*> ((fromMaybe []) <$> (o .:? "organizations"))
<*> ((fromMaybe []) <$> (o .:? "placesLived"))
<*> o .:? "tagline"
<*> o .:? "isPlusUser"
<*> o .:? "braggingRights"
<*> o .:? "plusOneCount"
<*> o .:? "circledByCount"
<*> o .:? "verified"
<*> o .:? "language"
<*> ((fromMaybe []) <$> (o .:? "emails"))
<*> o .:? "domain"
<*> o .:? "occupation"
<*> o .:? "skills"
--------------------------------------------------------------------------------
-- | Person's email
--
-- @since 1.4.3
data Email = Email
{ emailValue :: Text
, emailType :: EmailType
}
deriving (Show, Eq)
instance FromJSON Email where
parseJSON = withObject "Email" $ \o -> Email
<$> o .: "value"
<*> o .: "type"
--------------------------------------------------------------------------------
-- | Type of email
--
-- @since 1.4.3
data EmailType = EmailAccount -- ^ Google account email address
| EmailHome -- ^ Home email address
| EmailWork -- ^ Work email adress
| EmailOther -- ^ Other email address
| EmailType Text -- ^ Something else
deriving (Show, Eq)
instance FromJSON EmailType where
parseJSON = withText "EmailType" $ \t -> return $ case t of
"account" -> EmailAccount
"home" -> EmailHome
"work" -> EmailWork
"other" -> EmailOther
_ -> EmailType t
allPersonInfo :: A.Value -> [(Text, Text)]
allPersonInfo (A.Object o) = map enc $ mapToList o
where
enc (key, A.String s) = (keyToText key, s)
enc (key, v) = (keyToText key, TL.toStrict $ TL.toLazyText $ A.encodeToTextBuilder v)
#if MIN_VERSION_aeson(2, 0, 0)
keyToText = Data.Aeson.Key.toText
mapToList = Data.Aeson.KeyMap.toList
#else
keyToText = id
mapToList = M.toList
#endif
allPersonInfo _ = []
-- See https://github.com/yesodweb/yesod/issues/1245 for discussion on this
-- use of unsafePerformIO.
defaultNonceGen :: Nonce.Generator
defaultNonceGen = unsafePerformIO (Nonce.new)
{-# NOINLINE defaultNonceGen #-}

View File

@ -0,0 +1,199 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
{-|
Module : Yesod.Auth.Hardcoded
Description : Very simple auth plugin for hardcoded auth pairs.
Copyright : (c) Arthur Fayzrakhmanov, 2015
License : MIT
Maintainer : heraldhoi@gmail.com
Stability : experimental
Sometimes you may want to have some hardcoded set of users (e.g. site managers)
that allowed to log in and visit some specific sections of your website without
ability to register new managers. This simple plugin is designed exactly for
this purpose.
Here is a quick usage example.
== Define hardcoded users representation
Let's assume, that we want to have some hardcoded managers with normal site
users. Let's define hardcoded user representation:
@
data SiteManager = SiteManager
{ manUserName :: Text
, manPassWord :: Text }
deriving Show
siteManagers :: [SiteManager]
siteManagers = [SiteManager "content editor" "top secret"]
@
== Describe 'YesodAuth' instance
Now we need to have some convenient 'AuthId' type representing both
cases:
@
instance YesodAuth App where
type AuthId App = Either UserId Text
@
Here, right @Text@ value will present hardcoded user name (which obviously must
be unique).
'AuthId' must have an instance of 'PathPiece' class, this is needed to store
user identifier in session (this happens in 'setCreds' and 'setCredsRedirect'
actions) and to read that identifier from session (this happens in
`defaultMaybeAuthId` action). So we have to define it:
@
import Text.Read (readMaybe)
instance PathPiece (Either UserId Text) where
fromPathPiece = readMaybe . unpack
toPathPiece = pack . show
@
Quiet simple so far. Now let's add plugin to 'authPlugins' list, and define
'authenticate' method, it should return user identifier for given credentials,
for normal users it is usually persistent key, for hardcoded users we will
return user name again.
@
instance YesodAuth App where
-- ..
authPlugins _ = [authHardcoded]
authenticate Creds{..} =
return
(case credsPlugin of
"hardcoded" ->
case lookupUser credsIdent of
Nothing -> UserError InvalidLogin
Just m -> Authenticated (Right (manUserName m)))
@
Here @lookupUser@ is just a helper function to lookup hardcoded users by name:
@
lookupUser :: Text -> Maybe SiteManager
lookupUser username = find (\\m -> manUserName m == username) siteManagers
@
== Describe an 'YesodAuthPersist' instance
Now we need to manually define 'YesodAuthPersist' instance.
> instance YesodAuthPersist App where
> type AuthEntity App = Either User SiteManager
>
> getAuthEntity (Left uid) =
> do x <- runDB (get uid)
> return (Left <$> x)
> getAuthEntity (Right username) = return (Right <$> lookupUser username)
== Define 'YesodAuthHardcoded' instance
Finally, let's define an plugin instance
@
instance YesodAuthHardcoded App where
validatePassword u = return . validPassword u
doesUserNameExist = return . isJust . lookupUser
validPassword :: Text -> Text -> Bool
validPassword u p =
case find (\\m -> manUserName m == u && manPassWord m == p) siteManagers of
Just _ -> True
_ -> False
@
== Conclusion
Now we can use 'maybeAuthId', 'maybeAuthPair', 'requireAuthId', and
'requireAuthPair', moreover, the returned value makes possible to distinguish
normal users and site managers.
-}
module Yesod.Auth.Hardcoded
( YesodAuthHardcoded(..)
, authHardcoded
, loginR )
where
import Yesod.Auth (AuthHandler, AuthPlugin (..), AuthRoute,
Creds (..), Route (..), YesodAuth,
loginErrorMessageI, setCredsRedirect)
import qualified Yesod.Auth.Message as Msg
import Yesod.Core
import Yesod.Form (ireq, runInputPost, textField)
import Control.Applicative ((<$>), (<*>))
import Data.Text (Text)
loginR :: AuthRoute
loginR = PluginR "hardcoded" ["login"]
class (YesodAuth site) => YesodAuthHardcoded site where
-- | Check whether given user name exists among hardcoded names.
doesUserNameExist :: Text -> AuthHandler site Bool
-- | Validate given user name with given password.
validatePassword :: Text -> Text -> AuthHandler site Bool
authHardcoded :: YesodAuthHardcoded m => AuthPlugin m
authHardcoded =
AuthPlugin "hardcoded" dispatch loginWidget
where
dispatch :: YesodAuthHardcoded m => Text -> [Text] -> AuthHandler m TypedContent
dispatch "POST" ["login"] = postLoginR >>= sendResponse
dispatch _ _ = notFound
loginWidget toMaster = do
request <- getRequest
[whamlet|
$newline never
<form method="post" action="@{toMaster loginR}">
$maybe t <- reqToken request
<input type=hidden name=#{defaultCsrfParamName} value=#{t}>
<table>
<tr>
<th>_{Msg.UserName}
<td>
<input type="text" name="username" required>
<tr>
<th>_{Msg.Password}
<td>
<input type="password" name="password" required>
<tr>
<td colspan="2">
<button type="submit" .btn .btn-success>_{Msg.LoginTitle}
|]
postLoginR :: YesodAuthHardcoded site
=> AuthHandler site TypedContent
postLoginR =
do (username, password) <- runInputPost
((,) Control.Applicative.<$> ireq textField "username"
Control.Applicative.<*> ireq textField "password")
isValid <- validatePassword username password
if isValid
then setCredsRedirect (Creds "hardcoded" username [])
else do isExists <- doesUserNameExist username
loginErrorMessageI LoginR
(if isExists
then Msg.InvalidUsernamePass
else Msg.IdentifierNotFound username)

View File

@ -1,277 +0,0 @@
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE GADTs #-}
-------------------------------------------------------------------------------
-- |
-- Module : Yesod.Auth.HashDB
-- Copyright : (c) Patrick Brisbin 2010
-- License : as-is
--
-- Maintainer : pbrisbin@gmail.com
-- Stability : Stable
-- Portability : Portable
--
-- A yesod-auth AuthPlugin designed to look users up in Persist where
-- their user id's and a salted SHA1 hash of their password is stored.
--
-- Example usage:
--
-- > -- import the function
-- > import Auth.HashDB
-- >
-- > -- make sure you have an auth route
-- > mkYesodData "MyApp" [$parseRoutes|
-- > / RootR GET
-- > /auth AuthR Auth getAuth
-- > |]
-- >
-- >
-- > -- make your app an instance of YesodAuth using this plugin
-- > instance YesodAuth MyApp where
-- > type AuthId MyApp = UserId
-- >
-- > loginDest _ = RootR
-- > logoutDest _ = RootR
-- > getAuthId = getAuthIdHashDB AuthR (Just . UniqueUser)
-- > authPlugins = [authHashDB (Just . UniqueUser)]
-- >
-- >
-- > -- include the migration function in site startup
-- > withServer :: (Application -> IO a) -> IO a
-- > withServer f = withConnectionPool $ \p -> do
-- > runSqlPool (runMigration migrateUsers) p
-- > let h = DevSite p
--
-- Note that function which converts username to unique identifier must be same.
--
-- Your app must be an instance of YesodPersist. and the username,
-- salt and hashed-passwords should be added to the database.
--
-- > echo -n 'MySaltMyPassword' | sha1sum
--
-- can be used to get the hash from the commandline.
--
-------------------------------------------------------------------------------
module Yesod.Auth.HashDB
( HashDBUser(..)
, Unique (..)
, setPassword
-- * Authentification
, validateUser
, authHashDB
, getAuthIdHashDB
-- * Predefined data type
, User
, UserGeneric (..)
, UserId
, migrateUsers
) where
#include "qq.h"
import Yesod.Persist
import Yesod.Handler
import Yesod.Form
import Yesod.Auth
import Yesod.Widget (addHamlet)
import Text.Hamlet (hamlet, shamlet)
import Control.Applicative ((<$>), (<*>))
import Control.Monad (replicateM,liftM)
import Control.Monad.IO.Class (MonadIO, liftIO)
import qualified Data.ByteString.Lazy.Char8 as BS (pack)
import Data.Digest.Pure.SHA (sha1, showDigest)
import Data.Text (Text, pack, unpack, append)
import Data.Maybe (fromMaybe)
import System.Random (randomRIO)
-- | Interface for data type which holds user info. It's just a
-- collection of getters and setters
class HashDBUser user where
-- | Retrieve password hash from user data
userPasswordHash :: user -> Maybe Text
-- | Retrieve salt for password
userPasswordSalt :: user -> Maybe Text
-- | Deprecated for the better named setSaltAndPasswordHash
setUserHashAndSalt :: Text -- ^ Salt
-> Text -- ^ Password hash
-> user -> user
setUserHashAndSalt = setSaltAndPasswordHash
-- | a callback for setPassword
setSaltAndPasswordHash :: Text -- ^ Salt
-> Text -- ^ Password hash
-> user -> user
setSaltAndPasswordHash = setUserHashAndSalt
-- | Generate random salt. Length of 8 is chosen arbitrarily
randomSalt :: MonadIO m => m Text
randomSalt = pack `liftM` liftIO (replicateM 8 (randomRIO ('0','z')))
-- | Calculate salted hash using SHA1.
saltedHash :: Text -- ^ Salt
-> Text -- ^ Password
-> Text
saltedHash salt =
pack . showDigest . sha1 . BS.pack . unpack . append salt
-- | Set password for user. This function should be used for setting
-- passwords. It generates random salt and calculates proper hashes.
setPassword :: (MonadIO m, HashDBUser user) => Text -> user -> m user
setPassword pwd u = do salt <- randomSalt
return $ setSaltAndPasswordHash salt (saltedHash salt pwd) u
----------------------------------------------------------------
-- Authentification
----------------------------------------------------------------
-- | Given a user ID and password in plaintext, validate them against
-- the database values.
validateUser :: ( YesodPersist yesod
, b ~ YesodPersistBackend yesod
, b ~ PersistEntityBackend user
, PersistStore b (GHandler sub yesod)
, PersistUnique b (GHandler sub yesod)
, PersistEntity user
, HashDBUser user
) =>
Unique user b -- ^ User unique identifier
-> Text -- ^ Password in plaint-text
-> GHandler sub yesod Bool
validateUser userID passwd = do
-- Checks that hash and password match
let validate u = do hash <- userPasswordHash u
salt <- userPasswordSalt u
return $ hash == saltedHash salt passwd
-- Get user data
user <- runDB $ getBy userID
return $ fromMaybe False $ validate . entityVal =<< user
login :: AuthRoute
login = PluginR "hashdb" ["login"]
-- | Handle the login form. First parameter is function which maps
-- username (whatever it might be) to unique user ID.
postLoginR :: ( YesodAuth y, YesodPersist y
, b ~ YesodPersistBackend y
, b ~ PersistEntityBackend user
, HashDBUser user, PersistEntity user
, PersistStore b (GHandler Auth y)
, PersistUnique b (GHandler Auth y))
=> (Text -> Maybe (Unique user b))
-> GHandler Auth y ()
postLoginR uniq = do
(mu,mp) <- runInputPost $ (,)
<$> iopt textField "username"
<*> iopt textField "password"
isValid <- fromMaybe (return False)
(validateUser <$> (uniq =<< mu) <*> mp)
if isValid
then setCreds True $ Creds "hashdb" (fromMaybe "" mu) []
else do setMessage [QQ(shamlet)| Invalid username/password |]
toMaster <- getRouteToMaster
redirect $ toMaster LoginR
-- | A drop in for the getAuthId method of your YesodAuth instance which
-- can be used if authHashDB is the only plugin in use.
getAuthIdHashDB :: ( YesodAuth master, YesodPersist master
, HashDBUser user, PersistEntity user
, Key b user ~ AuthId master
, b ~ YesodPersistBackend master
, b ~ PersistEntityBackend user
, PersistUnique b (GHandler sub master)
, PersistStore b (GHandler sub master))
=> (AuthRoute -> Route master) -- ^ your site's Auth Route
-> (Text -> Maybe (Unique user b)) -- ^ gets user ID
-> Creds master -- ^ the creds argument
-> GHandler sub master (Maybe (AuthId master))
getAuthIdHashDB authR uniq creds = do
muid <- maybeAuthId
case muid of
-- user already authenticated
Just uid -> return $ Just uid
Nothing -> do
x <- case uniq (credsIdent creds) of
Nothing -> return Nothing
Just u -> runDB (getBy u)
case x of
-- user exists
Just (Entity uid _) -> return $ Just uid
Nothing -> do
setMessage [QQ(shamlet)| User not found |]
redirect $ authR LoginR
-- | Prompt for username and password, validate that against a database
-- which holds the username and a hash of the password
authHashDB :: ( YesodAuth m, YesodPersist m
, HashDBUser user
, PersistEntity user
, b ~ YesodPersistBackend m
, b ~ PersistEntityBackend user
, PersistStore b (GHandler Auth m)
, PersistUnique b (GHandler Auth m))
=> (Text -> Maybe (Unique user b)) -> AuthPlugin m
authHashDB uniq = AuthPlugin "hashdb" dispatch $ \tm -> addHamlet
[QQ(hamlet)|
<div id="header">
<h1>Login
<div id="login">
<form method="post" action="@{tm login}">
<table>
<tr>
<th>Username:
<td>
<input id="x" name="username" autofocus="" required>
<tr>
<th>Password:
<td>
<input type="password" name="password" required>
<tr>
<td>&nbsp;
<td>
<input type="submit" value="Login">
<script>
if (!("autofocus" in document.createElement("input"))) {
document.getElementById("x").focus();
}
|]
where
dispatch "POST" ["login"] = postLoginR uniq >>= sendResponse
dispatch _ _ = notFound
----------------------------------------------------------------
-- Predefined datatype
----------------------------------------------------------------
-- | Generate data base instances for a valid user
share [mkPersist sqlSettings, mkMigrate "migrateUsers"]
[QQ(persistUpperCase)|
User
username Text Eq
password Text
salt Text
UniqueUser username
|]
instance HashDBUser (UserGeneric backend) where
userPasswordHash = Just . userPassword
userPasswordSalt = Just . userSalt
setSaltAndPasswordHash s h u = u { userSalt = s
, userPassword = h
}

View File

@ -6,10 +6,24 @@ module Yesod.Auth.Message
-- * All languages
, englishMessage
, portugueseMessage
, swedishMessage
, germanMessage
, frenchMessage
, norwegianBokmålMessage
, japaneseMessage
, finnishMessage
, chineseMessage
, croatianMessage
, spanishMessage
, czechMessage
, russianMessage
, dutchMessage
, danishMessage
, koreanMessage
) where
import Data.Monoid (mappend)
import Data.Text (Text)
import Data.Monoid (mappend, (<>))
import Data.Text (Text)
data AuthMessage =
NoOpenID
@ -17,6 +31,8 @@ data AuthMessage =
| LoginGoogle
| LoginYahoo
| Email
| UserName
| IdentifierNotFound Text
| Password
| Register
| RegisterLong
@ -24,6 +40,8 @@ data AuthMessage =
| ConfirmationEmailSentTitle
| ConfirmationEmailSent Text
| AddressVerified
| EmailVerifiedChangePass
| EmailVerified
| InvalidKeyTitle
| InvalidKey
| InvalidEmailPass
@ -41,6 +59,19 @@ data AuthMessage =
| LoginTitle
| PleaseProvideUsername
| PleaseProvidePassword
| NoIdentifierProvided
| InvalidEmailAddress
| PasswordResetTitle
| ProvideIdentifier
| SendPasswordResetEmail
| PasswordResetPrompt
| CurrentPassword
| InvalidUsernamePass
| Logout
| LogoutTitle
| AuthError
{-# DEPRECATED Logout "Please, use LogoutTitle instead." #-}
{-# DEPRECATED AddressVerified "Please, use EmailVerifiedChangePass instead." #-}
-- | Defaults to 'englishMessage'.
defaultMessage :: AuthMessage -> Text
@ -48,20 +79,24 @@ defaultMessage = englishMessage
englishMessage :: AuthMessage -> Text
englishMessage NoOpenID = "No OpenID identifier found"
englishMessage LoginOpenID = "Login via OpenID"
englishMessage LoginGoogle = "Login via Google"
englishMessage LoginYahoo = "Login via Yahoo"
englishMessage LoginOpenID = "Log in via OpenID"
englishMessage LoginGoogle = "Log in via Google"
englishMessage LoginYahoo = "Log in via Yahoo"
englishMessage Email = "Email"
englishMessage UserName = "User name"
englishMessage Password = "Password"
englishMessage CurrentPassword = "Current Password"
englishMessage Register = "Register"
englishMessage RegisterLong = "Register a new account"
englishMessage EnterEmail = "Enter your e-mail address below, and a confirmation e-mail will be sent to you."
englishMessage ConfirmationEmailSentTitle = "Confirmation e-mail sent"
englishMessage (ConfirmationEmailSent email) =
"A confirmation e-mail has been sent to " `mappend`
"A confirmation e-mail has been sent to " `Data.Monoid.mappend`
email `mappend`
"."
englishMessage AddressVerified = "Address verified, please set a new password"
englishMessage AddressVerified = "Email address verified, please set a new password"
englishMessage EmailVerifiedChangePass = "Email address verified, please set a new password"
englishMessage EmailVerified = "Email address verified"
englishMessage InvalidKeyTitle = "Invalid verification key"
englishMessage InvalidKey = "I'm sorry, but that was an invalid verification key."
englishMessage InvalidEmailPass = "Invalid email/password combination"
@ -72,13 +107,24 @@ englishMessage NewPass = "New password"
englishMessage ConfirmPass = "Confirm"
englishMessage PassMismatch = "Passwords did not match, please try again"
englishMessage PassUpdated = "Password updated"
englishMessage Facebook = "Login with Facebook"
englishMessage LoginViaEmail = "Login via email"
englishMessage Facebook = "Log in with Facebook"
englishMessage LoginViaEmail = "Log in via email"
englishMessage InvalidLogin = "Invalid login"
englishMessage NowLoggedIn = "You are now logged in"
englishMessage LoginTitle = "Login"
englishMessage LoginTitle = "Log In"
englishMessage PleaseProvideUsername = "Please fill in your username"
englishMessage PleaseProvidePassword = "Please fill in your password"
englishMessage NoIdentifierProvided = "No email/username provided"
englishMessage InvalidEmailAddress = "Invalid email address provided"
englishMessage PasswordResetTitle = "Password Reset"
englishMessage ProvideIdentifier = "Email or Username"
englishMessage SendPasswordResetEmail = "Send password reset email"
englishMessage PasswordResetPrompt = "Enter your e-mail address or username below, and a password reset e-mail will be sent to you."
englishMessage InvalidUsernamePass = "Invalid username/password combination"
englishMessage (IdentifierNotFound ident) = "Login not found: " `mappend` ident
englishMessage Logout = "Log Out"
englishMessage LogoutTitle = "Log Out"
englishMessage AuthError = "Authentication Error" -- FIXME by Google Translate
portugueseMessage :: AuthMessage -> Text
portugueseMessage NoOpenID = "Nenhum identificador OpenID encontrado"
@ -86,7 +132,9 @@ portugueseMessage LoginOpenID = "Entrar via OpenID"
portugueseMessage LoginGoogle = "Entrar via Google"
portugueseMessage LoginYahoo = "Entrar via Yahoo"
portugueseMessage Email = "E-mail"
portugueseMessage UserName = "Nome de usuário" -- FIXME by Google Translate "user name"
portugueseMessage Password = "Senha"
portugueseMessage CurrentPassword = "Palavra de passe"
portugueseMessage Register = "Registrar"
portugueseMessage RegisterLong = "Registrar uma nova conta"
portugueseMessage EnterEmail = "Por favor digite seu endereço de e-mail abaixo e um e-mail de confirmação será enviado para você."
@ -96,6 +144,8 @@ portugueseMessage (ConfirmationEmailSent email) =
email `mappend`
"."
portugueseMessage AddressVerified = "Endereço verificado, por favor entre com uma nova senha"
portugueseMessage EmailVerifiedChangePass = "Endereço verificado, por favor entre com uma nova senha"
portugueseMessage EmailVerified = "Endereço verificado"
portugueseMessage InvalidKeyTitle = "Chave de verificação inválida"
portugueseMessage InvalidKey = "Por favor nos desculpe, mas essa é uma chave de verificação inválida."
portugueseMessage InvalidEmailPass = "E-mail e/ou senha inválidos"
@ -113,3 +163,706 @@ portugueseMessage NowLoggedIn = "Você acaba de entrar no site com sucesso!"
portugueseMessage LoginTitle = "Entrar no site"
portugueseMessage PleaseProvideUsername = "Por favor digite seu nome de usuário"
portugueseMessage PleaseProvidePassword = "Por favor digite sua senha"
portugueseMessage NoIdentifierProvided = "Nenhum e-mail ou nome de usuário informado"
portugueseMessage InvalidEmailAddress = "Endereço de e-mail inválido informado"
portugueseMessage PasswordResetTitle = "Resetar senha"
portugueseMessage ProvideIdentifier = "E-mail ou nome de usuário"
portugueseMessage SendPasswordResetEmail = "Enviar e-mail para resetar senha"
portugueseMessage PasswordResetPrompt = "Insira seu endereço de e-mail ou nome de usuário abaixo. Um e-mail para resetar sua senha será enviado para você."
portugueseMessage InvalidUsernamePass = "Nome de usuário ou senha inválidos"
-- TODO
portugueseMessage i@(IdentifierNotFound _) = englishMessage i
portugueseMessage Logout = "Sair" -- FIXME by Google Translate
portugueseMessage LogoutTitle = "Sair" -- FIXME by Google Translate
portugueseMessage AuthError = "Erro de autenticação" -- FIXME by Google Translate
spanishMessage :: AuthMessage -> Text
spanishMessage NoOpenID = "No se encuentra el identificador OpenID"
spanishMessage LoginOpenID = "Entrar utilizando OpenID"
spanishMessage LoginGoogle = "Entrar utilizando Google"
spanishMessage LoginYahoo = "Entrar utilizando Yahoo"
spanishMessage Email = "Correo electrónico"
spanishMessage UserName = "Nombre de Usuario"
spanishMessage Password = "Contraseña"
spanishMessage CurrentPassword = "Contraseña actual"
spanishMessage Register = "Registrarse"
spanishMessage RegisterLong = "Registrar una nueva cuenta"
spanishMessage EnterEmail = "Coloque su dirección de correo electrónico, y un correo de confirmación le será enviado a su cuenta."
spanishMessage ConfirmationEmailSentTitle = "La confirmación de correo ha sido enviada"
spanishMessage (ConfirmationEmailSent email) =
"Una confirmación de correo electrónico ha sido enviada a " `mappend`
email `mappend`
"."
spanishMessage AddressVerified = "Dirección verificada, por favor introduzca una contraseña"
spanishMessage EmailVerifiedChangePass = "Dirección verificada, por favor introduzca una contraseña"
spanishMessage EmailVerified = "Dirección verificada"
spanishMessage InvalidKeyTitle = "Clave de verificación invalida"
spanishMessage InvalidKey = "Lo sentimos, pero esa clave de verificación es inválida."
spanishMessage InvalidEmailPass = "La combinación cuenta de correo/contraseña es inválida"
spanishMessage BadSetPass = "Debe acceder a la aplicación para modificar la contraseña"
spanishMessage SetPassTitle = "Modificar contraseña"
spanishMessage SetPass = "Actualizar nueva contraseña"
spanishMessage NewPass = "Nueva contraseña"
spanishMessage ConfirmPass = "Confirmar"
spanishMessage PassMismatch = "Las contraseñas no coinciden, inténtelo de nuevo"
spanishMessage PassUpdated = "Contraseña actualizada"
spanishMessage Facebook = "Entrar mediante Facebook"
spanishMessage LoginViaEmail = "Entrar mediante una cuenta de correo"
spanishMessage InvalidLogin = "Login inválido"
spanishMessage NowLoggedIn = "Usted ha ingresado al sitio"
spanishMessage LoginTitle = "Log In"
spanishMessage PleaseProvideUsername = "Por favor escriba su nombre de usuario"
spanishMessage PleaseProvidePassword = "Por favor escriba su contraseña"
spanishMessage NoIdentifierProvided = "No ha indicado una cuenta de correo/nombre de usuario"
spanishMessage InvalidEmailAddress = "La cuenta de correo es inválida"
spanishMessage PasswordResetTitle = "Actualización de contraseña"
spanishMessage ProvideIdentifier = "Cuenta de correo o nombre de usuario"
spanishMessage SendPasswordResetEmail = "Enviar correo de actualización de contraseña"
spanishMessage PasswordResetPrompt = "Escriba su cuenta de correo o nombre de usuario, y una confirmación de actualización de contraseña será enviada a su cuenta de correo."
spanishMessage InvalidUsernamePass = "Combinación de nombre de usuario/contraseña invalida"
-- TODO
spanishMessage i@(IdentifierNotFound _) = englishMessage i
spanishMessage Logout = "Finalizar la sesión" -- FIXME by Google Translate
spanishMessage LogoutTitle = "Finalizar la sesión" -- FIXME by Google Translate
spanishMessage AuthError = "Error de autenticación" -- FIXME by Google Translate
swedishMessage :: AuthMessage -> Text
swedishMessage NoOpenID = "Fann ej OpenID identifierare"
swedishMessage LoginOpenID = "Logga in via OpenID"
swedishMessage LoginGoogle = "Logga in via Google"
swedishMessage LoginYahoo = "Logga in via Yahoo"
swedishMessage Email = "Epost"
swedishMessage UserName = "Användarnamn" -- FIXME by Google Translate "user name"
swedishMessage Password = "Lösenord"
swedishMessage CurrentPassword = "Current password"
swedishMessage Register = "Registrera"
swedishMessage RegisterLong = "Registrera ett nytt konto"
swedishMessage EnterEmail = "Skriv in din epost nedan så kommer ett konfirmationsmail skickas till adressen."
swedishMessage ConfirmationEmailSentTitle = "Konfirmationsmail skickat"
swedishMessage (ConfirmationEmailSent email) =
"Ett konfirmationsmeddelande har skickats till" `mappend`
email `mappend`
"."
swedishMessage AddressVerified = "Adress verifierad, vänligen välj nytt lösenord"
swedishMessage EmailVerifiedChangePass = "Adress verifierad, vänligen välj nytt lösenord"
swedishMessage EmailVerified = "Adress verifierad"
swedishMessage InvalidKeyTitle = "Ogiltig verifikationsnyckel"
swedishMessage InvalidKey = "Tyvärr, du angav en ogiltig verifimationsnyckel."
swedishMessage InvalidEmailPass = "Ogiltig epost/lösenord kombination"
swedishMessage BadSetPass = "Du måste vara inloggad för att ange ett lösenord"
swedishMessage SetPassTitle = "Ange lösenord"
swedishMessage SetPass = "Ange nytt lösenord"
swedishMessage NewPass = "Nytt lösenord"
swedishMessage ConfirmPass = "Godkänn"
swedishMessage PassMismatch = "Lösenorden matcha ej, vänligen försök igen"
swedishMessage PassUpdated = "Lösenord updaterades"
swedishMessage Facebook = "Logga in med Facebook"
swedishMessage LoginViaEmail = "Logga in via epost"
swedishMessage InvalidLogin = "Ogiltigt login"
swedishMessage NowLoggedIn = "Du är nu inloggad"
swedishMessage LoginTitle = "Logga in"
swedishMessage PleaseProvideUsername = "Vänligen fyll i användarnamn"
swedishMessage PleaseProvidePassword = "Vänligen fyll i lösenord"
swedishMessage NoIdentifierProvided = "Emailadress eller användarnamn saknas"
swedishMessage InvalidEmailAddress = "Ogiltig emailadress angiven"
swedishMessage PasswordResetTitle = "Återställning av lösenord"
swedishMessage ProvideIdentifier = "Epost eller användarnamn"
swedishMessage SendPasswordResetEmail = "Skicka email för återställning av lösenord"
swedishMessage PasswordResetPrompt = "Skriv in din emailadress eller användarnamn nedan och " `mappend`
"ett email för återställning av lösenord kommmer att skickas till dig."
swedishMessage InvalidUsernamePass = "Ogiltig kombination av användarnamn och lösenord"
-- TODO
swedishMessage i@(IdentifierNotFound _) = englishMessage i
swedishMessage Logout = "Loggar ut" -- FIXME by Google Translate
swedishMessage LogoutTitle = "Loggar ut" -- FIXME by Google Translate
swedishMessage AuthError = "Autentisering Fel" -- FIXME by Google Translate
germanMessage :: AuthMessage -> Text
germanMessage NoOpenID = "Kein OpenID-Identifier gefunden"
germanMessage LoginOpenID = "Login via OpenID"
germanMessage LoginGoogle = "Login via Google"
germanMessage LoginYahoo = "Login via Yahoo"
germanMessage Email = "E-Mail"
germanMessage UserName = "Benutzername"
germanMessage Password = "Passwort"
germanMessage CurrentPassword = "Aktuelles Passwort"
germanMessage Register = "Registrieren"
germanMessage RegisterLong = "Neuen Account registrieren"
germanMessage EnterEmail = "Bitte die E-Mail Adresse angeben, eine Bestätigungsmail wird verschickt."
germanMessage ConfirmationEmailSentTitle = "Bestätigung verschickt."
germanMessage (ConfirmationEmailSent email) =
"Eine Bestätigung wurde an " `mappend`
email `mappend`
" versandt."
germanMessage AddressVerified = "Adresse bestätigt, bitte neues Passwort angeben"
germanMessage EmailVerifiedChangePass = "Adresse bestätigt, bitte neues Passwort angeben"
germanMessage EmailVerified = "Adresse bestätigt"
germanMessage InvalidKeyTitle = "Ungültiger Bestätigungsschlüssel"
germanMessage InvalidKey = "Das war leider ein ungültiger Bestätigungsschlüssel"
germanMessage InvalidEmailPass = "Ungültiger Nutzername oder Passwort"
germanMessage BadSetPass = "Um das Passwort zu ändern muss man eingeloggt sein"
germanMessage SetPassTitle = "Passwort angeben"
germanMessage SetPass = "Neues Passwort angeben"
germanMessage NewPass = "Neues Passwort"
germanMessage ConfirmPass = "Bestätigen"
germanMessage PassMismatch = "Die Passwörter stimmen nicht überein"
germanMessage PassUpdated = "Passwort überschrieben"
germanMessage Facebook = "Login über Facebook"
germanMessage LoginViaEmail = "Login via E-Mail"
germanMessage InvalidLogin = "Ungültiger Login"
germanMessage NowLoggedIn = "Login erfolgreich"
germanMessage LoginTitle = "Anmelden"
germanMessage PleaseProvideUsername = "Bitte Nutzername angeben"
germanMessage PleaseProvidePassword = "Bitte Passwort angeben"
germanMessage NoIdentifierProvided = "Keine E-Mail-Adresse oder kein Nutzername angegeben"
germanMessage InvalidEmailAddress = "Unzulässiger E-Mail-Anbieter"
germanMessage PasswordResetTitle = "Passwort zurücksetzen"
germanMessage ProvideIdentifier = "E-Mail-Adresse oder Nutzername"
germanMessage SendPasswordResetEmail = "E-Mail zusenden um Passwort zurückzusetzen"
germanMessage PasswordResetPrompt = "Nach Einhabe der E-Mail-Adresse oder des Nutzernamen wird eine E-Mail zugesendet mit welcher das Passwort zurückgesetzt werden kann."
germanMessage InvalidUsernamePass = "Ungültige Kombination aus Nutzername und Passwort"
germanMessage i@(IdentifierNotFound _) = englishMessage i -- TODO
germanMessage Logout = "Abmelden"
germanMessage LogoutTitle = "Abmelden"
germanMessage AuthError = "Fehler beim Anmelden"
frenchMessage :: AuthMessage -> Text
frenchMessage NoOpenID = "Aucun fournisseur OpenID n'a été trouvé"
frenchMessage LoginOpenID = "Se connecter avec OpenID"
frenchMessage LoginGoogle = "Se connecter avec Google"
frenchMessage LoginYahoo = "Se connecter avec Yahoo"
frenchMessage Email = "Adresse électronique"
frenchMessage UserName = "Nom d'utilisateur" -- FIXME by Google Translate "user name"
frenchMessage Password = "Mot de passe"
frenchMessage CurrentPassword = "Mot de passe actuel"
frenchMessage Register = "S'inscrire"
frenchMessage RegisterLong = "Créer un compte"
frenchMessage EnterEmail = "Entrez ci-dessous votre adresse électronique, et un message de confirmation vous sera envoyé"
frenchMessage ConfirmationEmailSentTitle = "Message de confirmation"
frenchMessage (ConfirmationEmailSent email) =
"Un message de confirmation a été envoyé à " `mappend`
email `mappend`
"."
frenchMessage AddressVerified = "Votre adresse électronique a été validée, merci de choisir un nouveau mot de passe."
frenchMessage EmailVerifiedChangePass = "Votre adresse électronique a été validée, merci de choisir un nouveau mot de passe."
frenchMessage EmailVerified = "Votre adresse électronique a été validée"
frenchMessage InvalidKeyTitle = "Clef de validation incorrecte"
frenchMessage InvalidKey = "Désolé, mais cette clef de validation est incorrecte"
frenchMessage InvalidEmailPass = "La combinaison de ce mot de passe et de cette adresse électronique n'existe pas."
frenchMessage BadSetPass = "Vous devez être connecté pour choisir un mot de passe"
frenchMessage SetPassTitle = "Changer de mot de passe"
frenchMessage SetPass = "Choisir un nouveau mot de passe"
frenchMessage NewPass = "Nouveau mot de passe"
frenchMessage ConfirmPass = "Confirmation du mot de passe"
frenchMessage PassMismatch = "Le deux mots de passe sont différents, veuillez les corriger"
frenchMessage PassUpdated = "Le mot de passe a bien été changé"
frenchMessage Facebook = "Se connecter avec Facebook"
frenchMessage LoginViaEmail = "Se connecter avec une adresse électronique"
frenchMessage InvalidLogin = "Nom d'utilisateur incorrect"
frenchMessage NowLoggedIn = "Vous êtes maintenant connecté"
frenchMessage LoginTitle = "Se connecter"
frenchMessage PleaseProvideUsername = "Veuillez fournir votre nom d'utilisateur"
frenchMessage PleaseProvidePassword = "Veuillez fournir votre mot de passe"
frenchMessage NoIdentifierProvided = "Adresse électronique/nom d'utilisateur non spécifié"
frenchMessage InvalidEmailAddress = "Adresse électronique spécifiée invalide"
frenchMessage PasswordResetTitle = "Réinitialisation du mot de passe"
frenchMessage ProvideIdentifier = "Adresse électronique ou nom d'utilisateur"
frenchMessage SendPasswordResetEmail = "Envoi d'un courriel pour réinitialiser le mot de passe"
frenchMessage PasswordResetPrompt = "Entrez votre courriel ou votre nom d'utilisateur ci-dessous, et vous recevrez un message électronique pour réinitialiser votre mot de passe."
frenchMessage InvalidUsernamePass = "La combinaison de ce mot de passe et de ce nom d'utilisateur n'existe pas."
frenchMessage (IdentifierNotFound ident) = "Nom d'utilisateur introuvable: " `mappend` ident
frenchMessage Logout = "Déconnexion"
frenchMessage LogoutTitle = "Déconnexion"
frenchMessage AuthError = "Erreur d'authentification" -- FIXME by Google Translate
norwegianBokmålMessage :: AuthMessage -> Text
norwegianBokmålMessage NoOpenID = "Ingen OpenID-identifiserer funnet"
norwegianBokmålMessage LoginOpenID = "Logg inn med OpenID"
norwegianBokmålMessage LoginGoogle = "Logg inn med Google"
norwegianBokmålMessage LoginYahoo = "Logg inn med Yahoo"
norwegianBokmålMessage Email = "E-post"
norwegianBokmålMessage UserName = "Brukernavn" -- FIXME by Google Translate "user name"
norwegianBokmålMessage Password = "Passord"
norwegianBokmålMessage CurrentPassword = "Current password"
norwegianBokmålMessage Register = "Registrer"
norwegianBokmålMessage RegisterLong = "Registrer en ny konto"
norwegianBokmålMessage EnterEmail = "Skriv inn e-postadressen din nedenfor og en e-postkonfirmasjon vil bli sendt."
norwegianBokmålMessage ConfirmationEmailSentTitle = "E-postkonfirmasjon sendt."
norwegianBokmålMessage (ConfirmationEmailSent email) =
"En e-postkonfirmasjon har blitt sendt til " `mappend`
email `mappend`
"."
norwegianBokmålMessage AddressVerified = "Adresse verifisert, vennligst sett et nytt passord."
norwegianBokmålMessage EmailVerifiedChangePass = "Adresse verifisert, vennligst sett et nytt passord."
norwegianBokmålMessage EmailVerified = "Adresse verifisert"
norwegianBokmålMessage InvalidKeyTitle = "Ugyldig verifiseringsnøkkel"
norwegianBokmålMessage InvalidKey = "Beklager, men det var en ugyldig verifiseringsnøkkel."
norwegianBokmålMessage InvalidEmailPass = "Ugyldig e-post/passord-kombinasjon"
norwegianBokmålMessage BadSetPass = "Du må være logget inn for å sette et passord."
norwegianBokmålMessage SetPassTitle = "Sett passord"
norwegianBokmålMessage SetPass = "Sett et nytt passord"
norwegianBokmålMessage NewPass = "Nytt passord"
norwegianBokmålMessage ConfirmPass = "Bekreft"
norwegianBokmålMessage PassMismatch = "Passordene stemte ikke overens, vennligst prøv igjen"
norwegianBokmålMessage PassUpdated = "Passord oppdatert"
norwegianBokmålMessage Facebook = "Logg inn med Facebook"
norwegianBokmålMessage LoginViaEmail = "Logg inn med e-post"
norwegianBokmålMessage InvalidLogin = "Ugyldig innlogging"
norwegianBokmålMessage NowLoggedIn = "Du er nå logget inn"
norwegianBokmålMessage LoginTitle = "Logg inn"
norwegianBokmålMessage PleaseProvideUsername = "Vennligst fyll inn ditt brukernavn"
norwegianBokmålMessage PleaseProvidePassword = "Vennligst fyll inn ditt passord"
norwegianBokmålMessage NoIdentifierProvided = "No email/username provided"
norwegianBokmålMessage InvalidEmailAddress = "Invalid email address provided"
norwegianBokmålMessage PasswordResetTitle = "Password Reset"
norwegianBokmålMessage ProvideIdentifier = "Email or Username"
norwegianBokmålMessage SendPasswordResetEmail = "Send password reset email"
norwegianBokmålMessage PasswordResetPrompt = "Enter your e-mail address or username below, and a password reset e-mail will be sent to you."
norwegianBokmålMessage InvalidUsernamePass = "Invalid username/password combination"
-- TODO
norwegianBokmålMessage i@(IdentifierNotFound _) = englishMessage i
norwegianBokmålMessage Logout = "Logge ut" -- FIXME by Google Translate
norwegianBokmålMessage LogoutTitle = "Logge ut" -- FIXME by Google Translate
norwegianBokmålMessage AuthError = "Godkjenningsfeil" -- FIXME by Google Translate
japaneseMessage :: AuthMessage -> Text
japaneseMessage NoOpenID = "OpenID識別子がありません"
japaneseMessage LoginOpenID = "OpenIDでログイン"
japaneseMessage LoginGoogle = "Googleでログイン"
japaneseMessage LoginYahoo = "Yahooでログイン"
japaneseMessage Email = "Eメール"
japaneseMessage UserName = "ユーザー名" -- FIXME by Google Translate "user name"
japaneseMessage Password = "パスワード"
japaneseMessage CurrentPassword = "現在のパスワード"
japaneseMessage Register = "登録"
japaneseMessage RegisterLong = "新規アカウント登録"
japaneseMessage EnterEmail = "メールアドレスを入力してください。確認メールが送られます"
japaneseMessage ConfirmationEmailSentTitle = "確認メールを送信しました"
japaneseMessage (ConfirmationEmailSent email) =
"確認メールを " `mappend`
email `mappend`
" に送信しました"
japaneseMessage AddressVerified = "アドレスは認証されました。新しいパスワードを設定してください"
japaneseMessage EmailVerifiedChangePass = "アドレスは認証されました。新しいパスワードを設定してください"
japaneseMessage EmailVerified = "アドレスは認証されました"
japaneseMessage InvalidKeyTitle = "認証キーが無効です"
japaneseMessage InvalidKey = "申し訳ありません。無効な認証キーです"
japaneseMessage InvalidEmailPass = "メールアドレスまたはパスワードが無効です"
japaneseMessage BadSetPass = "パスワードを設定するためには、ログインしてください"
japaneseMessage SetPassTitle = "パスワードの設定"
japaneseMessage SetPass = "新しいパスワードを設定する"
japaneseMessage NewPass = "新しいパスワード"
japaneseMessage ConfirmPass = "確認"
japaneseMessage PassMismatch = "パスワードが合いません。もう一度試してください"
japaneseMessage PassUpdated = "パスワードは更新されました"
japaneseMessage Facebook = "Facebookでログイン"
japaneseMessage LoginViaEmail = "Eメールでログイン"
japaneseMessage InvalidLogin = "無効なログインです"
japaneseMessage NowLoggedIn = "ログインしました"
japaneseMessage LoginTitle = "ログイン"
japaneseMessage PleaseProvideUsername = "ユーザ名を入力してください"
japaneseMessage PleaseProvidePassword = "パスワードを入力してください"
japaneseMessage NoIdentifierProvided = "メールアドレス/ユーザ名が入力されていません"
japaneseMessage InvalidEmailAddress = "メールアドレスが無効です"
japaneseMessage PasswordResetTitle = "パスワードの再設定"
japaneseMessage ProvideIdentifier = "メールアドレスまたはユーザ名"
japaneseMessage SendPasswordResetEmail = "パスワード再設定用メールの送信"
japaneseMessage PasswordResetPrompt = "以下にメールアドレスまたはユーザ名を入力してください。パスワードを再設定するためのメールが送信されます。"
japaneseMessage InvalidUsernamePass = "ユーザ名とパスワードの組み合わせが間違っています"
japaneseMessage (IdentifierNotFound ident) =
ident `mappend` "は登録されていません"
japaneseMessage Logout = "ログアウト" -- FIXME by Google Translate
japaneseMessage LogoutTitle = "ログアウト" -- FIXME by Google Translate
japaneseMessage AuthError = "認証エラー" -- FIXME by Google Translate
finnishMessage :: AuthMessage -> Text
finnishMessage NoOpenID = "OpenID-tunnistetta ei löydy"
finnishMessage LoginOpenID = "Kirjaudu OpenID-tilillä"
finnishMessage LoginGoogle = "Kirjaudu Google-tilillä"
finnishMessage LoginYahoo = "Kirjaudu Yahoo-tilillä"
finnishMessage Email = "Sähköposti"
finnishMessage UserName = "Käyttäjätunnus" -- FIXME by Google Translate "user name"
finnishMessage Password = "Salasana"
finnishMessage CurrentPassword = "Current password"
finnishMessage Register = "Luo uusi"
finnishMessage RegisterLong = "Luo uusi tili"
finnishMessage EnterEmail = "Kirjoita alle sähköpostiosoitteesi, johon vahvistussähköposti lähetetään."
finnishMessage ConfirmationEmailSentTitle = "Vahvistussähköposti lähetetty."
finnishMessage (ConfirmationEmailSent email) =
"Vahvistussähköposti on lähetty osoitteeseen " `mappend`
email `mappend`
"."
finnishMessage AddressVerified = "Sähköpostiosoite vahvistettu. Anna uusi salasana"
finnishMessage EmailVerifiedChangePass = "Sähköpostiosoite vahvistettu. Anna uusi salasana"
finnishMessage EmailVerified = "Sähköpostiosoite vahvistettu"
finnishMessage InvalidKeyTitle = "Virheellinen varmistusavain"
finnishMessage InvalidKey = "Valitettavasti varmistusavain on virheellinen."
finnishMessage InvalidEmailPass = "Virheellinen sähköposti tai salasana."
finnishMessage BadSetPass = "Kirjaudu ensin sisään asettaaksesi salasanan"
finnishMessage SetPassTitle = "Salasanan asettaminen"
finnishMessage SetPass = "Aseta uusi salasana"
finnishMessage NewPass = "Uusi salasana"
finnishMessage ConfirmPass = "Vahvista"
finnishMessage PassMismatch = "Salasanat eivät täsmää"
finnishMessage PassUpdated = "Salasana vaihdettu"
finnishMessage Facebook = "Kirjaudu Facebook-tilillä"
finnishMessage LoginViaEmail = "Kirjaudu sähköpostitilillä"
finnishMessage InvalidLogin = "Kirjautuminen epäonnistui"
finnishMessage NowLoggedIn = "Olet nyt kirjautunut sisään"
finnishMessage LoginTitle = "Kirjautuminen"
finnishMessage PleaseProvideUsername = "Käyttäjänimi puuttuu"
finnishMessage PleaseProvidePassword = "Salasana puuttuu"
finnishMessage NoIdentifierProvided = "Sähköpostiosoite/käyttäjänimi puuttuu"
finnishMessage InvalidEmailAddress = "Annettu sähköpostiosoite ei kelpaa"
finnishMessage PasswordResetTitle = "Uuden salasanan tilaaminen"
finnishMessage ProvideIdentifier = "Sähköpostiosoite tai käyttäjänimi"
finnishMessage SendPasswordResetEmail = "Lähetä uusi salasana sähköpostitse"
finnishMessage PasswordResetPrompt = "Anna sähköpostiosoitteesi tai käyttäjätunnuksesi alla, niin lähetämme uuden salasanan sähköpostitse."
finnishMessage InvalidUsernamePass = "Virheellinen käyttäjänimi tai salasana."
-- TODO
finnishMessage i@(IdentifierNotFound _) = englishMessage i
finnishMessage Logout = "Kirjaudu ulos" -- FIXME by Google Translate
finnishMessage LogoutTitle = "Kirjaudu ulos" -- FIXME by Google Translate
finnishMessage AuthError = "Authentication Error" -- FIXME by Google Translate
chineseMessage :: AuthMessage -> Text
chineseMessage NoOpenID = "无效的OpenID"
chineseMessage LoginOpenID = "用OpenID登录"
chineseMessage LoginGoogle = "用Google帐户登录"
chineseMessage LoginYahoo = "用Yahoo帐户登录"
chineseMessage Email = "邮箱"
chineseMessage UserName = "用户名"
chineseMessage Password = "密码"
chineseMessage CurrentPassword = "当前密码"
chineseMessage Register = "注册"
chineseMessage RegisterLong = "注册新帐户"
chineseMessage EnterEmail = "输入你的邮箱地址,你将收到一封确认邮件。"
chineseMessage ConfirmationEmailSentTitle = "确认邮件已发送"
chineseMessage (ConfirmationEmailSent email) =
"确认邮件已发送至 " `mappend`
email `mappend`
"."
chineseMessage AddressVerified = "地址验证成功,请设置新密码"
chineseMessage EmailVerifiedChangePass = "地址验证成功,请设置新密码"
chineseMessage EmailVerified = "地址验证成功"
chineseMessage InvalidKeyTitle = "无效的验证码"
chineseMessage InvalidKey = "对不起,验证码无效。"
chineseMessage InvalidEmailPass = "无效的邮箱/密码组合"
chineseMessage BadSetPass = "你需要登录才能设置密码"
chineseMessage SetPassTitle = "设置密码"
chineseMessage SetPass = "设置新密码"
chineseMessage NewPass = "新密码"
chineseMessage ConfirmPass = "确认"
chineseMessage PassMismatch = "密码不匹配,请重新输入"
chineseMessage PassUpdated = "密码更新成功"
chineseMessage Facebook = "用Facebook帐户登录"
chineseMessage LoginViaEmail = "用邮箱登录"
chineseMessage InvalidLogin = "登录失败"
chineseMessage NowLoggedIn = "登录成功"
chineseMessage LoginTitle = "登录"
chineseMessage PleaseProvideUsername = "请输入用户名"
chineseMessage PleaseProvidePassword = "请输入密码"
chineseMessage NoIdentifierProvided = "缺少邮箱/用户名"
chineseMessage InvalidEmailAddress = "无效的邮箱地址"
chineseMessage PasswordResetTitle = "重置密码"
chineseMessage ProvideIdentifier = "邮箱或用户名"
chineseMessage SendPasswordResetEmail = "发送密码重置邮件"
chineseMessage PasswordResetPrompt = "输入你的邮箱地址或用户名,你将收到一封密码重置邮件。"
chineseMessage InvalidUsernamePass = "无效的用户名/密码组合"
chineseMessage (IdentifierNotFound ident) = "邮箱/用户名不存在: " `mappend` ident
chineseMessage Logout = "注销"
chineseMessage LogoutTitle = "注销"
chineseMessage AuthError = "验证错误"
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 UserName = "Uživatelské jméno"
czechMessage Password = "Heslo"
czechMessage CurrentPassword = "Current password"
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 EmailVerifiedChangePass = "Adresa byla ověřena, prosím nastavte si nové heslo"
czechMessage EmailVerified = "Adresa byla ověřena"
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"
-- TODO
czechMessage i@(IdentifierNotFound _) = englishMessage i
czechMessage Logout = "Odhlásit" -- FIXME by Google Translate
czechMessage LogoutTitle = "Odhlásit" -- FIXME by Google Translate
czechMessage AuthError = "Chyba ověřování" -- FIXME by Google Translate
-- Так как e-mail это фактическое сокращение словосочетания electronic mail,
-- для русского перевода так же использовано сокращение: эл.почта
russianMessage :: AuthMessage -> Text
russianMessage NoOpenID = "Идентификатор OpenID не найден"
russianMessage LoginOpenID = "Вход с помощью OpenID"
russianMessage LoginGoogle = "Вход с помощью Google"
russianMessage LoginYahoo = "Вход с помощью Yahoo"
russianMessage Email = "Эл.почта"
russianMessage UserName = "Имя пользователя"
russianMessage Password = "Пароль"
russianMessage CurrentPassword = "Старый пароль"
russianMessage Register = "Регистрация"
russianMessage RegisterLong = "Создать учётную запись"
russianMessage EnterEmail = "Введите свой адрес эл.почты ниже, вам будет отправлено письмо для подтверждения."
russianMessage ConfirmationEmailSentTitle = "Письмо для подтверждения отправлено"
russianMessage (ConfirmationEmailSent email) =
"Письмо для подтверждения было отправлено на адрес " `mappend`
email `mappend`
"."
russianMessage AddressVerified = "Адрес подтверждён. Пожалуйста, установите новый пароль."
russianMessage EmailVerifiedChangePass = "Адрес подтверждён. Пожалуйста, установите новый пароль."
russianMessage EmailVerified = "Адрес подтверждён"
russianMessage InvalidKeyTitle = "Неверный ключ подтверждения"
russianMessage InvalidKey = "Извините, но ключ подтверждения оказался недействительным."
russianMessage InvalidEmailPass = "Неверное сочетание эл.почты и пароля"
russianMessage BadSetPass = "Чтобы изменить пароль, необходимо выполнить вход"
russianMessage SetPassTitle = "Установить пароль"
russianMessage SetPass = "Установить новый пароль"
russianMessage NewPass = "Новый пароль"
russianMessage ConfirmPass = "Подтверждение пароля"
russianMessage PassMismatch = "Пароли не совпадают, повторите снова"
russianMessage PassUpdated = "Пароль обновлён"
russianMessage Facebook = "Войти с помощью Facebook"
russianMessage LoginViaEmail = "Войти по адресу эл.почты"
russianMessage InvalidLogin = "Неверный логин"
russianMessage NowLoggedIn = "Вход выполнен"
russianMessage LoginTitle = "Войти"
russianMessage PleaseProvideUsername = "Пожалуйста, введите ваше имя пользователя"
russianMessage PleaseProvidePassword = "Пожалуйста, введите ваш пароль"
russianMessage NoIdentifierProvided = "Не указан адрес эл.почты/имя пользователя"
russianMessage InvalidEmailAddress = "Указан неверный адрес эл.почты"
russianMessage PasswordResetTitle = "Сброс пароля"
russianMessage ProvideIdentifier = "Имя пользователя или эл.почта"
russianMessage SendPasswordResetEmail = "Отправить письмо для сброса пароля"
russianMessage PasswordResetPrompt = "Введите адрес эл.почты или ваше имя пользователя ниже, вам будет отправлено письмо для сброса пароля."
russianMessage InvalidUsernamePass = "Неверное сочетание имени пользователя и пароля"
russianMessage (IdentifierNotFound ident) = "Логин не найден: " `mappend` ident
russianMessage Logout = "Выйти"
russianMessage LogoutTitle = "Выйти"
russianMessage AuthError = "Ошибка аутентификации"
dutchMessage :: AuthMessage -> Text
dutchMessage NoOpenID = "Geen OpenID identificator gevonden"
dutchMessage LoginOpenID = "Inloggen via OpenID"
dutchMessage LoginGoogle = "Inloggen via Google"
dutchMessage LoginYahoo = "Inloggen via Yahoo"
dutchMessage Email = "E-mail"
dutchMessage UserName = "Gebruikersnaam"
dutchMessage Password = "Wachtwoord"
dutchMessage CurrentPassword = "Huidig wachtwoord"
dutchMessage Register = "Registreren"
dutchMessage RegisterLong = "Registreer een nieuw account"
dutchMessage EnterEmail = "Voer uw e-mailadres hieronder in, er zal een bevestigings-e-mail naar u worden verzonden."
dutchMessage ConfirmationEmailSentTitle = "Bevestigings-e-mail verzonden"
dutchMessage (ConfirmationEmailSent email) =
"Een bevestigings-e-mail is verzonden naar " `mappend`
email `mappend`
"."
dutchMessage AddressVerified = "Adres geverifieerd, stel alstublieft een nieuwe wachtwoord in"
dutchMessage EmailVerifiedChangePass = "Adres geverifieerd, stel alstublieft een nieuwe wachtwoord in"
dutchMessage EmailVerified = "Adres geverifieerd"
dutchMessage InvalidKeyTitle = "Ongeldig verificatietoken"
dutchMessage InvalidKey = "Dat was helaas een ongeldig verificatietoken."
dutchMessage InvalidEmailPass = "Ongeldige e-mailadres/wachtwoord combinatie"
dutchMessage BadSetPass = "U moet ingelogd zijn om een nieuwe wachtwoord in te stellen"
dutchMessage SetPassTitle = "Wachtwoord instellen"
dutchMessage SetPass = "Een nieuwe wachtwoord instellen"
dutchMessage NewPass = "Nieuw wachtwoord"
dutchMessage ConfirmPass = "Bevestig"
dutchMessage PassMismatch = "Wachtwoorden kwamen niet overeen, probeer het alstublieft nog eens"
dutchMessage PassUpdated = "Wachtwoord geüpdatet"
dutchMessage Facebook = "Inloggen met Facebook"
dutchMessage LoginViaEmail = "Inloggen via e-mail"
dutchMessage InvalidLogin = "Ongeldige inloggegevens"
dutchMessage NowLoggedIn = "U bent nu ingelogd"
dutchMessage LoginTitle = "Inloggen"
dutchMessage PleaseProvideUsername = "Voer alstublieft uw gebruikersnaam in"
dutchMessage PleaseProvidePassword = "Voer alstublieft uw wachtwoord in"
dutchMessage NoIdentifierProvided = "Geen e-mailadres/gebruikersnaam opgegeven"
dutchMessage InvalidEmailAddress = "Ongeldig e-mailadres opgegeven"
dutchMessage PasswordResetTitle = "Wachtwoord wijzigen"
dutchMessage ProvideIdentifier = "E-mailadres of gebruikersnaam"
dutchMessage SendPasswordResetEmail = "Stuur een wachtwoord reset e-mail"
dutchMessage PasswordResetPrompt = "Voer uw e-mailadres of gebruikersnaam hieronder in, er zal een e-mail naar u worden verzonden waarmee u uw wachtwoord kunt wijzigen."
dutchMessage InvalidUsernamePass = "Ongeldige gebruikersnaam/wachtwoord combinatie"
dutchMessage (IdentifierNotFound ident) = "Inloggegevens niet gevonden: " `mappend` ident
dutchMessage Logout = "Uitloggen"
dutchMessage LogoutTitle = "Uitloggen"
dutchMessage AuthError = "Verificatiefout"
croatianMessage :: AuthMessage -> Text
croatianMessage NoOpenID = "Nije pronađen OpenID identifikator"
croatianMessage LoginOpenID = "Prijava uz OpenID"
croatianMessage LoginGoogle = "Prijava uz Google"
croatianMessage LoginYahoo = "Prijava uz Yahoo"
croatianMessage Facebook = "Prijava uz Facebook"
croatianMessage LoginViaEmail = "Prijava putem e-pošte"
croatianMessage Email = "E-pošta"
croatianMessage UserName = "Korisničko ime"
croatianMessage Password = "Lozinka"
croatianMessage CurrentPassword = "Current Password"
croatianMessage Register = "Registracija"
croatianMessage RegisterLong = "Registracija novog računa"
croatianMessage EnterEmail = "Dolje unesite adresu e-pošte, pa ćemo vam poslati e-poruku za potvrdu."
croatianMessage PasswordResetPrompt = "Dolje unesite adresu e-pošte ili korisničko ime, pa ćemo vam poslati e-poruku za potvrdu."
croatianMessage ConfirmationEmailSentTitle = "E-poruka za potvrdu"
croatianMessage (ConfirmationEmailSent email) = "E-poruka za potvrdu poslana je na adresu " <> email <> "."
croatianMessage AddressVerified = "Adresa ovjerena, postavite novu lozinku"
croatianMessage EmailVerifiedChangePass = "Adresa ovjerena, postavite novu lozinku"
croatianMessage EmailVerified = "Adresa ovjerena"
croatianMessage InvalidKeyTitle = "Ključ za ovjeru nije valjan"
croatianMessage InvalidKey = "Nažalost, taj ključ za ovjeru nije valjan."
croatianMessage InvalidEmailPass = "Kombinacija e-pošte i lozinke nije valjana"
croatianMessage InvalidUsernamePass = "Kombinacija korisničkog imena i lozinke nije valjana"
croatianMessage BadSetPass = "Za postavljanje lozinke morate biti prijavljeni"
croatianMessage SetPassTitle = "Postavi lozinku"
croatianMessage SetPass = "Postavite novu lozinku"
croatianMessage NewPass = "Nova lozinka"
croatianMessage ConfirmPass = "Potvrda lozinke"
croatianMessage PassMismatch = "Lozinke se ne podudaraju, pokušajte ponovo"
croatianMessage PassUpdated = "Lozinka ažurirana"
croatianMessage InvalidLogin = "Prijava nije valjana"
croatianMessage NowLoggedIn = "Sada ste prijavljeni u"
croatianMessage LoginTitle = "Prijava"
croatianMessage PleaseProvideUsername = "Unesite korisničko ime"
croatianMessage PleaseProvidePassword = "Unesite lozinku"
croatianMessage NoIdentifierProvided = "Nisu dani e-pošta/korisničko ime"
croatianMessage InvalidEmailAddress = "Dana adresa e-pošte nije valjana"
croatianMessage PasswordResetTitle = "Poništavanje lozinke"
croatianMessage ProvideIdentifier = "E-pošta ili korisničko ime"
croatianMessage SendPasswordResetEmail = "Pošalji e-poruku za poništavanje lozinke"
croatianMessage (IdentifierNotFound ident) = "Korisničko ime/e-pošta nisu pronađeni: " <> ident
croatianMessage Logout = "Odjava"
croatianMessage LogoutTitle = "Odjava"
croatianMessage AuthError = "Pogreška provjere autentičnosti"
danishMessage :: AuthMessage -> Text
danishMessage NoOpenID = "Mangler OpenID identifier"
danishMessage LoginOpenID = "Login med OpenID"
danishMessage LoginGoogle = "Login med Google"
danishMessage LoginYahoo = "Login med Yahoo"
danishMessage Email = "E-mail"
danishMessage UserName = "Brugernavn"
danishMessage Password = "Kodeord"
danishMessage CurrentPassword = "Nuværende kodeord"
danishMessage Register = "Opret"
danishMessage RegisterLong = "Opret en ny konto"
danishMessage EnterEmail = "Indtast din e-mailadresse nedenfor og en bekræftelsesmail vil blive sendt til dig."
danishMessage ConfirmationEmailSentTitle = "Bekræftelsesmail sendt"
danishMessage (ConfirmationEmailSent email) =
"En bekræftelsesmail er sendt til " `mappend`
email `mappend`
"."
danishMessage AddressVerified = "Adresse bekræftet, sæt venligst et nyt kodeord"
danishMessage EmailVerifiedChangePass = "Adresse bekræftet, sæt venligst et nyt kodeord"
danishMessage EmailVerified = "Adresse bekræftet"
danishMessage InvalidKeyTitle = "Ugyldig verifikationsnøgle"
danishMessage InvalidKey = "Beklager, det var en ugyldigt verifikationsnøgle."
danishMessage InvalidEmailPass = "Ugyldigt e-mail/kodeord"
danishMessage BadSetPass = "Du skal være logget ind for at sætte et kodeord"
danishMessage SetPassTitle = "Sæt kodeord"
danishMessage SetPass = "Sæt et nyt kodeord"
danishMessage NewPass = "Nyt kodeord"
danishMessage ConfirmPass = "Bekræft"
danishMessage PassMismatch = "Kodeordne var forskellige, prøv venligst igen"
danishMessage PassUpdated = "Kodeord opdateret"
danishMessage Facebook = "Login med Facebook"
danishMessage LoginViaEmail = "Login med e-mail"
danishMessage InvalidLogin = "Ugyldigt login"
danishMessage NowLoggedIn = "Du er nu logget ind"
danishMessage LoginTitle = "Log ind"
danishMessage PleaseProvideUsername = "Indtast venligst dit brugernavn"
danishMessage PleaseProvidePassword = "Indtasy venligst dit kodeord"
danishMessage NoIdentifierProvided = "Mangler e-mail/username"
danishMessage InvalidEmailAddress = "Ugyldig e-mailadresse indtastet"
danishMessage PasswordResetTitle = "Nulstilning af kodeord"
danishMessage ProvideIdentifier = "E-mail eller brugernavn"
danishMessage SendPasswordResetEmail = "Send kodeordsnulstillingsmail"
danishMessage PasswordResetPrompt = "Indtast din e-mailadresse eller dit brugernavn nedenfor, så bliver en kodeordsnulstilningsmail sendt til dig."
danishMessage InvalidUsernamePass = "Ugyldigt brugernavn/kodeord"
danishMessage (IdentifierNotFound ident) = "Brugernavn findes ikke: " `mappend` ident
danishMessage Logout = "Log ud"
danishMessage LogoutTitle = "Log ud"
danishMessage AuthError = "Fejl ved bekræftelse af identitet"
koreanMessage :: AuthMessage -> Text
koreanMessage NoOpenID = "OpenID ID가 없습니다"
koreanMessage LoginOpenID = "OpenID로 로그인"
koreanMessage LoginGoogle = "Google로 로그인"
koreanMessage LoginYahoo = "Yahoo로 로그인"
koreanMessage Email = "이메일"
koreanMessage UserName = "사용자 이름"
koreanMessage Password = "비밀번호"
koreanMessage CurrentPassword = "현재 비밀번호"
koreanMessage Register = "등록"
koreanMessage RegisterLong = "새 계정 등록"
koreanMessage EnterEmail = "이메일 주소를 아래에 입력하시면 확인 이메일이 발송됩니다."
koreanMessage ConfirmationEmailSentTitle = "확인 이메일을 보냈습니다"
koreanMessage (ConfirmationEmailSent email) =
"확인 이메일을 " `mappend`
email `mappend`
"에 보냈습니다."
koreanMessage AddressVerified = "주소가 인증되었습니다. 새 비밀번호를 설정하세요."
koreanMessage EmailVerifiedChangePass = "주소가 인증되었습니다. 새 비밀번호를 설정하세요."
koreanMessage EmailVerified = "주소가 인증되었습니다"
koreanMessage InvalidKeyTitle = "인증키가 잘못되었습니다"
koreanMessage InvalidKey = "죄송합니다. 잘못된 인증키입니다."
koreanMessage InvalidEmailPass = "이메일 주소나 비밀번호가 잘못되었습니다"
koreanMessage BadSetPass = "비밀번호를 설정하기 위해서는 로그인해야 합니다"
koreanMessage SetPassTitle = "비밀번호 설정"
koreanMessage SetPass = "새 비밀번호 설정"
koreanMessage NewPass = "새 비밀번호"
koreanMessage ConfirmPass = "확인"
koreanMessage PassMismatch = "비밀번호가 맞지 않습니다. 다시 시도해주세요."
koreanMessage PassUpdated = "비밀번호가 업데이트 되었습니다"
koreanMessage Facebook = "Facebook으로 로그인"
koreanMessage LoginViaEmail = "이메일로"
koreanMessage InvalidLogin = "잘못된 로그인입니다"
koreanMessage NowLoggedIn = "로그인했습니다"
koreanMessage LoginTitle = "로그인"
koreanMessage PleaseProvideUsername = "사용자 이름을 입력하세요"
koreanMessage PleaseProvidePassword = "비밀번호를 입력하세요"
koreanMessage NoIdentifierProvided = "이메일 주소나 사용자 이름이 입력되어 있지 않습니다"
koreanMessage InvalidEmailAddress = "이메일 주소가 잘못되었습니다"
koreanMessage PasswordResetTitle = "비밀번호 변경"
koreanMessage ProvideIdentifier = "이메일 주소나 사용자 이름"
koreanMessage SendPasswordResetEmail = "비밀번호 재설정 이메일 보내기"
koreanMessage PasswordResetPrompt = "이메일 주소나 사용자 이름을 아래에 입력하시면 비밀번호 재설정 이메일이 발송됩니다."
koreanMessage InvalidUsernamePass = "사용자 이름이나 비밀번호가 잘못되었습니다"
koreanMessage (IdentifierNotFound ident) = ident `mappend` "는 등록되어 있지 않습니다"
koreanMessage Logout = "로그아웃"
koreanMessage LogoutTitle = "로그아웃"
koreanMessage AuthError = "인증오류"

View File

@ -1,50 +1,58 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE GADTs #-}
module Yesod.Auth.OpenId
( authOpenId
, authOpenIdExtended
, forwardUrl
, claimedKey
, opLocalKey
, credsIdentClaimed
, IdentifierType (..)
) where
#include "qq.h"
import Yesod.Auth
import qualified Web.Authenticate.OpenId as OpenId
import Yesod.Form
import Yesod.Handler
import Yesod.Widget
import Yesod.Request
import Text.Cassius (cassius)
import Text.Blaze (toHtml)
import Data.Text (Text)
import Yesod.Core
import Data.Text (Text, isPrefixOf)
import qualified Yesod.Auth.Message as Msg
import Control.Exception.Lifted (SomeException, try)
import UnliftIO.Exception (tryAny)
import Data.Maybe (fromMaybe)
import qualified Data.Text as T
forwardUrl :: AuthRoute
forwardUrl = PluginR "openid" ["forward"]
authOpenId :: YesodAuth m => AuthPlugin m
authOpenId = authOpenIdExtended []
data IdentifierType = Claimed | OPLocal
authOpenIdExtended :: YesodAuth m => [(Text, Text)] -> AuthPlugin m
authOpenIdExtended extensionFields =
authOpenId :: YesodAuth master
=> IdentifierType
-> [(Text, Text)] -- ^ extension fields
-> AuthPlugin master
authOpenId idType extensionFields =
AuthPlugin "openid" dispatch login
where
complete = PluginR "openid" ["complete"]
name :: Text
name = "openid_identifier"
login tm = do
ident <- lift newIdent
addCassius
[QQ(cassius)|##{ident}
ident <- newIdent
-- FIXME this is a hack to get GHC 7.6's type checker to allow the
-- code, but it shouldn't be necessary
let y :: a -> [(Text, Text)] -> Text
y = undefined
toWidget (\x -> [cassius|##{ident}
background: #fff url(http://www.myopenid.com/static/openid-icon-small.gif) no-repeat scroll 0pt 50%;
padding-left: 18px;
|]
[QQ(whamlet)|
<form method="get" action="@{tm forwardUrl}">
<input type="hidden" name="openid_identifier" value="https://www.google.com/accounts/o8/id">
<button .openid-google>_{Msg.LoginGoogle}
|] $ x `asTypeOf` y)
[whamlet|
$newline never
<form method="get" action="@{tm forwardUrl}">
<input type="hidden" name="openid_identifier" value="http://me.yahoo.com">
<button .openid-yahoo>_{Msg.LoginYahoo}
@ -53,42 +61,82 @@ authOpenIdExtended extensionFields =
<input id="#{ident}" type="text" name="#{name}" value="http://">
<input type="submit" value="_{Msg.LoginOpenID}">
|]
dispatch :: Text -> [Text] -> AuthHandler master TypedContent
dispatch "GET" ["forward"] = do
roid <- runInputGet $ iopt textField name
case roid of
Just oid -> do
tm <- getRouteToParent
render <- getUrlRender
toMaster <- getRouteToMaster
let complete' = render $ toMaster complete
master <- getYesod
eres <- lift $ try $ OpenId.getForwardUrl oid complete' Nothing extensionFields (authHttpManager master)
let complete' = render $ tm complete
manager <- authHttpManager
eres <- tryAny $ OpenId.getForwardUrl oid complete' Nothing extensionFields manager
case eres of
Left err -> do
setMessage $ toHtml $ show (err :: SomeException)
redirect $ toMaster LoginR
Left err -> loginErrorMessage (tm LoginR) $ T.pack $ show err
Right x -> redirect x
Nothing -> do
toMaster <- getRouteToMaster
setMessageI Msg.NoOpenID
redirect $ toMaster LoginR
Nothing -> loginErrorMessageI LoginR Msg.NoOpenID
dispatch "GET" ["complete", ""] = dispatch "GET" ["complete"] -- compatibility issues
dispatch "GET" ["complete"] = do
rr <- getRequest
completeHelper $ reqGetParams rr
completeHelper idType $ reqGetParams rr
dispatch "POST" ["complete", ""] = dispatch "POST" ["complete"] -- compatibility issues
dispatch "POST" ["complete"] = do
(posts, _) <- runRequestBody
completeHelper posts
completeHelper idType posts
dispatch _ _ = notFound
completeHelper :: YesodAuth m => [(Text, Text)] -> GHandler Auth m ()
completeHelper gets' = do
master <- getYesod
eres <- lift $ try $ OpenId.authenticate gets' (authHttpManager master)
toMaster <- getRouteToMaster
let onFailure err = do
setMessage $ toHtml $ show (err :: SomeException)
redirect $ toMaster LoginR
let onSuccess (OpenId.Identifier ident, _) =
setCreds True $ Creds "openid" ident gets'
either onFailure onSuccess eres
completeHelper :: IdentifierType -> [(Text, Text)] -> AuthHandler master TypedContent
completeHelper idType gets' = do
manager <- authHttpManager
eres <- tryAny $ OpenId.authenticateClaimed gets' manager
either onFailure onSuccess eres
where
onFailure err = do
tm <- getRouteToParent
loginErrorMessage (tm LoginR) $ T.pack $ show err
onSuccess oir = do
let claimed =
case OpenId.oirClaimed oir of
Nothing -> id
Just (OpenId.Identifier i') -> ((claimedKey, i'):)
oplocal =
case OpenId.oirOpLocal oir of
OpenId.Identifier i' -> ((opLocalKey, i'):)
gets'' = oplocal $ claimed $ filter (\(k, _) -> not $ "__" `isPrefixOf` k) gets'
i = OpenId.identifier $
case idType of
OPLocal -> OpenId.oirOpLocal oir
Claimed -> fromMaybe (OpenId.oirOpLocal oir) $ OpenId.oirClaimed oir
setCredsRedirect $ Creds "openid" i gets''
-- | The main identifier provided by the OpenID authentication plugin is the
-- \"OP-local identifier\". There is also sometimes a \"claimed\" identifier
-- available.
--
-- In the 'credsExtra' field of the 'Creds' datatype, you can lookup this key
-- to find the claimed identifier, if available.
--
-- > let finalID = fromMaybe (credsIdent creds)
-- > $ lookup claimedKey (credsExtra creds)
--
-- Since 1.0.2
claimedKey :: Text
claimedKey = "__CLAIMED"
opLocalKey :: Text
opLocalKey = "__OPLOCAL"
-- | A helper function which will get the claimed identifier, if available, falling back to the OP local identifier.
--
-- See 'claimedKey'.
--
-- Since 1.0.2
credsIdentClaimed :: Creds m -> Text
-- Prevent other backends from overloading the __CLAIMED value, which could
-- possibly open us to security holes.
credsIdentClaimed c | credsPlugin c /= "openid" = credsIdent c
credsIdentClaimed c = fromMaybe (credsIdent c)
$ lookup claimedKey (credsExtra c)

View File

@ -0,0 +1,20 @@
{-# LANGUAGE QuasiQuotes, TypeFamilies, TemplateHaskell #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ViewPatterns #-}
module Yesod.Auth.Routes where
import Yesod.Core
import Data.Text (Text)
data Auth = Auth
mkYesodSubData "Auth" [parseRoutes|
/check CheckR GET
/login LoginR GET
/logout LogoutR GET POST
/page/#Text/*Texts PluginR
|]

View File

@ -1,44 +1,48 @@
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
module Yesod.Auth.Rpxnow
( authRpxnow
) where
#include "qq.h"
import Yesod.Auth
import qualified Web.Authenticate.Rpxnow as Rpxnow
import Control.Monad (mplus)
import Yesod.Handler
import Yesod.Widget
import Yesod.Request
import Text.Hamlet (hamlet)
import Yesod.Core
import Data.Text (pack, unpack)
import Data.Text.Encoding (encodeUtf8, decodeUtf8With)
import Data.Text.Encoding.Error (lenientDecode)
import Control.Arrow ((***))
import Network.HTTP.Types (renderQuery)
authRpxnow :: YesodAuth m
authRpxnow :: YesodAuth master
=> String -- ^ app name
-> String -- ^ key
-> AuthPlugin m
-> AuthPlugin master
authRpxnow app apiKey =
AuthPlugin "rpxnow" dispatch login
where
login tm = do
let url = {- FIXME urlEncode $ -} tm $ PluginR "rpxnow" []
addHamlet
[QQ(hamlet)|
<iframe src="http://#{app}.rpxnow.com/openid/embed?token_url=@{url}" scrolling="no" frameBorder="no" allowtransparency="true" style="width:400px;height:240px">
render <- getUrlRender
let queryString = decodeUtf8With lenientDecode
$ renderQuery True [("token_url", Just $ encodeUtf8 $ render $ tm $ PluginR "rpxnow" [])]
toWidget [hamlet|
$newline never
<iframe src="http://#{app}.rpxnow.com/openid/embed#{queryString}" scrolling="no" frameBorder="no" allowtransparency="true" style="width:400px;height:240px">
|]
dispatch :: a -> [b] -> AuthHandler master TypedContent
dispatch _ [] = do
token1 <- lookupGetParams "token"
token2 <- lookupPostParams "token"
token <- case token1 ++ token2 of
[] -> invalidArgs ["token: Value not supplied"]
x:_ -> return $ unpack x
master <- getYesod
Rpxnow.Identifier ident extra <- lift $ Rpxnow.authenticate apiKey token (authHttpManager master)
manager <- authHttpManager
Rpxnow.Identifier ident extra <- Rpxnow.authenticate apiKey token manager
let creds =
Creds "rpxnow" ident
$ maybe id (\x -> (:) ("verifiedEmail", x))
@ -46,7 +50,7 @@ authRpxnow app apiKey =
$ maybe id (\x -> (:) ("displayName", x))
(fmap pack $ getDisplayName $ map (unpack *** unpack) extra)
[]
setCreds True creds
setCredsRedirect creds
dispatch _ _ = notFound
-- | Get some form of a display name.

View File

@ -0,0 +1,464 @@
{-# LANGUAGE OverloadedStrings, BangPatterns #-}
{-# LANGUAGE CPP #-}
-- |
-- This is a fork of pwstore-fast, originally copyright (c) Peter Scott, 2011,
-- and released under a BSD-style licence.
--
-- Securely store hashed, salted passwords. If you need to store and verify
-- passwords, there are many wrong ways to do it, most of them all too
-- common. Some people store users' passwords in plain text. Then, when an
-- attacker manages to get their hands on this file, they have the passwords for
-- every user's account. One step up, but still wrong, is to simply hash all
-- passwords with SHA1 or something. This is vulnerable to rainbow table and
-- dictionary attacks. One step up from that is to hash the password along with
-- a unique salt value. This is vulnerable to dictionary attacks, since guessing
-- a password is very fast. The right thing to do is to use a slow hash
-- function, to add some small but significant delay, that will be negligible
-- for legitimate users but prohibitively expensive for someone trying to guess
-- passwords by brute force. That is what this library does. It iterates a
-- SHA256 hash, with a random salt, a few thousand times. This scheme is known
-- as PBKDF1, and is generally considered secure; there is nothing innovative
-- happening here.
--
-- The API here is very simple. What you store are called /password hashes/.
-- They are strings (technically, ByteStrings) that look like this:
--
-- > "sha256|14|jEWU94phx4QzNyH94Qp4CQ==|5GEw+jxP/4WLgzt9VS3Ee3nhqBlDsrKiB+rq7JfMckU="
--
-- Each password hash shows the algorithm, the strength (more on that later),
-- the salt, and the hashed-and-salted password. You store these on your server,
-- in a database, for when you need to verify a password. You make a password
-- hash with the 'makePassword' function. Here's an example:
--
-- > >>> makePassword "hunter2" 14
-- > "sha256|14|Zo4LdZGrv/HYNAUG3q8WcA==|zKjbHZoTpuPLp1lh6ATolWGIKjhXvY4TysuKvqtNFyk="
--
-- This will hash the password @\"hunter2\"@, with strength 14, which is a good
-- default value. The strength here determines how long the hashing will
-- take. When doing the hashing, we iterate the SHA256 hash function
-- @2^strength@ times, so increasing the strength by 1 makes the hashing take
-- twice as long. When computers get faster, you can bump up the strength a
-- little bit to compensate. You can strengthen existing password hashes with
-- the 'strengthenPassword' function. Note that 'makePassword' needs to generate
-- random numbers, so its return type is 'IO' 'ByteString'. If you want to avoid
-- the 'IO' monad, you can generate your own salt and pass it to
-- 'makePasswordSalt'.
--
-- Your strength value should not be less than 12, and 14 is a good default
-- value at the time of this writing, in 2013.
--
-- Once you've got your password hashes, the second big thing you need to do
-- with them is verify passwords against them. When a user gives you a password,
-- you compare it with a password hash using the 'verifyPassword' function:
--
-- > >>> verifyPassword "wrong guess" passwordHash
-- > False
-- > >>> verifyPassword "hunter2" passwordHash
-- > True
--
-- These two functions are really all you need. If you want to make existing
-- password hashes stronger, you can use 'strengthenPassword'. Just pass it an
-- existing password hash and a new strength value, and it will return a new
-- password hash with that strength value, which will match the same password as
-- the old password hash.
--
-- Note that, as of version 2.4, you can also use PBKDF2, and specify the exact
-- iteration count. This does not have a significant effect on security, but can
-- be handy for compatibility with other code.
--
-- @since 1.4.18
module Yesod.Auth.Util.PasswordStore (
-- * Algorithms
pbkdf1, -- :: ByteString -> Salt -> Int -> ByteString
pbkdf2, -- :: ByteString -> Salt -> Int -> ByteString
-- * Registering and verifying passwords
makePassword, -- :: ByteString -> Int -> IO ByteString
makePasswordWith, -- :: (ByteString -> Salt -> Int -> ByteString) ->
-- ByteString -> Int -> IO ByteString
makePasswordSalt, -- :: ByteString -> ByteString -> Int -> ByteString
makePasswordSaltWith, -- :: (ByteString -> Salt -> Int -> ByteString) ->
-- ByteString -> Salt -> Int -> ByteString
verifyPassword, -- :: ByteString -> ByteString -> Bool
verifyPasswordWith, -- :: (ByteString -> Salt -> Int -> ByteString) ->
-- (Int -> Int) -> ByteString -> ByteString -> Bool
-- * Updating password hash strength
strengthenPassword, -- :: ByteString -> Int -> ByteString
passwordStrength, -- :: ByteString -> Int
-- * Utilities
Salt,
isPasswordFormatValid, -- :: ByteString -> Bool
genSaltIO, -- :: IO Salt
genSaltRandom, -- :: (RandomGen b) => b -> (Salt, b)
makeSalt, -- :: ByteString -> Salt
exportSalt, -- :: Salt -> ByteString
importSalt -- :: ByteString -> Salt
) where
import qualified Crypto.MAC.HMAC as CH
import qualified Crypto.Hash as CH
import qualified Data.ByteString.Char8 as B
import qualified Data.ByteString as BS
import qualified Data.ByteString.Lazy as BL
import qualified Data.Binary as Binary
import Control.Monad
import Control.Monad.ST
import Data.STRef
import Data.Bits
import Data.ByteString.Char8 (ByteString)
import Data.ByteString.Base64 (encode, decodeLenient)
import System.IO
import System.Random
import Data.Maybe
import qualified Control.Exception
import Data.ByteArray (convert)
---------------------
-- Cryptographic base
---------------------
-- | PBKDF1 key-derivation function. Takes a password, a 'Salt', and a number of
-- iterations. The number of iterations should be at least 1000, and probably
-- more. 5000 is a reasonable number, computing almost instantaneously. This
-- will give a 32-byte 'ByteString' as output. Both the salt and this 32-byte
-- key should be stored in the password file. When a user wishes to authenticate
-- a password, just pass it and the salt to this function, and see if the output
-- matches.
--
-- @since 1.4.18
--
pbkdf1 :: ByteString -> Salt -> Int -> ByteString
pbkdf1 password (SaltBS salt) iter = hashRounds first_hash (iter + 1)
where
first_hash =
convert $
((CH.hashFinalize $ CH.hashInit `CH.hashUpdate` password `CH.hashUpdate` salt) :: CH.Digest CH.SHA256)
-- | Hash a 'ByteString' for a given number of rounds. The number of rounds is 0
-- or more. If the number of rounds specified is 0, the ByteString will be
-- returned unmodified.
hashRounds :: ByteString -> Int -> ByteString
hashRounds (!bs) 0 = bs
hashRounds bs rounds = hashRounds (convert (CH.hash bs :: CH.Digest CH.SHA256)) (rounds - 1)
-- | Computes the hmacSHA256 of the given message, with the given 'Salt'.
hmacSHA256 :: ByteString
-- ^ The secret (the salt)
-> ByteString
-- ^ The clear-text message
-> ByteString
-- ^ The encoded message
hmacSHA256 secret msg =
convert (CH.hmacGetDigest (CH.hmac secret msg) :: CH.Digest CH.SHA256)
-- | PBKDF2 key-derivation function.
-- For details see @http://tools.ietf.org/html/rfc2898@.
-- @32@ is the most common digest size for @SHA256@, and is
-- what the algorithm internally uses.
-- @HMAC+SHA256@ is used as @PRF@, because @HMAC+SHA1@ is considered too weak.
--
-- @since 1.4.18
--
pbkdf2 :: ByteString -> Salt -> Int -> ByteString
pbkdf2 password (SaltBS salt) c =
let hLen = 32
dkLen = hLen in go hLen dkLen
where
go hLen dkLen | dkLen > (2^(32 :: Int) - 1) * hLen = error "Derived key too long."
| otherwise =
let !l = ceiling ((fromIntegral dkLen / fromIntegral hLen) :: Double)
!r = dkLen - (l - 1) * hLen
chunks = [f i | i <- [1 .. l]]
in (B.concat . init $ chunks) `B.append` B.take r (last chunks)
-- The @f@ function, as defined in the spec.
-- It calls 'u' under the hood.
f :: Int -> ByteString
f i = let !u1 = hmacSHA256 password (salt `B.append` int i)
-- Using the ST Monad, for maximum performance.
in runST $ do
u <- newSTRef u1
accum <- newSTRef u1
forM_ [2 .. c] $ \_ -> do
modifySTRef' u (hmacSHA256 password)
currentU <- readSTRef u
modifySTRef' accum (`xor'` currentU)
readSTRef accum
-- int(i), as defined in the spec.
int :: Int -> ByteString
int i = let str = BL.unpack . Binary.encode $ i
in BS.pack $ drop (length str - 4) str
-- | A convenience function to XOR two 'ByteString' together.
xor' :: ByteString -> ByteString -> ByteString
xor' !b1 !b2 = BS.pack $ BS.zipWith xor b1 b2
-- | Generate a 'Salt' from 128 bits of data from @\/dev\/urandom@, with the
-- system RNG as a fallback. This is the function used to generate salts by
-- 'makePassword'.
--
-- @since 1.4.18
--
genSaltIO :: IO Salt
genSaltIO =
Control.Exception.catch genSaltDevURandom def
where
def :: IOError -> IO Salt
def _ = genSaltSysRandom
-- | Generate a 'Salt' from @\/dev\/urandom@.
genSaltDevURandom :: IO Salt
genSaltDevURandom = withFile "/dev/urandom" ReadMode $ \h -> do
rawSalt <- B.hGet h 16
return $ makeSalt rawSalt
-- | Generate a 'Salt' from 'System.Random'.
genSaltSysRandom :: IO Salt
genSaltSysRandom = randomChars >>= return . makeSalt . B.pack
where randomChars = sequence $ replicate 16 $ randomRIO ('\NUL', '\255')
-----------------------
-- Password hash format
-----------------------
-- Format: "sha256|strength|salt|hash", where strength is an unsigned int, salt
-- is a base64-encoded 16-byte random number, and hash is a base64-encoded hash
-- value.
-- | Try to parse a password hash.
readPwHash :: ByteString -> Maybe (Int, Salt, ByteString)
readPwHash pw | length broken /= 4
|| algorithm /= "sha256"
|| B.length hash /= 44 = Nothing
| otherwise = case B.readInt strBS of
Just (strength, _) -> Just (strength, SaltBS salt, hash)
Nothing -> Nothing
where broken = B.split '|' pw
[algorithm, strBS, salt, hash] = broken
-- | Encode a password hash, from a @(strength, salt, hash)@ tuple, where
-- strength is an 'Int', and both @salt@ and @hash@ are base64-encoded
-- 'ByteString's.
writePwHash :: (Int, Salt, ByteString) -> ByteString
writePwHash (strength, SaltBS salt, hash) =
B.intercalate "|" ["sha256", B.pack (show strength), salt, hash]
-----------------
-- High level API
-----------------
-- | Hash a password with a given strength (14 is a good default). The output of
-- this function can be written directly to a password file or
-- database. Generates a salt using high-quality randomness from
-- @\/dev\/urandom@ or (if that is not available, for example on Windows)
-- 'System.Random', which is included in the hashed output.
--
-- @since 1.4.18
--
makePassword :: ByteString -> Int -> IO ByteString
makePassword = makePasswordWith pbkdf1
-- | A generic version of 'makePassword', which allow the user
-- to choose the algorithm to use.
--
-- >>> makePasswordWith pbkdf1 "password" 14
--
-- @since 1.4.18
--
makePasswordWith :: (ByteString -> Salt -> Int -> ByteString)
-- ^ The algorithm to use (e.g. pbkdf1)
-> ByteString
-- ^ The password to encrypt
-> Int
-- ^ log2 of the number of iterations
-> IO ByteString
makePasswordWith algorithm password strength = do
salt <- genSaltIO
return $ makePasswordSaltWith algorithm (2^) password salt strength
-- | A generic version of 'makePasswordSalt', meant to give the user
-- the maximum control over the generation parameters.
-- Note that, unlike 'makePasswordWith', this function takes the @raw@
-- number of iterations. This means the user will need to specify a
-- sensible value, typically @10000@ or @20000@.
--
-- @since 1.4.18
--
makePasswordSaltWith :: (ByteString -> Salt -> Int -> ByteString)
-- ^ A function modeling an algorithm (e.g. 'pbkdf1')
-> (Int -> Int)
-- ^ A function to modify the strength
-> ByteString
-- ^ A password, given as clear text
-> Salt
-- ^ A hash 'Salt'
-> Int
-- ^ The password strength (e.g. @10000, 20000, etc.@)
-> ByteString
makePasswordSaltWith algorithm strengthModifier pwd salt strength = writePwHash (strength, salt, hash)
where hash = encode $ algorithm pwd salt (strengthModifier strength)
-- | Hash a password with a given strength (14 is a good default), using a given
-- salt. The output of this function can be written directly to a password file
-- or database. Example:
--
-- > >>> makePasswordSalt "hunter2" (makeSalt "72cd18b5ebfe6e96") 14
-- > "sha256|14|NzJjZDE4YjVlYmZlNmU5Ng==|yuiNrZW3KHX+pd0sWy9NTTsy5Yopmtx4UYscItSsoxc="
--
-- @since 1.4.18
--
makePasswordSalt :: ByteString -> Salt -> Int -> ByteString
makePasswordSalt = makePasswordSaltWith pbkdf1 (2^)
-- | 'verifyPasswordWith' @algorithm userInput pwHash@ verifies
-- the password @userInput@ given by the user against the stored password
-- hash @pwHash@, with the hashing algorithm @algorithm@. Returns 'True' if the
-- given password is correct, and 'False' if it is not.
-- This function allows the programmer to specify the algorithm to use,
-- e.g. 'pbkdf1' or 'pbkdf2'.
-- Note: If you want to verify a password previously generated with
-- 'makePasswordSaltWith', but without modifying the number of iterations,
-- you can do:
--
-- > >>> verifyPasswordWith pbkdf2 id "hunter2" "sha256..."
-- > True
--
-- @since 1.4.18
--
verifyPasswordWith :: (ByteString -> Salt -> Int -> ByteString)
-- ^ A function modeling an algorithm (e.g. pbkdf1)
-> (Int -> Int)
-- ^ A function to modify the strength
-> ByteString
-- ^ User password
-> ByteString
-- ^ The generated hash (e.g. sha256|14...)
-> Bool
verifyPasswordWith algorithm strengthModifier userInput pwHash =
case readPwHash pwHash of
Nothing -> False
Just (strength, salt, goodHash) ->
encode (algorithm userInput salt (strengthModifier strength)) == goodHash
-- | Like 'verifyPasswordWith', but uses 'pbkdf1' as algorithm.
--
-- @since 1.4.18
--
verifyPassword :: ByteString -> ByteString -> Bool
verifyPassword = verifyPasswordWith pbkdf1 (2^)
-- | Try to strengthen a password hash, by hashing it some more
-- times. @'strengthenPassword' pwHash new_strength@ will return a new password
-- hash with strength at least @new_strength@. If the password hash already has
-- strength greater than or equal to @new_strength@, then it is returned
-- unmodified. If the password hash is invalid and does not parse, it will be
-- returned without comment.
--
-- This function can be used to periodically update your password database when
-- computers get faster, in order to keep up with Moore's law. This isn't hugely
-- important, but it's a good idea.
--
-- @since 1.4.18
--
strengthenPassword :: ByteString -> Int -> ByteString
strengthenPassword pwHash newstr =
case readPwHash pwHash of
Nothing -> pwHash
Just (oldstr, salt, hashB64) ->
if oldstr < newstr then
writePwHash (newstr, salt, newHash)
else
pwHash
where newHash = encode $ hashRounds hash extraRounds
extraRounds = (2^newstr) - (2^oldstr)
hash = decodeLenient hashB64
-- | Return the strength of a password hash.
--
-- @since 1.4.18
--
passwordStrength :: ByteString -> Int
passwordStrength pwHash = case readPwHash pwHash of
Nothing -> 0
Just (strength, _, _) -> strength
------------
-- Utilities
------------
-- | A salt is a unique random value which is stored as part of the password
-- hash. You can generate a salt with 'genSaltIO' or 'genSaltRandom', or if you
-- really know what you're doing, you can create them from your own ByteString
-- values with 'makeSalt'.
--
-- @since 1.4.18
--
newtype Salt = SaltBS ByteString
deriving (Show, Eq, Ord)
-- | Create a 'Salt' from a 'ByteString'. The input must be at least 8
-- characters, and can contain arbitrary bytes. Most users will not need to use
-- this function.
--
-- @since 1.4.18
--
makeSalt :: ByteString -> Salt
makeSalt = SaltBS . encode . check_length
where check_length salt | B.length salt < 8 =
error "Salt too short. Minimum length is 8 characters."
| otherwise = salt
-- | Convert a 'Salt' into a 'ByteString'. The resulting 'ByteString' will be
-- base64-encoded. Most users will not need to use this function.
--
-- @since 1.4.18
--
exportSalt :: Salt -> ByteString
exportSalt (SaltBS bs) = bs
-- | Convert a raw 'ByteString' into a 'Salt'.
-- Use this function with caution, since using a weak salt will result in a
-- weak password.
--
-- @since 1.4.18
--
importSalt :: ByteString -> Salt
importSalt = SaltBS
-- | Is the format of a password hash valid? Attempts to parse a given password
-- hash. Returns 'True' if it parses correctly, and 'False' otherwise.
--
-- @since 1.4.18
--
isPasswordFormatValid :: ByteString -> Bool
isPasswordFormatValid = isJust . readPwHash
-- | Generate a 'Salt' with 128 bits of data taken from a given random number
-- generator. Returns the salt and the updated random number generator. This is
-- meant to be used with 'makePasswordSalt' by people who would prefer to either
-- use their own random number generator or avoid the 'IO' monad.
--
-- @since 1.4.18
--
genSaltRandom :: (RandomGen b) => b -> (Salt, b)
genSaltRandom gen = (salt, newgen)
where rands _ 0 = []
rands g n = (a, g') : rands g' (n-1 :: Int)
where (a, g') = randomR ('\NUL', '\255') g
salt = makeSalt $ B.pack $ map fst (rands gen 16)
newgen = snd $ last (rands gen 16)
#if !MIN_VERSION_base(4, 6, 0)
-- | Strict version of 'modifySTRef'
modifySTRef' :: STRef s a -> (a -> a) -> ST s ()
modifySTRef' ref f = do
x <- readSTRef ref
let x' = f x
x' `seq` writeSTRef ref x'
#endif

View File

@ -11,8 +11,11 @@ import Text.Hamlet (hamlet)
import Control.Monad.IO.Class (liftIO)
import Yesod.Form
import Network.Wai.Handler.Warp (run)
import Network.HTTP.Conduit
import Network.TLS
import Network.Wai.Middleware.RequestLogger
data BID = BID
data BID = BID { httpManager :: Manager }
mkYesod "BID" [parseRoutes|
/ RootR GET
@ -21,27 +24,31 @@ mkYesod "BID" [parseRoutes|
|]
getRootR :: Handler ()
getRootR = redirect RedirectTemporary $ AuthR LoginR
getRootR = redirect $ AuthR LoginR
getAfterLoginR :: Handler RepHtml
getAfterLoginR :: Handler Html
getAfterLoginR = do
mauth <- maybeAuthId
defaultLayout $ addHamlet [hamlet|
defaultLayout $ toWidget [hamlet|
<p>Auth: #{show mauth}
|]
instance Yesod BID where
approot _ = "http://localhost:3000"
approot = ApprootStatic "http://localhost:3000"
instance YesodAuth BID where
type AuthId BID = Text
loginDest _ = AfterLoginR
logoutDest _ = AuthR LoginR
getAuthId = return . Just . credsIdent
authPlugins = [authBrowserId']
authPlugins _ = [authBrowserId def]
authHttpManager = httpManager
maybeAuthId = lookupSession credsKey
instance RenderMessage BID FormMessage where
renderMessage _ _ = defaultFormMessage
main :: IO ()
main = toWaiApp BID >>= run 3000
main = do
m <- newManager conduitManagerSettings
toWaiApp (BID m) >>= run 3000 . logStdoutDev

View File

@ -1,10 +0,0 @@
-- CPP macro which choses which quasyquotes syntax to use depending
-- on GHC version.
--
-- QQ stands for quasyquote.
#if GHC7
# define QQ(x) x
#else
# define QQ(x) $x
#endif

View File

@ -1,41 +0,0 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE MultiParamTypeClasses #-}
import Yesod
import Yesod.Auth
import Yesod.Form
import Yesod.Auth.Kerberos
data Kerberos = Kerberos
mkYesod "Kerberos" [parseRoutes|
/ RootR GET
/after AfterLoginR GET
/auth AuthR Auth getAuth
|]
getRootR :: Handler ()
getRootR = redirect RedirectTemporary $ AuthR LoginR
getAfterLoginR :: Handler RepHtml
getAfterLoginR = defaultLayout $ return ()
instance Yesod Kerberos where
approot _ = "http://localhost:3000"
instance YesodAuth Kerberos where
type AuthId Kerberos = String
loginDest _ = AfterLoginR
logoutDest _ = AuthR LoginR
getAuthId _ = do
liftIO $ putStrLn "getAuthId"
return $ Just "foo"
authPlugins = [authKerberos]
instance RenderMessage Kerberos FormMessage where
renderMessage _ _ = defaultFormMessage
main :: IO ()
main = warpDebug 3000 Kerberos

View File

@ -27,7 +27,7 @@ getRootR = getAfterLoginR
getAfterLoginR :: Handler RepHtml
getAfterLoginR = do
mauth <- maybeAuthId
defaultLayout $ addHamlet [hamlet|
defaultLayout [whamlet|
<p>Auth: #{show mauth}
$maybe _ <- mauth
<p>
@ -38,21 +38,22 @@ $nothing
|]
instance Yesod BID where
approot _ = "http://localhost:3000"
approot = guessApproot
instance YesodAuth BID where
type AuthId BID = Text
loginDest _ = AfterLoginR
logoutDest _ = AuthR LoginR
getAuthId = return . Just . credsIdent
authPlugins _ = [authOpenId]
getAuthId = return . Just . credsIdentClaimed
authPlugins _ = [authOpenId Claimed []]
authHttpManager = httpManager
maybeAuthId = lookupSession credsKey
instance RenderMessage BID FormMessage where
renderMessage _ _ = defaultFormMessage
main :: IO ()
main = do
m <- newManager def
m <- newManager tlsManagerSettings
toWaiApp (BID m) >>= run 3000

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@ -1,51 +1,68 @@
cabal-version: >=1.10
name: yesod-auth
version: 0.8.1
license: BSD3
version: 1.6.11.2
license: MIT
license-file: LICENSE
author: Michael Snoyman, Patrick Brisbin
maintainer: Michael Snoyman <michael@snoyman.com>
synopsis: Authentication for Yesod.
category: Web, Yesod
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: API docs and the README are available at <http://www.stackage.org/package/yesod-auth>
extra-source-files: persona_sign_in_blue.png
README.md
ChangeLog.md
flag ghc7
flag network-uri
description: Get Network.URI from the network-uri package
default: True
library
if flag(ghc7)
build-depends: base >= 4.3 && < 5
cpp-options: -DGHC7
else
build-depends: base >= 4 && < 4.3
build-depends: authenticate >= 1.0 && < 1.1
, bytestring >= 0.9.1.4 && < 0.10
, yesod-core >= 0.10.1 && < 0.11
, wai >= 1.1 && < 1.2
, template-haskell
, pureMD5 >= 2.0 && < 2.2
, random >= 1.0.0.2 && < 1.1
, text >= 0.7 && < 0.12
, mime-mail >= 0.3 && < 0.5
, blaze-html >= 0.4.1.3 && < 0.5
, yesod-persistent >= 0.3.1 && < 0.4
, hamlet >= 0.10 && < 0.11
, shakespeare-css >= 0.10 && < 0.11
, yesod-json >= 0.3.1 && < 0.4
default-language: Haskell2010
build-depends: base >= 4.10 && < 5
, aeson >= 0.7
, attoparsec-aeson >= 2.1
, authenticate >= 1.3.4
, base16-bytestring
, base64-bytestring
, binary
, blaze-builder
, blaze-html >= 0.5
, blaze-markup >= 0.5.1
, bytestring >= 0.9.1.4
, conduit >= 1.3
, conduit-extra
, containers
, cryptonite
, data-default
, email-validate >= 1.0
, file-embed
, http-client >= 0.5
, http-client-tls
, http-conduit >= 2.1
, http-types
, memory
, nonce >= 1.0.2 && < 1.1
, persistent >= 2.8
, random >= 1.0.0.2
, safe
, shakespeare
, template-haskell
, text >= 0.7
, time
, transformers >= 0.2.2
, unliftio
, unliftio-core
, unordered-containers
, yesod-form >= 0.4.1 && < 0.5
, transformers >= 0.2.2 && < 0.3
, persistent >= 0.8 && < 0.9
, persistent-template >= 0.8 && < 0.9
, SHA >= 1.4.1.3 && < 1.6
, http-conduit >= 1.2.5 && < 1.3
, aeson >= 0.5
, pwstore-fast >= 2.2 && < 3
, lifted-base >= 0.1 && < 0.2
, wai >= 1.4
, yesod-core >= 1.6 && < 1.7
, yesod-form >= 1.6 && < 1.8
, yesod-persistent >= 1.6
if flag(network-uri)
build-depends: network-uri >= 2.6
exposed-modules: Yesod.Auth
Yesod.Auth.BrowserId
@ -53,11 +70,12 @@ library
Yesod.Auth.Email
Yesod.Auth.OpenId
Yesod.Auth.Rpxnow
Yesod.Auth.HashDB
Yesod.Auth.Message
Yesod.Auth.GoogleEmail
Yesod.Auth.GoogleEmail2
Yesod.Auth.Hardcoded
Yesod.Auth.Util.PasswordStore
other-modules: Yesod.Auth.Routes
ghc-options: -Wall
include-dirs: include
source-repository head
type: git

259
yesod-bin/AddHandler.hs Normal file
View File

@ -0,0 +1,259 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE PatternGuards #-}
module AddHandler (addHandler) where
import Prelude hiding (readFile)
import System.IO (hFlush, stdout)
import Data.Char (isLower, toLower, isSpace)
import Data.List (isPrefixOf, isSuffixOf, stripPrefix)
import Data.Maybe (fromMaybe, listToMaybe)
import qualified Data.Text as T
import qualified Data.Text.IO as TIO
#if MIN_VERSION_Cabal(3, 7, 0)
import Distribution.Simple.PackageDescription (readGenericPackageDescription)
#elif MIN_VERSION_Cabal(2, 2, 0)
import Distribution.PackageDescription.Parsec (readGenericPackageDescription)
#elif MIN_VERSION_Cabal(2, 0, 0)
import Distribution.PackageDescription.Parse (readGenericPackageDescription)
#else
import Distribution.PackageDescription.Parse (readPackageDescription)
#endif
#if MIN_VERSION_Cabal(3, 6, 0)
import Distribution.Utils.Path
#endif
import Distribution.PackageDescription.Configuration (flattenPackageDescription)
import Distribution.PackageDescription (allBuildInfo, hsSourceDirs)
import Distribution.Verbosity (normal)
import System.Directory (getDirectoryContents, doesFileExist)
import Control.Monad (unless)
data RouteError = EmptyRoute
| RouteCaseError
| RouteExists FilePath
deriving Eq
instance Show RouteError where
show EmptyRoute = "No name entered. Quitting ..."
show RouteCaseError = "Name must start with an upper case letter"
show (RouteExists file) = "File already exists: " ++ file
-- strict readFile
readFile :: FilePath -> IO String
readFile = fmap T.unpack . TIO.readFile
cmdLineArgsError :: String
cmdLineArgsError = "You have to specify a route name if you want to add handler with command line arguments."
addHandler :: Maybe String -> Maybe String -> [String] -> IO ()
addHandler (Just route) pat met = do
cabal <- getCabal
checked <- checkRoute route cabal
let routePair = case checked of
Left err@EmptyRoute -> (error . show) err
Left err@RouteCaseError -> (error . show) err
Left err@(RouteExists _) -> (error . show) err
Right p -> p
addHandlerFiles cabal routePair pattern methods
where
pattern = fromMaybe "" pat -- pattern defaults to ""
methods = unwords met -- methods default to none
addHandler Nothing (Just _) _ = error cmdLineArgsError
addHandler Nothing _ (_:_) = error cmdLineArgsError
addHandler _ _ _ = addHandlerInteractive
addHandlerInteractive :: IO ()
addHandlerInteractive = do
cabal <- getCabal
let routeInput = do
putStr "Name of route (without trailing R): "
hFlush stdout
name <- getLine
checked <- checkRoute name cabal
case checked of
Left err@EmptyRoute -> (error . show) err
Left err@RouteCaseError -> print err >> routeInput
Left err@(RouteExists _) -> do
print err
putStrLn "Try another name or leave blank to exit"
routeInput
Right p -> return p
routePair <- routeInput
putStr "Enter route pattern (ex: /entry/#EntryId): "
hFlush stdout
pattern <- getLine
putStr "Enter space-separated list of methods (ex: GET POST): "
hFlush stdout
methods <- getLine
addHandlerFiles cabal routePair pattern methods
getRoutesFilePath :: IO FilePath
getRoutesFilePath = do
let oldPath = "config/routes"
oldExists <- doesFileExist oldPath
pure $ if oldExists
then oldPath
else "config/routes.yesodroutes"
addHandlerFiles :: FilePath -> (String, FilePath) -> String -> String -> IO ()
addHandlerFiles cabal (name, handlerFile) pattern methods = do
src <- getSrcDir cabal
let applicationFile = concat [src, "/Application.hs"]
modify applicationFile $ fixApp name
modify cabal $ fixCabal name
routesPath <- getRoutesFilePath
modify routesPath $ fixRoutes name pattern methods
writeFile handlerFile $ mkHandler name pattern methods
specExists <- doesFileExist specFile
unless specExists $
writeFile specFile $ mkSpec name pattern methods
where
specFile = "test/Handler/" ++ name ++ "Spec.hs"
modify fp f = readFile fp >>= writeFile fp . f
getCabal :: IO FilePath
getCabal = do
allFiles <- getDirectoryContents "."
case filter (".cabal" `isSuffixOf`) allFiles of
[x] -> return x
[] -> error "No cabal file found"
_ -> error "Too many cabal files found"
checkRoute :: String -> FilePath -> IO (Either RouteError (String, FilePath))
checkRoute name cabal =
case name of
[] -> return $ Left EmptyRoute
c:_
| isLower c -> return $ Left RouteCaseError
| otherwise -> do
-- Check that the handler file doesn't already exist
src <- getSrcDir cabal
let handlerFile = concat [src, "/Handler/", name, ".hs"]
exists <- doesFileExist handlerFile
if exists
then (return . Left . RouteExists) handlerFile
else return $ Right (name, handlerFile)
fixApp :: String -> String -> String
fixApp name =
unlines . reverse . go . reverse . lines
where
l spaces = "import " ++ spaces ++ "Handler." ++ name
go [] = [l ""]
go (x:xs)
| Just y <- stripPrefix "import " x, "Handler." `isPrefixOf` dropWhile (== ' ') y = l (takeWhile (== ' ') y) : x : xs
| otherwise = x : go xs
fixCabal :: String -> String -> String
fixCabal name orig =
unlines $ (reverse $ go $ reverse libraryLines) ++ restLines
where
origLines = lines orig
(libraryLines, restLines) = break isExeTestBench origLines
isExeTestBench x = any
(\prefix -> prefix `isPrefixOf` x)
[ "executable"
, "test-suite"
, "benchmark"
]
l = " Handler." ++ name
go [] = [l]
go (x:xs)
| "Handler." `isPrefixOf` x' = (spaces ++ "Handler." ++ name) : x : xs
| otherwise = x : go xs
where
(spaces, x') = span isSpace x
fixRoutes :: String -> String -> String -> String -> String
fixRoutes name pattern methods fileContents =
fileContents ++ l
where
l = concat
[ startingCharacter
, pattern
, " "
, name
, "R "
, methods
, "\n"
]
startingCharacter = if "\n" `isSuffixOf` fileContents then "" else "\n"
mkSpec :: String -> String -> String -> String
mkSpec name _ methods = unlines
$ ("module Handler." ++ name ++ "Spec (spec) where")
: ""
: "import TestImport"
: ""
: "spec :: Spec"
: "spec = withApp $ do"
: concatMap go (words methods)
where
go method =
[ ""
, " describe \"" ++ func ++ "\" $ do"
, " error \"Spec not implemented: " ++ func ++ "\""
, ""]
where
func = concat [map toLower method, name, "R"]
mkHandler :: String -> String -> String -> String
mkHandler name pattern methods = unlines
$ ("module Handler." ++ name ++ " where")
: ""
: "import Import"
: concatMap go (words methods)
where
go method =
[ ""
, concat $ func : " :: " : map toArrow types ++ ["Handler Html"]
, concat
[ func
, " "
, concatMap toArgument types
, "= error \"Not yet implemented: "
, func
, "\""
]
]
where
func = concat [map toLower method, name, "R"]
types = getTypes pattern
toArrow t = concat [t, " -> "]
toArgument t = concat [uncapitalize t, " "]
getTypes "" = []
getTypes ('/':rest) = getTypes rest
getTypes (c:rest) | c `elem` "#*" =
typ : getTypes rest'
where
(typ, rest') = break (== '/') rest
getTypes rest = getTypes $ dropWhile (/= '/') rest
uncapitalize :: String -> String
uncapitalize (x:xs) = toLower x : xs
uncapitalize "" = ""
getSrcDir :: FilePath -> IO FilePath
getSrcDir cabal = do
#if MIN_VERSION_Cabal(2, 0, 0)
pd <- flattenPackageDescription <$> readGenericPackageDescription normal cabal
#else
pd <- flattenPackageDescription <$> readPackageDescription normal cabal
#endif
let buildInfo = allBuildInfo pd
srcDirs = concatMap hsSourceDirs buildInfo
#if MIN_VERSION_Cabal(3, 6, 0)
return $ maybe "." getSymbolicPath $ listToMaybe srcDirs
#else
return $ fromMaybe "." $ listToMaybe srcDirs
#endif

279
yesod-bin/ChangeLog.md Normal file
View File

@ -0,0 +1,279 @@
# ChangeLog for yesod-bin
## 1.6.2.2
* Support Cabal 3.8 [#1769](https://github.com/yesodweb/yesod/pull/1769)
## 1.6.2.1
* Support Cabal 3.6 [#1754](https://github.com/yesodweb/yesod/pull/1754)
## 1.6.2
* aeson 2.0
## 1.6.1
Added command line options `cert` and `key` to allow TLS certificate and key files to be passed to `yesod devel` [#1717](https://github.com/yesodweb/yesod/pull/1717)
## 1.6.0.6
Fix the `add-handler` subcommand to support both the old default routes filename (`routes`) and the new one (`routes.yesodroutes`) [#1688](https://github.com/yesodweb/yesod/pull/1688)
## 1.6.0.5
* Use process groups to ensure GHC is killed on Ctrl-C [#1683](https://github.com/yesodweb/yesod/pull/1683)
## 1.6.0.4
* Support Cabal 3.0
## 1.6.0.3
* Support Cabal 2.2 [#1151](https://github.com/yesodweb/yesod/issues/1511)
## 1.6.0.2
* Fix broken support for older http-reverse-proxy
## 1.6.0.1
* Support for http-reverse-proxy 0.6
## 1.6.0
* Upgrade to conduit 1.3.0
* Remove configure, build, touch, and test commands
## 1.5.3
* Support typed-process-0.2.0.0
## 1.5.2.6
* Drop an upper bound
## 1.5.2.5
* Support for `add-handler` when modules are in `src/` directory [#1413](https://github.com/yesodweb/yesod/issues/1413)
## 1.5.2.4
* Cabal 2.0 support
## 1.5.2.3
* Fix race condition which leads dev server to stay in compilation mode. [#1380](https://github.com/yesodweb/yesod/issues/1380)
## 1.5.2.2
* I guess `--no-nix-pure` implies Nix... sigh [#1359](https://github.com/yesodweb/yesod/issues/1359)
## 1.5.2.1
* Use `--no-nix-pure` [#1357](https://github.com/yesodweb/yesod/issues/1357)
## 1.5.2
* Fix warnings
## 1.5.1
* Add `--host` option to `yesod devel`
## 1.5.0.1
* Fix build failure
## 1.5.0
Rewrite of `yesod devel` to take advantage of Stack for a simpler codebase.
Advantages:
* Does not link against the ghc library, so can be used with multiple
GHC versions
* Leverages Stack's ability to check for dependent files, which is
more robust than what yesod devel was doing previously
* Seems to involve less rebuilding of the library on initial run
Disadvantages:
* Lost some functionality (e.g., failure hooks, controlling the exit
command)
* Newer codebase, quite likely has bugs that need to be ironed out.
## 1.4.18.7
* Actually release the changes for #1284
## 1.4.18.6
* Fix support for GHC 8.0.1 [#1284](https://github.com/yesodweb/yesod/issues/1284)
## 1.4.18.5
* yesod-bin: Make it build with latest optparse-applicative [#1282](https://github.com/yesodweb/yesod/pull/1282)
## 1.4.18.4
* Link yesod-bin with wxneeded on OpenBSD. [#1281](https://github.com/yesodweb/yesod/pull/1281)
## 1.4.18.3
* Adding a new handler adds it under wrong stanza [#1273](https://github.com/yesodweb/yesod/issues/1273)
## 1.4.18.2
* Work around change in behavior in newer optparse-applicative ([mailing list discussion](https://groups.google.com/d/msg/yesodweb/BrTkMKFREgU/AKVc9AK2AQAJ))
## 1.4.18.1
* error handling when checking for stack binary [#1219](https://github.com/yesodweb/yesod/pull/1219)
* GHC 8 support
## 1.4.18
* Disable `yesod test` when using Stack [#1198](https://github.com/yesodweb/yesod/issues/1198)
## 1.4.17
* Fully remove the `yesod init` command
## 1.4.16.1
* Workaround for [wai#478](https://github.com/yesodweb/wai/issues/478)
## 1.4.16
* Some updates for better reverse proxying [yesod-scaffold#114](https://github.com/yesodweb/yesod-scaffold/issues/114)
## 1.4.15
* Deprecate yesod init
## 1.4.14
* Fix order of -package-db arguments to runghc [#1057](https://github.com/yesodweb/yesod/issues/1057)
## 1.4.13
* Enable stack with yesod keter [#1041](https://github.com/yesodweb/yesod/pull/1041)
## 1.4.12
* Devel server: have to type quit to quit
## 1.4.11
* Add support to `yesod devel` to detect and use `GHC_PACKAGE_PATH`. This makes
`yesod devel` compatible with `stack`, just run: `stack exec -- yesod devel`.
## 1.4.10
* Scaffolding update
## 1.4.9.2
* Collapse paths in keter bundles, see [mailing list thread](https://groups.google.com/d/msg/yesodweb/Ndd310qfSEc/pZOXldsKowsJ)
## 1.4.9
* Command line options for `yesod init` [#986](https://github.com/yesodweb/yesod/pull/986)
## 1.4.8
* Drop system-filepath
## 1.4.7.2
* Scaffolding updates, including fix for [#982](https://github.com/yesodweb/yesod/issues/982)
## 1.4.7
* GHC 7.10 support
## 1.4.6
* Add TLS support to `yesod devel` [#964](https://github.com/yesodweb/yesod/pull/964)
## 1.4.5
* add a switch to yesod to skip deploying a .keter with copy-to [#952](https://github.com/yesodweb/yesod/issues/952)
## 1.4.4
* Add and process Keter option 'extraFiles' [#947](https://github.com/yesodweb/yesod/pull/947)
## 1.4.3.11
* Disregard proxy environment variables in yesod devel [#945](https://github.com/yesodweb/yesod/pull/945)
## 1.4.3.10
* Allow blaze-builder 0.4
## 1.4.3.9
* Scaffold update: minimal scaffold uses yesod-core instead of yesod [yesodweb/yesod-scaffold#65](https://github.com/yesodweb/yesod-scaffold/issues/65)
## 1.4.3.8
* Scaffold update: fix 404 for missing sourcemap
## 1.4.3.6
* Scaffold update: use `addToken` instead of `addNonce`
## 1.4.3.5
* Fix add-handler putting two routes on one line [#922](https://github.com/yesodweb/yesod/pull/922)
## 1.4.3.4
Scaffolding updates:
* Improve `DevelMain` support
* Wipe out database during test runs
* Convenience `unsafeHandler` function
* Remove deprecated Chrome Frame code
## 1.4.3.3
More consistent whitespace in hamlet files in scaffolding [#50](https://github.com/yesodweb/yesod-scaffold/issues/50)
## 1.4.3.2
add-handler adds arguments too [#898](https://github.com/yesodweb/yesod/issues/898)
## 1.4.3
Add the minimal scaffolding
## 1.4.2
Scaffolding updates:
* Import.NoFoundation
* Explanation of static files in Settings.StaticFiles
* Explanation of environment variables in settings.yml
## 1.4.1.2
No args passed in keter.yml
## 1.4.1
Significant update to the scaffolding.
## 1.4.0.9
Allow devel.hs to be located in app/ or src/ subdirectories.
## 1.4.0.8
Updated postgres-fay scaffolding for yesod-fay 0.7.0
## 1.4.0.7
Fix a bug in `yesod devel` when cabal config has `tests: True` #864

533
yesod-bin/Devel.hs Normal file
View File

@ -0,0 +1,533 @@
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
module Devel
( devel
, develSignal
, DevelOpts(..)
) where
import Control.Applicative ((<|>))
import UnliftIO (race_)
import Control.Concurrent (threadDelay)
import Control.Concurrent.STM
import qualified UnliftIO.Exception as Ex
import Control.Monad (forever, unless, void,
when)
import Data.ByteString (ByteString, isInfixOf)
import qualified Data.ByteString.Lazy as LB
import Conduit
import Data.FileEmbed (embedFile)
import qualified Data.Map as Map
import Data.Maybe (isJust)
import qualified Data.Set as Set
import Data.Streaming.Network (bindPortTCP,
bindRandomPortTCP)
import Data.String (fromString)
import Data.Time (getCurrentTime)
import qualified Distribution.Package as D
import qualified Distribution.PackageDescription as D
#if MIN_VERSION_Cabal(3,8,0)
import qualified Distribution.Simple.PackageDescription as D
#endif
#if MIN_VERSION_Cabal(2, 2, 0)
import qualified Distribution.PackageDescription.Parsec as D
#else
import qualified Distribution.PackageDescription.Parse as D
#endif
import qualified Distribution.Simple.Utils as D
import qualified Distribution.Verbosity as D
import Network.HTTP.Client (newManager)
import Network.HTTP.Client (managerSetProxy,
noProxy)
import Network.HTTP.Client.TLS (tlsManagerSettings)
import Network.HTTP.ReverseProxy (ProxyDest (ProxyDest),
waiProxyToSettings,
wpsOnExc, wpsTimeout,
#if MIN_VERSION_http_reverse_proxy(0, 6, 0)
defaultWaiProxySettings
#else
def
#endif
)
import qualified Network.HTTP.ReverseProxy as ReverseProxy
import Network.HTTP.Types (status200, status503)
import qualified Network.Socket
import Network.Wai (requestHeaderHost,
requestHeaders,
responseLBS)
import Network.Wai.Handler.Warp (defaultSettings, runSettings,
setPort, setHost)
import Network.Wai.Handler.WarpTLS (runTLS, tlsSettings,
tlsSettingsMemory)
import Network.Wai.Parse (parseHttpAccept)
import Say
import System.Directory
import System.Environment (getEnvironment,
getExecutablePath)
import System.FilePath (takeDirectory,
takeFileName, (</>))
import System.FSNotify
import System.IO (stdout, stderr)
import System.IO.Error (isDoesNotExistError)
import Data.Conduit.Process.Typed
-- We have two special files:
--
-- * The terminate file tells the child process to die simply by being
-- present. Ideally we'd handle this via killing the process
-- directly, but that's historically never worked reliably.
--
-- * The signal file, which tells us that "stack build" has succeeded
-- yet again.
data SpecialFile = TermFile | SignalFile
specialFilePath :: SpecialFile -> FilePath
-- used by scaffolded app, cannot change
specialFilePath TermFile = "yesod-devel/devel-terminate"
-- only used internally, can change
specialFilePath SignalFile = "yesod-devel/rebuild"
-- | Write a special file
writeSpecialFile :: SpecialFile -> IO ()
writeSpecialFile sp = do
let fp = specialFilePath sp
createDirectoryIfMissing True $ takeDirectory fp
now <- getCurrentTime
writeFile fp $ show now
-- | Remove a special file
removeSpecialFile :: SpecialFile -> IO ()
removeSpecialFile sp = removeFile (specialFilePath sp) `Ex.catch` \e ->
if isDoesNotExistError e
then return ()
else Ex.throwIO e
-- | Get an absolute path to the special file
canonicalizeSpecialFile :: SpecialFile -> IO FilePath
canonicalizeSpecialFile sp = do
let fp = specialFilePath sp
dir = takeDirectory fp
file = takeFileName fp
createDirectoryIfMissing True dir
dir' <- canonicalizePath dir
return $ dir' </> file
-- | Used as a callback from "stack build --exec" to write the signal file
develSignal :: IO ()
develSignal = writeSpecialFile SignalFile
-- | Options to be provided on the command line
data DevelOpts = DevelOpts
{ verbose :: Bool
, successHook :: Maybe String
, develPort :: Int
, develTlsPort :: Int
, proxyTimeout :: Int
, useReverseProxy :: Bool
, develHost :: Maybe String
, cert :: Maybe (FilePath, FilePath)
} deriving (Show, Eq)
-- | Run a reverse proxy from the develPort and develTlsPort ports to
-- the app running in appPortVar. If there is no response on the
-- application port, give an appropriate message to the user.
reverseProxy :: DevelOpts -> TVar Int -> IO ()
reverseProxy opts appPortVar = do
manager <- newManager $ managerSetProxy noProxy tlsManagerSettings
let refreshHtml = LB.fromChunks [$(embedFile "refreshing.html")]
sayV = when (verbose opts) . sayString
let onExc _ req
| maybe False (("application/json" `elem`) . parseHttpAccept)
(lookup "accept" $ requestHeaders req) =
return $ responseLBS status503
[ ("Retry-After", "1")
]
"{\"message\":\"Recompiling\"}"
| otherwise = return $ responseLBS status200
[ ("content-type", "text/html")
, ("Refresh", "1")
]
refreshHtml
let proxyApp = waiProxyToSettings
(const $ do
appPort <- atomically $ readTVar appPortVar
sayV $ "revProxy: appPort " ++ (show appPort)
return $
ReverseProxy.WPRProxyDest
$ ProxyDest "127.0.0.1" appPort)
#if MIN_VERSION_http_reverse_proxy(0, 6, 0)
defaultWaiProxySettings
#else
def
#endif
{ wpsOnExc = \e req f -> onExc e req >>= f
, wpsTimeout =
if proxyTimeout opts == 0
then Nothing
else Just (1000000 * proxyTimeout opts)
}
manager
defaultSettings' = maybe id (setHost . fromString) (develHost opts) defaultSettings
runProxyTls port app = do
let certDef = $(embedFile "certificate.pem")
keyDef = $(embedFile "key.pem")
theSettings = case cert opts of
Nothing -> tlsSettingsMemory certDef keyDef
Just (c,k) -> tlsSettings c k
runTLS theSettings (setPort port defaultSettings') $ \req send -> do
let req' = req
{ requestHeaders
= ("X-Forwarded-Proto", "https")
-- Workaround for
-- https://github.com/yesodweb/wai/issues/478, where
-- the Host headers aren't set. Without this, generated
-- URLs from guestApproot are incorrect, see:
-- https://github.com/yesodweb/yesod-scaffold/issues/114
: (case lookup "host" (requestHeaders req) of
Nothing ->
case requestHeaderHost req of
Just host -> (("Host", host):)
Nothing -> id
Just _ -> id)
(requestHeaders req)
}
app req' send
httpProxy = runSettings (setPort (develPort opts) defaultSettings') proxyApp
httpsProxy = runProxyTls (develTlsPort opts) proxyApp
say "Application can be accessed at:\n"
sayString $ "http://localhost:" ++ show (develPort opts)
sayString $ "https://localhost:" ++ show (develTlsPort opts)
say $ "If you wish to test https capabilities, you should set the following variable:"
sayString $ " export APPROOT=https://localhost:" ++ show (develTlsPort opts)
say ""
race_ httpProxy httpsProxy
-- | Check if the given port is available.
checkPort :: Int -> IO Bool
checkPort p = do
es <- Ex.tryIO $ bindPortTCP p "*4"
case es of
Left _ -> return False
Right s -> do
Network.Socket.close s
return True
-- | Get a random, unused port.
getNewPort :: DevelOpts -> IO Int
getNewPort opts = do
(port, socket) <- bindRandomPortTCP "*"
when (verbose opts) $ sayString $ "Got new port: " ++ show port
Network.Socket.close socket
return port
-- | Utility function
unlessM :: Monad m => m Bool -> m () -> m ()
unlessM c a = c >>= \res -> unless res a
-- | Find the file containing the devel code to be run.
checkDevelFile :: IO FilePath
checkDevelFile =
loop paths
where
paths = ["app/devel.hs", "devel.hs", "src/devel.hs"]
loop [] = error $ "file devel.hs not found, checked: " ++ show paths
loop (x:xs) = do
e <- doesFileExist x
if e
then return x
else loop xs
stackSuccessString :: ByteString
stackSuccessString = "ExitSuccess"
stackFailureString :: ByteString
stackFailureString = "ExitFailure"
-- We need updateAppPort logic to prevent a race condition.
-- See https://github.com/yesodweb/yesod/issues/1380
updateAppPort :: ByteString -> TVar Bool -- ^ Bool to indicate if the
-- output from stack has
-- started. False indicate
-- that it hasn't started
-- yet.
-> TVar Int -> STM ()
updateAppPort bs buildStarted appPortVar = do
hasStarted <- readTVar buildStarted
let buildEnd = isInfixOf stackFailureString bs || isInfixOf stackSuccessString bs
case (hasStarted, buildEnd) of
(False, False) -> do
writeTVar appPortVar (-1 :: Int)
writeTVar buildStarted True
(True, False) -> return ()
(_, True) -> writeTVar buildStarted False
-- | Get the set of all flags available in the given cabal file
getAvailableFlags :: D.GenericPackageDescription -> Set.Set String
getAvailableFlags =
Set.fromList . map (unFlagName . D.flagName) . D.genPackageFlags
where
#if MIN_VERSION_Cabal(2, 0, 0)
unFlagName = D.unFlagName
#else
unFlagName (D.FlagName fn) = fn
#endif
-- | This is the main entry point. Run the devel server.
devel :: DevelOpts -- ^ command line options
-> [String] -- ^ extra options to pass to Stack
-> IO ()
devel opts passThroughArgs = do
-- Check that the listening ports are available
unlessM (checkPort $ develPort opts) $ error "devel port unavailable"
unlessM (checkPort $ develTlsPort opts) $ error "devel TLS port unavailable"
-- Friendly message to the user
say "Yesod devel server. Enter 'quit' or hit Ctrl-C to quit."
-- Find out the name of our package, needed for the upcoming Stack
-- commands
#if MIN_VERSION_Cabal(3, 0, 0)
cabal <- D.tryFindPackageDesc D.silent "."
#elif MIN_VERSION_Cabal(1, 20, 0)
cabal <- D.tryFindPackageDesc "."
#else
cabal <- D.findPackageDesc "."
#endif
#if MIN_VERSION_Cabal(2, 0, 0)
gpd <- D.readGenericPackageDescription D.normal cabal
#else
gpd <- D.readPackageDescription D.normal cabal
#endif
let pd = D.packageDescription gpd
D.PackageIdentifier packageNameWrapped _version = D.package pd
#if MIN_VERSION_Cabal(2, 0, 0)
packageName = D.unPackageName packageNameWrapped
#else
D.PackageName packageName = packageNameWrapped
#endif
-- Which file contains the code to run
develHsPath <- checkDevelFile
-- The port that we're currently listening on, and that the
-- reverse proxy should point to
appPortVar <- newTVarIO (-1)
-- If we're actually using reverse proxying, spawn off a reverse
-- proxy thread
let withRevProxy =
if useReverseProxy opts
then race_ (reverseProxy opts appPortVar)
else id
-- Run the following concurrently. If any of them exit, take the
-- whole thing down.
--
-- We need to put withChangedVar outside of all this, since we
-- need to ensure we start watching files before the stack build
-- loop starts.
withChangedVar $ \changedVar -> withRevProxy $ race_
-- Start the build loop
(runStackBuild appPortVar packageName (getAvailableFlags gpd))
-- Run the app itself, restarting when a build succeeds
(runApp appPortVar changedVar develHsPath)
where
-- say, but only when verbose is on
sayV = when (verbose opts) . sayString
-- Leverage "stack build --file-watch" to do the build
runStackBuild :: TVar Int -> [Char] -> Set.Set [Char] -> IO ()
runStackBuild appPortVar packageName availableFlags = do
-- We call into this app for the devel-signal command
myPath <- getExecutablePath
let procConfig = setStdout createSource
$ setStderr createSource
$ setCreateGroup True -- because need when yesod-bin killed and kill child ghc
$ proc "stack" $
[ "build"
, "--fast"
, "--file-watch"
-- Indicate the component we want
, packageName ++ ":lib"
-- signal the watcher that a build has succeeded
, "--exec", myPath ++ " devel-signal"
] ++
-- Turn on relevant flags
concatMap
(\flagName -> [ "--flag", packageName ++ ":" ++ flagName])
(Set.toList $ Set.intersection
availableFlags
(Set.fromList ["dev", "library-only"])) ++
-- Add the success hook
(case successHook opts of
Nothing -> []
Just h -> ["--exec", h]) ++
-- Any extra args passed on the command line
passThroughArgs
sayV $ show procConfig
buildStarted <- newTVarIO False
-- Monitor the stdout and stderr content from the build process. Any
-- time some output comes, we invalidate the currently running app by
-- changing the destination port for reverse proxying to -1. We also
-- make sure that all content to stdout or stderr from the build
-- process is piped to the actual stdout and stderr handles.
withProcess_ procConfig $ \p -> do
let helper getter h =
runConduit
$ getter p
.| iterMC (\(str :: ByteString) -> atomically (updateAppPort str buildStarted appPortVar))
.| sinkHandle h
race_ (helper getStdout stdout) (helper getStderr stderr)
-- Run the inner action with a TVar which will be set to True
-- whenever the signal file is modified.
withChangedVar :: (TVar Bool -> IO a) -> IO a
withChangedVar inner = withManager $ \manager -> do
-- Variable indicating that the signal file has been changed. We
-- reset it each time we handle the signal.
changedVar <- newTVarIO False
-- Get the absolute path of the signal file, needed for the
-- file watching
develSignalFile' <- canonicalizeSpecialFile SignalFile
-- Start watching the signal file, and set changedVar to
-- True each time it's changed.
void $ watchDir manager
-- Using fromString to work with older versions of fsnotify
-- that use system-filepath
(fromString (takeDirectory develSignalFile'))
(\e -> eventPath e == fromString develSignalFile')
(const $ atomically $ writeTVar changedVar True)
-- Run the inner action
inner changedVar
-- Each time the library builds successfully, run the application
runApp :: TVar Int -> TVar Bool -> String -> IO b
runApp appPortVar changedVar develHsPath = do
-- Wait for the first change, indicating that the library
-- has been built
atomically $ do
changed <- readTVar changedVar
check changed
writeTVar changedVar False
sayV "First successful build complete, running app"
-- We're going to set the PORT and DISPLAY_PORT variables for
-- the child below. Also need to know if the env program
-- exists.
env <- fmap Map.fromList getEnvironment
hasEnv <- fmap isJust $ findExecutable "env"
-- Keep looping forever, print any synchronous exceptions,
-- and eventually die from an async exception from one of
-- the other threads (via race_ above).
forever $ Ex.handleAny (\e -> sayErrString $ "Exception in runApp: " ++ show e) $ do
-- Get the port the child should listen on, and tell
-- the reverse proxy about it
newPort <-
if useReverseProxy opts
then getNewPort opts
-- no reverse proxy, so use the develPort directly
else return (develPort opts)
atomically $ writeTVar appPortVar newPort
-- Modified environment
let env' = Map.toList
$ Map.insert "PORT" (show newPort)
$ Map.insert "DISPLAY_PORT" (show $ develPort opts)
env
-- Remove the terminate file so we don't immediately exit
removeSpecialFile TermFile
-- Launch the main function in the Main module defined
-- in the file develHsPath. We use ghc instead of
-- runghc to avoid the extra (confusing) resident
-- runghc process. Starting with GHC 8.0.2, that will
-- not be necessary.
{- Hmm, unknown errors trying to get this to work. Just doing the
- runghc thing instead.
let procDef = setStdin closed $ setEnv env' $ proc "stack"
[ "ghc"
, "--"
, develHsPath
, "-e"
, "Main.main"
]
-}
-- Nix support in Stack doesn't pass along env vars by
-- default, so we use the env command. But if the command
-- isn't available, just set the env var. I'm sure this
-- will break _some_ combination of systems, but we'll
-- deal with that later. Previous issues:
--
-- https://github.com/yesodweb/yesod/issues/1357
-- https://github.com/yesodweb/yesod/issues/1359
let procDef
| hasEnv = setStdin closed $ proc "stack"
[ "exec"
, "--"
, "env"
, "PORT=" ++ show newPort
, "DISPLAY_PORT=" ++ show (develPort opts)
, "runghc"
, develHsPath
]
| otherwise = setStdin closed $ setEnv env' $ proc "stack"
[ "runghc"
, "--"
, develHsPath
]
sayV $ "Running child process: " ++ show procDef
-- Start running the child process with GHC
withProcess procDef $ \p -> do
-- Wait for either the process to exit, or for a new build to come through
eres <- atomically (fmap Left (waitExitCodeSTM p) <|> fmap Right
(do changed <- readTVar changedVar
check changed
writeTVar changedVar False))
-- on an async exception, make sure the child dies
`Ex.onException` writeSpecialFile TermFile
case eres of
-- Child exited, which indicates some
-- error. Let the user know, sleep for a bit
-- to avoid busy-looping, and then we'll try
-- again.
Left ec -> do
sayErrString $ "Unexpected: child process exited with " ++ show ec
threadDelay 1000000
sayErrString "Trying again"
-- New build succeeded
Right () -> do
-- Kill the child process, both with the
-- TermFile, and by signaling the process
-- directly.
writeSpecialFile TermFile
stopProcess p
-- Wait until the child properly exits, then we'll try again
ec <- waitExitCode p
sayV $ "Expected: child process exited with " ++ show ec

18
yesod-bin/HsFile.hs Normal file
View File

@ -0,0 +1,18 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}
module HsFile (mkHsFile) where
import Text.ProjectTemplate (createTemplate)
import Conduit
import qualified Data.ByteString as BS
import Control.Monad.IO.Class (liftIO)
import Data.String (fromString)
mkHsFile :: IO ()
mkHsFile = runConduitRes
$ sourceDirectory "."
.| readIt
.| createTemplate
.| mapM_C (liftIO . BS.putStr)
where
-- Reads a filepath from upstream and dumps a pair of (filepath, filecontents)
readIt = mapC $ \i -> (fromString i, liftIO $ BS.readFile i)

140
yesod-bin/Keter.hs Normal file
View File

@ -0,0 +1,140 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE CPP #-}
module Keter
( keter
) where
import Data.Yaml
#if MIN_VERSION_aeson(2, 0, 0)
import qualified Data.Aeson.KeyMap as Map
#else
import qualified Data.HashMap.Strict as Map
#endif
import qualified Data.Text as T
import System.Environment (getEnvironment)
import System.Exit
import System.Process
import Control.Monad
import System.Directory hiding (findFiles)
import Data.Maybe (mapMaybe,isJust,maybeToList)
import Data.Monoid
import System.FilePath ((</>))
import qualified Codec.Archive.Tar as Tar
import Control.Exception
import qualified Data.ByteString.Lazy as L
import Codec.Compression.GZip (compress)
import qualified Data.Foldable as Fold
import Control.Monad.Trans.Writer (tell, execWriter)
run :: String -> [String] -> IO ()
run a b = do
ec <- rawSystem a b
unless (ec == ExitSuccess) $ exitWith ec
keter :: String -- ^ cabal command
-> Bool -- ^ no build?
-> Bool -- ^ no copy to?
-> [String] -- ^ build args
-> IO ()
keter cabal noBuild noCopyTo buildArgs = do
ketercfg <- keterConfig
mvalue <- decodeFile ketercfg
value <-
case mvalue of
Nothing -> error "No config/keter.yaml found"
Just (Object value) ->
case Map.lookup "host" value of
Just (String s) | "<<" `T.isPrefixOf` s ->
error $ "Please set your hostname in " ++ ketercfg
_ ->
case Map.lookup "user-edited" value of
Just (Bool False) ->
error $ "Please edit your Keter config file at "
++ ketercfg
_ -> return value
Just _ -> error $ ketercfg ++ " is not an object"
env' <- getEnvironment
cwd' <- getCurrentDirectory
files <- getDirectoryContents "."
project <-
case mapMaybe (T.stripSuffix ".cabal" . T.pack) files of
[x] -> return x
[] -> error "No cabal file found"
_ -> error "Too many cabal files found"
let findFiles (Object v) =
mapM_ go $ Map.toList v
where
go ("exec", String s) = tellFile s
go ("extraFiles", Array a) = Fold.mapM_ tellExtra a
go (_, v') = findFiles v'
tellFile s = tell [collapse $ "config" </> T.unpack s]
tellExtra (String s) = tellFile s
tellExtra _ = error "extraFiles should be a flat array"
findFiles (Array v) = Fold.mapM_ findFiles v
findFiles _ = return ()
bundleFiles = execWriter $ findFiles $ Object value
collapse = T.unpack . T.intercalate "/" . collapse' . T.splitOn "/" . T.pack
collapse' (_:"..":rest) = collapse' rest
collapse' (".":xs) = collapse' xs
collapse' (x:xs) = x : collapse' xs
collapse' [] = []
unless noBuild $ do
stackQueryRunSuccess <- do
eres <- try $ readProcessWithExitCode "stack" ["query"] "" :: IO (Either IOException (ExitCode, String, String))
return $ either (\_ -> False) (\(ec, _, _) -> (ec == ExitSuccess)) eres
let inStackExec = isJust $ lookup "STACK_EXE" env'
mStackYaml = lookup "STACK_YAML" env'
useStack = inStackExec || isJust mStackYaml || stackQueryRunSuccess
if useStack
then do let stackYaml = maybeToList $ fmap ("--stack-yaml="<>) mStackYaml
localBinPath = cwd' </> "dist/bin"
run "stack" $ stackYaml <> ["clean"]
createDirectoryIfMissing True localBinPath
run "stack"
(stackYaml
<> ["--local-bin-path",localBinPath,"build","--copy-bins"]
<> buildArgs)
else do run cabal ["clean"]
run cabal ["configure"]
run cabal ("build" : buildArgs)
_ <- try' $ removeDirectoryRecursive "static/tmp"
archive <- Tar.pack "" $
"config" : "static" : bundleFiles
let fp = T.unpack project ++ ".keter"
L.writeFile fp $ compress $ Tar.write archive
unless noCopyTo $ case Map.lookup "copy-to" value of
Just (String s) ->
let baseArgs = [fp, T.unpack s] :: [String]
scpArgs =
case parseMaybe (.: "copy-to-args") value of
Just as -> as ++ baseArgs
Nothing -> baseArgs
args =
case parseMaybe (.: "copy-to-port") value of
Just i -> "-P" : show (i :: Int) : scpArgs
Nothing -> scpArgs
in run "scp" args
_ -> return ()
where
-- Test for alternative config file extension (yaml or yml).
keterConfig = do
let yml = "config/keter.yml"
ymlExists <- doesFileExist yml
return $ if ymlExists then yml else "config/keter.yaml"
try' :: IO a -> IO (Either SomeException a)
try' = try

20
yesod-bin/LICENSE Normal file
View File

@ -0,0 +1,20 @@
Copyright (c) 2012 Michael Snoyman, http://www.yesodweb.com/
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:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
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.

106
yesod-bin/Options.hs Normal file
View File

@ -0,0 +1,106 @@
{-# LANGUAGE PatternGuards #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE CPP #-}
module Options (injectDefaults) where
import Control.Applicative
import qualified Control.Exception as E
import Control.Monad
import Control.Monad.Trans.Except
import Control.Monad.Trans.Reader
import Data.Char (isAlphaNum, isSpace, toLower)
import Data.List (foldl')
import Data.List.Split (splitOn)
import qualified Data.Map as M
import Data.Maybe (mapMaybe)
import Data.Monoid
import Options.Applicative
import Options.Applicative.Types
import System.Directory
import System.Environment
import System.FilePath ((</>))
-- | inject defaults from either files or environments
-- in order of priority:
-- 1. command line arguments: --long-option=value
-- 2. environment variables: PREFIX_COMMAND_LONGOPTION=value
-- 3. $HOME/.prefix/config: prefix.command.longoption=value
--
-- note: this automatically injects values for standard options and flags
-- (also inside subcommands), but not for more complex parsers that use BindP
-- (like `many'). As a workaround a single special case is supported,
-- for `many' arguments that generate a list of strings.
injectDefaults :: String -- ^ prefix, program name
-> [(String, a -> [String] -> a)] -- ^ append extra options for arguments that are lists of strings
-> ParserInfo a -- ^ original parsers
-> IO (ParserInfo a)
injectDefaults prefix lenses parser = do
e <- getEnvironment
config <- (readFile . (</> "config") =<< getAppUserDataDirectory prefix)
`E.catch` \(_::E.SomeException) -> return ""
let env = M.fromList . filter ((==[prefix]) . take 1 . fst) $
configLines config <> -- config first
map (\(k,v) -> (splitOn "_" $ map toLower k, v)) e -- env vars override config
p' = parser { infoParser = injectDefaultP env [prefix] (infoParser parser) }
return $ foldl' (\p (key,l) -> fmap (updateA env key l) p) p' lenses
updateA :: M.Map [String] String -> String -> (a -> [String] -> a) -> a -> a
updateA env key upd a =
case M.lookup (splitOn "." key) env of
Nothing -> a
Just v -> upd a (splitOn ":" v)
-- | really simple key/value file reader: x.y = z -> (["x","y"],"z")
configLines :: String -> [([String], String)]
configLines = mapMaybe (mkLine . takeWhile (/='#')) . lines
where
trim = let f = reverse . dropWhile isSpace in f . f
mkLine l | (k, '=':v) <- break (=='=') l = Just (splitOn "." (trim k), trim v)
| otherwise = Nothing
-- | inject the environment into the parser
-- the map contains the paths with the value that's passed into the reader if the
-- command line parser gives no result
injectDefaultP :: M.Map [String] String -> [String] -> Parser a -> Parser a
injectDefaultP _env _path n@(NilP{}) = n
injectDefaultP env path p@(OptP o)
#if MIN_VERSION_optparse_applicative(0,13,0)
| (Option (CmdReader _ cmds f) props) <- o =
#else
| (Option (CmdReader cmds f) props) <- o =
#endif
let cmdMap = M.fromList (map (\c -> (c, mkCmd c)) cmds)
mkCmd cmd =
let (Just parseri) = f cmd
in parseri { infoParser = injectDefaultP env (path ++ [normalizeName cmd]) (infoParser parseri) }
#if MIN_VERSION_optparse_applicative(0,13,0)
in OptP (Option (CmdReader Nothing cmds (`M.lookup` cmdMap)) props)
#else
in OptP (Option (CmdReader cmds (`M.lookup` cmdMap)) props)
#endif
| (Option (OptReader names (CReader _ rdr) _) _) <- o =
p <|> either (const empty)
pure
(runExcept . msum $
map (maybe (throwE $ ErrorMsg "Missing environment variable")
(runReaderT (unReadM rdr))
. getEnvValue env path)
names)
| (Option (FlagReader names a) _) <- o =
p <|> if any ((==Just "1") . getEnvValue env path) names then pure a else empty
| otherwise = p
injectDefaultP env path (MultP p1 p2) =
MultP (injectDefaultP env path p1) (injectDefaultP env path p2)
injectDefaultP env path (AltP p1 p2) =
AltP (injectDefaultP env path p1) (injectDefaultP env path p2)
injectDefaultP _env _path b@(BindP {}) = b
getEnvValue :: M.Map [String] String -> [String] -> OptName -> Maybe String
getEnvValue env path (OptLong l) = M.lookup (path ++ [normalizeName l]) env
getEnvValue _ _ _ = Nothing
normalizeName :: String -> String
normalizeName = map toLower . filter isAlphaNum

111
yesod-bin/README.md Normal file
View File

@ -0,0 +1,111 @@
## yesod-bin: the Yesod executable
This executable is almost exclusively used for its `yesod devel`
capabilities, providing a development server for web apps. It also
provides some legacy functionality, almost all of which has been
superceded by functionality in the
[Haskell Stack build tool](http://haskellstack.org/). This README will
speak exclusively about `yesod devel`.
__CAVEAT__ There may be some issues using `yesod devel` in Docker-enabled
projects. See [comment on
Github](https://github.com/yesodweb/yesod/pull/1305#issuecomment-263204471).
### Development server
The development server will automatically recompile your application
whenever you make source code changes. It will then launch your app,
and reverse-proxy to it. The reverse proxying ensures that you can
connect to your application on a dedicated port, always get the latest
version available, and won't get dropped connections when the app
isn't yet ready. Instead, you'll get some very motivating messages:
![Motivation](https://i.sli.mg/nO6DvN.png)
## Common workflows
The standard Yesod scaffoldings are configured to work with `yesod
devel` out of the box (though see below for non-Yesod
development). For the most part, from within your application
directory, you'll just want to run:
* `stack build yesod-bin`
* `stack exec -- yesod devel`
This will install the corresponding version of the `yesod` executable
into your currently selected snapshot, and then use that
executable. (Starting with version 1.5.0, you can be more lax and use
a `yesod` executable compiled for a different snapshot. Once 1.5.0 is
more widespread we'll probably update these instructions.)
Some other common questions:
* If you want to control which port you can access your application
on, use the `--port` command line option, e.g. `stack exec -- yesod
devel --port 4000`. Changing your port inside your source code _will
not work_, because you need to change the reverse proxying port.
* If you want to run a command after each successful build, you can
use `stack exec -- yesod devel --success-hook "echo Yay!"`
* If for some reason you want to disable the reverse proxy
capabilities, use `stack exec -- yesod devel
--disable-reverse-proxy`
## How it works
The workflow of the devel server is pretty simple:
* Launch a reverse proxy server
* Use Stack file-watch capability to run a build loop on your code,
rebuilding each time a file is modified
* Have Stack call `yesod devel-signal` to write to a specific file
(`yesod-devel/rebuild`) each time a rebuild is successful
* Each time `yesod-devel/rebuild` is modified:
* Kill the current child process
* Get a new random port
* Tell the reverse proxy server about the new port to forward to
* Run the application's devel script with two environment variables
set:
* `PORT` gives the newly generated random port. The application
needs to listen on that port.
* `DISPLAY_PORT` gives the port that the reverse proxy is
listening on, used for display purposes or generating URLs.
Now some weird notes:
* The devel script can be one of the following three files. `yesod
devel` will search for them in the given order. That script must
provide a `main` function.
* `app/devel.hs`
* `devel.hs`
* `src/devel.hs`
* Unfortunately, directly killing the `ghc` interpreter has never
worked reliably, so we have an extra hack: when killing the process,
`yesod devel` also writes to a file
`yesod-devel/devel-terminate`. Your devel script should respect this
file and shutdown whenever it exists.
(It may be fixed in 1.6.0.5.)
* If your .cabal file defines them, `yesod devel` will tell Stack to
build with the flags `dev` and `library-only`. You can use this to
speed up compile times (biggest win: skip building executables, thus
the name `library-only`).
If that all seems a little complicated, remember that the Yesod
scaffolding handles all of this for you. But if you want to implement
it yourself...
## Non-Yesod development
If you'd like to use the `yesod devel` server for your non-Yesod
application, or even for a Yesod application not based on the
scaffolding, this section is for you! We've got a
[sample application in the repository](https://github.com/yesodweb/yesod/tree/master/yesod-bin/devel-example)
that demonstrates how to get this set up. It demonstrates a good way
to jump through the hoops implied above.
One important note: I highly recommend putting _all_ of the logic in
your library, and then providing a `develMain :: IO ()` function which
your `app/devel.hs` script reexports as `main`. I've found this to
greatly simplify things overall, since you can ensure all of your
dependencies are specified correctly in your `.cabal` file. Also, I
recommend using `PackageImports` in that file, as the example app
shows.

15
yesod-bin/certificate.pem Normal file
View File

@ -0,0 +1,15 @@
-----BEGIN CERTIFICATE-----
MIICWDCCAcGgAwIBAgIJAJG1ZMlcMDW6MA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV
BAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBX
aWRnaXRzIFB0eSBMdGQwHhcNMTExMDIyMTk0MjU3WhcNMTExMTIxMTk0MjU3WjBF
MQswCQYDVQQGEwJBVTETMBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UECgwYSW50
ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB
gQCfYZx7kV6ybogMyAf9MINm7Rwin5LKh+TpD1ZkbLgmqFVotQCdthgTK66SPXkx
EXGI27biNzacJhX7Ml7/4o8sp2GslYKUO46DYvgi/nnNX/bzA5cDJSSGK11eQEVs
+p0GEZ/6Juhpx/oQwMDMgo0UHkiH8QtKI8ojXnFF2MsLNwIDAQABo1AwTjAdBgNV
HQ4EFgQUaA6FbOj/0VJMb4egNyIDZ/ZNV/YwHwYDVR0jBBgwFoAUaA6FbOj/0VJM
b4egNyIDZ/ZNV/YwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQCTQyOk
D86Z+yzedXjTLI6FT8QugmQne1YQ8P0w37P76z2reagSvNee2e9B1oTHoPeKZMs0
k99oS9yJ/NOQ1Ms90P+q0yBVGxAs/gF65qKgE27YGXzNtNobj/D4OoxcFG+BsORw
VvYSBV4FiVy9RwJsr7AMqkUBcOEPCuJHgTx58w==
-----END CERTIFICATE-----

1
yesod-bin/devel-example/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
yesod-devel/

View File

@ -0,0 +1,5 @@
An example non-Yesod application that is compatible with `yesod devel`. Steps
to use it:
* `stack build yesod-bin`
* `stack exec -- yesod devel`

View File

@ -1,3 +1,2 @@
#!/usr/bin/env runhaskell
import Distribution.Simple
main = defaultMain

View File

@ -0,0 +1,6 @@
module Main where
import DevelExample
main :: IO ()
main = prodMain

View File

@ -0,0 +1,5 @@
{-# LANGUAGE PackageImports #-}
import "devel-example" DevelExample (develMain)
main :: IO ()
main = develMain

View File

@ -0,0 +1,30 @@
name: devel-example
version: 0.1.0.0
build-type: Simple
cabal-version: >=1.10
flag library-only
default: False
description: Do not build the executable
library
hs-source-dirs: src
exposed-modules: DevelExample
build-depends: base
, async
, directory
, http-types
, wai
, wai-extra
, warp
default-language: Haskell2010
executable devel-example
hs-source-dirs: app
main-is: Main.hs
ghc-options: -threaded -rtsopts -with-rtsopts=-N
build-depends: base
, devel-example
default-language: Haskell2010
if flag(library-only)
buildable: False

View File

@ -0,0 +1,47 @@
{-# LANGUAGE OverloadedStrings #-}
module DevelExample
( prodMain
, develMain
) where
import Control.Concurrent (threadDelay)
import Control.Concurrent.Async (race_)
import Network.HTTP.Types
import Network.Wai
import Network.Wai.Handler.Warp
import Network.Wai.Middleware.RequestLogger
import System.Directory (doesFileExist)
import System.Environment
myApp :: Application
myApp _req send = send $ responseLBS
status200
[(hContentType, "text/html; charset=utf-8")]
"<p>Well, this is really <b>boring</b>.</p>"
prodMain :: IO ()
prodMain = do
putStrLn "Running in production mode on port 8080"
run 8080 $ logStdout myApp
develMain :: IO ()
develMain = race_ watchTermFile $ do
port <- fmap read $ getEnv "PORT"
displayPort <- getEnv "DISPLAY_PORT"
putStrLn $ "Running in development mode on port " ++ show port
putStrLn $ "But you should connect to port " ++ displayPort
run port $ logStdoutDev myApp
-- | Would certainly be more efficient to use fsnotify, but this is
-- simpler.
watchTermFile :: IO ()
watchTermFile =
loop
where
loop = do
exists <- doesFileExist "yesod-devel/devel-terminate"
if exists
then return ()
else do
threadDelay 100000
loop

View File

@ -0,0 +1,8 @@
resolver: lts-7.10
packages:
- .
- ..
extra-deps:
- typed-process-0.1.0.0

15
yesod-bin/key.pem Normal file
View File

@ -0,0 +1,15 @@
-----BEGIN RSA PRIVATE KEY-----
MIICXAIBAAKBgQCfYZx7kV6ybogMyAf9MINm7Rwin5LKh+TpD1ZkbLgmqFVotQCd
thgTK66SPXkxEXGI27biNzacJhX7Ml7/4o8sp2GslYKUO46DYvgi/nnNX/bzA5cD
JSSGK11eQEVs+p0GEZ/6Juhpx/oQwMDMgo0UHkiH8QtKI8ojXnFF2MsLNwIDAQAB
AoGAR8pgAgjo7tZ60ccIUjOX/LSxB6d5J2Eu6wvNjk6qZD9OuWtOa7up/HigmZ63
CDMjQNI2/o6AOrWtEQkPYZNbibuifzg5V517nHGSqkqjoIgesAiwEsoKpeOgGTtM
MM08oHbJ9uOnDnEEnDBiE0iE3jCTDfmwjqDMpUhu9dZ1EAECQQDKVpzSSV3pzMOp
ixNxMpYxzcE+4K9jgM+MlxPBJSQhVrg/cRQWb26cKBi8LdSxF23hQTsFr+8qLwid
Ah2AgUOBAkEAyaaCjrNRCiHRpd6YzWZ6GKkxbUvxSuOKX3N7hDaE2OFzQTv2Li8B
5mrCsXnSZtOG+MBFdHU66UYie1OzDSDKtwJAKMsvkOID0ihbZmpIwDC/wUjHZkLs
eXY14hVvgShY0XPnb7r/nspWlZsr6Xyf/hhIKfr5yFrBMFMNPIJ5qjflgQJAWsyV
YTgxN4S+6BdxapvIQq58ySA3CGeo+Q4BAimibB4oTal4UpdsHZrZDB00toRs9Dlv
jN70pfGkuS+ZIkIvxQJBAKSf5qpXWp4oZcThkieAiMeAhG96xqRPXhPUxq6QF+YG
T4PF1sjlpZwqy7C+2oF3BqLP09mCW7YkH9Jgnl1zDF8=
-----END RSA PRIVATE KEY-----

200
yesod-bin/main.hs Executable file
View File

@ -0,0 +1,200 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE RecordWildCards #-}
module Main (main) where
import Data.Monoid
import Data.Version (showVersion)
import Options.Applicative
import System.Exit (exitFailure)
import AddHandler (addHandler)
import Devel (DevelOpts (..), devel, develSignal)
import Keter (keter)
import Options (injectDefaults)
import qualified Paths_yesod_bin
import HsFile (mkHsFile)
data CabalPgm = Cabal | CabalDev deriving (Show, Eq)
data Options = Options
{ optCabalPgm :: CabalPgm
, optVerbose :: Bool
, optCommand :: Command
}
deriving (Show, Eq)
data Command = Init [String]
| HsFiles
| Configure
| Build { buildExtraArgs :: [String] }
| Touch
| Devel { develSuccessHook :: Maybe String
, develExtraArgs :: [String]
, develPort :: Int
, develTlsPort :: Int
, proxyTimeout :: Int
, noReverseProxy :: Bool
, develHost :: Maybe String
, cert :: Maybe (FilePath, FilePath)
}
| DevelSignal
| Test
| AddHandler
{ addHandlerRoute :: Maybe String
, addHandlerPattern :: Maybe String
, addHandlerMethods :: [String]
}
| Keter
{ _keterNoRebuild :: Bool
, _keterNoCopyTo :: Bool
, _keterBuildArgs :: [String]
}
| Version
deriving (Show, Eq)
cabalCommand :: Options -> String
cabalCommand mopt
| optCabalPgm mopt == CabalDev = "cabal-dev"
| otherwise = "cabal"
main :: IO ()
main = do
o <- execParser =<< injectDefaults "yesod"
[ ("yesod.devel.extracabalarg" , \o args -> o { optCommand =
case optCommand o of
d@Devel{} -> d { develExtraArgs = args }
c -> c
})
, ("yesod.build.extracabalarg" , \o args -> o { optCommand =
case optCommand o of
b@Build{} -> b { buildExtraArgs = args }
c -> c
})
] optParser'
case optCommand o of
Init _ -> initErrorMsg
HsFiles -> mkHsFile
Configure -> cabalErrorMsg
Build _ -> cabalErrorMsg
Touch -> cabalErrorMsg
Keter{..} -> keter (cabalCommand o) _keterNoRebuild _keterNoCopyTo _keterBuildArgs
Version -> putStrLn ("yesod-bin version: " ++ showVersion Paths_yesod_bin.version)
AddHandler{..} -> addHandler addHandlerRoute addHandlerPattern addHandlerMethods
Test -> cabalErrorMsg
Devel{..} -> devel DevelOpts
{ verbose = optVerbose o
, successHook = develSuccessHook
, develPort = develPort
, develTlsPort = develTlsPort
, proxyTimeout = proxyTimeout
, useReverseProxy = not noReverseProxy
, develHost = develHost
, cert = cert
} develExtraArgs
DevelSignal -> develSignal
where
initErrorMsg = do
mapM_ putStrLn
[ "The init command has been removed."
, "Please use 'stack new <project name> <template>' instead where the"
, "available templates can be found by running 'stack templates'. For"
, "a Yesod based application you should probably choose one of the"
, "pre-canned Yesod templates."
]
exitFailure
cabalErrorMsg = do
mapM_ putStrLn
[ "The configure, build, touch, and test commands have been removed."
, "Please use 'stack' for building your project."
]
exitFailure
optParser' :: ParserInfo Options
optParser' = info (helper <*> optParser) ( fullDesc <> header "Yesod Web Framework command line utility" )
optParser :: Parser Options
optParser = Options
<$> flag Cabal CabalDev ( long "dev" <> short 'd' <> help "use cabal-dev" )
<*> switch ( long "verbose" <> short 'v' <> help "More verbose output" )
<*> subparser ( command "init" (info (helper <*> initOptions)
(progDesc "Command no longer available, please use 'stack new'"))
<> command "hsfiles" (info (pure HsFiles)
(progDesc "Create a hsfiles file for the current folder"))
<> command "configure" (info (pure Configure)
(progDesc "DEPRECATED"))
<> command "build" (info (helper <*> (Build <$> extraCabalArgs))
(progDesc "DEPRECATED"))
<> command "touch" (info (pure Touch)
(progDesc "DEPRECATED"))
<> command "devel" (info (helper <*> develOptions)
(progDesc "Run project with the devel server"))
<> command "devel-signal" (info (helper <*> pure DevelSignal)
(progDesc "Used internally by the devel command"))
<> command "test" (info (pure Test)
(progDesc "DEPRECATED"))
<> command "add-handler" (info (helper <*> addHandlerOptions)
(progDesc ("Add a new handler and module to the project."
++ " Interactively asks for input if you do not specify arguments.")))
<> command "keter" (info (helper <*> keterOptions)
(progDesc "Build a keter bundle"))
<> command "version" (info (pure Version)
(progDesc "Print the version of Yesod"))
)
initOptions :: Parser Command
initOptions = Init <$> many (argument str mempty)
keterOptions :: Parser Command
keterOptions = Keter
<$> switch ( long "nobuild" <> short 'n' <> help "Skip rebuilding" )
<*> switch ( long "nocopyto" <> help "Ignore copy-to directive in keter config file" )
<*> optStrToList ( long "build-args" <> help "Build arguments" )
where
optStrToList m = option (words <$> str) $ value [] <> m
develOptions :: Parser Command
develOptions = Devel <$> optStr ( long "success-hook" <> short 's' <> metavar "COMMAND"
<> help "Run COMMAND after rebuild succeeds")
<*> extraStackArgs
<*> option auto ( long "port" <> short 'p' <> value 3000 <> metavar "N"
<> help "Devel server listening port" )
<*> option auto ( long "tls-port" <> short 'q' <> value 3443 <> metavar "N"
<> help "Devel server listening port (tls)" )
<*> option auto ( long "proxy-timeout" <> short 'x' <> value 0 <> metavar "N"
<> help "Devel server timeout before returning 'not ready' message (in seconds, 0 for none)" )
<*> switch ( long "disable-reverse-proxy" <> short 'n'
<> help "Disable reverse proxy" )
<*> optStr (long "host" <> metavar "HOST"
<> help "Host interface to bind to; IP address, '*' for all interfaces, '*4' for IP4, '*6' for IP6")
<*> optional ( (,)
<$> strOption (long "cert" <> metavar "CERT"
<> help "Path to TLS certificate file, requires that --key is also defined")
<*> strOption (long "key" <> metavar "KEY"
<> help "Path to TLS key file, requires that --cert is also defined") )
extraStackArgs :: Parser [String]
extraStackArgs = many (strOption ( long "extra-stack-arg" <> short 'e' <> metavar "ARG"
<> help "pass extra argument ARG to stack")
)
extraCabalArgs :: Parser [String]
extraCabalArgs = many (strOption ( long "extra-cabal-arg" <> short 'e' <> metavar "ARG"
<> help "pass extra argument ARG to cabal")
)
addHandlerOptions :: Parser Command
addHandlerOptions = AddHandler
<$> optStr ( long "route" <> short 'r' <> metavar "ROUTE"
<> help "Name of route (without trailing R). Required.")
<*> optStr ( long "pattern" <> short 'p' <> metavar "PATTERN"
<> help "Route pattern (ex: /entry/#EntryId). Defaults to \"\".")
<*> many (strOption ( long "method" <> short 'm' <> metavar "METHOD"
<> help "Takes one method. Use this multiple times to add multiple methods. Defaults to none.")
)
-- | Optional @String@ argument
optStr :: Mod OptionFields (Maybe String) -> Parser (Maybe String)
optStr m = option (Just <$> str) $ value Nothing <> m

86
yesod-bin/refreshing.html Normal file
View File

@ -0,0 +1,86 @@
<!doctype html>
<html>
<head>
<meta charset='utf-8'>
<title>Refreshing - Yesod devel</title>
<style>
body {
background: #e6e6e6;
color: #444;
text-shadow: 1px 1px 1px #ffffff;
font-size: 30px;
font-family: georgia, serif;
}
.wrap {
margin: auto;
width: 25em;
}
h1 {
margin-bottom: 0;
}
h2 {
margin-top: 0;
font-size: 1em;
font-style: italic;
color: #546369;
}
header {
margin-top: 1em;
padding-bottom: 0.25em;
border-bottom: 1px solid #ccc;
color: #1a6e8e;
}
footer {
margin-top: 3em;
padding-top: 0.25em;
border-top: 1px solid #ccc;
color: #666;
font-size: 0.8em;
}
.msgs {
font-size: 0.9em;
}
.msgs p {
margin-bottom: 0.5em;
}
.msgs ul {
margin-top: 0;
line-height: 1.7em;
}
.msgs li {
padding-left: 0.5em;
}
</style>
</head>
<body>
<div class="wrap">
<header><small>Yesod Devel</small></header>
<h1>The application isnt built</h1>
<h2>Well keep trying to refresh every second</h2>
<div class="msgs">
<script> document.getElementsByClassName("msgs")[0].style.display = "none"; </script>
<p>Meanwhile, here is a motivational message:</p>
<ul>
<li>You are a beautiful person making a beautiful web site.</li>
<li>Keep going, youve nearly fixed the bug!</li>
<li>Check your posture, dont lean over too much.</li>
<li>Get a glass of water, keep hydrated.</li>
</ul>
</div>
<script>
var msg = document.getElementsByClassName("msgs")[0];
var lis = Array.prototype.slice.call(msg.querySelectorAll("li"));
lis.forEach(function(li){ li.style.display = "none"; });
lis[Math.floor(Math.random() * lis.length)].style.display = "block";
msg.style.display = "block";
</script>
<footer>
<small>
<script>
document.write(new Date())
</script>
</small>
</footer>
</div>
</body>
</html>

17
yesod-bin/update-hsfiles.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash -ex
rm -rf yesod-scaffold
git clone https://github.com/yesodweb/yesod-scaffold yesod-scaffold
cd yesod-scaffold
for branch in `git branch --no-color -a | grep remotes | grep -v HEAD | grep -v master`
do
git checkout $branch
git checkout -b ${branch##*/}
done
git checkout master
runghc build.hs
cp hsfiles/* ../hsfiles
rm -rf yesod-scaffold

77
yesod-bin/yesod-bin.cabal Normal file
View File

@ -0,0 +1,77 @@
name: yesod-bin
version: 1.6.2.2
license: MIT
license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com>
maintainer: Michael Snoyman <michael@snoyman.com>
synopsis: The yesod helper executable.
description: See README.md for more information
category: Web, Yesod
stability: Stable
cabal-version: >= 1.10
build-type: Simple
homepage: http://www.yesodweb.com/
extra-source-files:
README.md
ChangeLog.md
refreshing.html
*.pem
executable yesod
default-language: Haskell2010
if os(windows)
cpp-options: -DWINDOWS
if os(openbsd)
ld-options: -Wl,-zwxneeded
build-depends: base >= 4.10 && < 5
, Cabal >= 1.18
, bytestring >= 0.9.1.4
, conduit >= 1.3
, conduit-extra >= 1.3
, containers >= 0.2
, data-default-class
, directory >= 1.2.1
, file-embed
, filepath >= 1.1
, fsnotify
, http-client >= 0.4.7
, http-client-tls
, http-reverse-proxy >= 0.4
, http-types >= 0.7
, network >= 2.5
, optparse-applicative >= 0.11
, process
, project-template >= 0.1.1
, say
, split >= 0.2 && < 0.3
, stm
, streaming-commons
, tar >= 0.4 && < 0.6
, text >= 0.11
, time >= 1.1.4
, transformers
, transformers-compat
, unliftio
, unordered-containers
, wai >= 2.0
, wai-extra
, warp >= 1.3.7.5
, warp-tls >= 3.0.1
, yaml >= 0.8 && < 0.12
, zlib >= 0.5
, aeson
ghc-options: -Wall -threaded -rtsopts
main-is: main.hs
other-modules: Devel
Keter
AddHandler
Paths_yesod_bin
Options
HsFile
source-repository head
type: git
location: https://github.com/yesodweb/yesod

463
yesod-core/ChangeLog.md Normal file
View File

@ -0,0 +1,463 @@
# ChangeLog for yesod-core
## 1.6.25.1
* Export the options that were created in 1.6.25.0 [#1825](https://github.com/yesodweb/yesod/pull/1825)
## 1.6.25.0
* Add an options structure that allows the user to set which instances will be derived for a routes structure. [#1819](https://github.com/yesodweb/yesod/pull/1819)
## 1.6.24.5
* Support Aeson 2.2 [#1818](https://github.com/yesodweb/yesod/pull/1818)
## 1.6.24.4
* Fix test-suite compilation error for GHC >= 9.0.1 [#1812](https://github.com/yesodweb/yesod/pull/1812)
## 1.6.24.3
* Fix subsite-to-subsite dispatch [#1805](https://github.com/yesodweb/yesod/pull/1805)
## 1.6.24.2
* No star is type [#1797](https://github.com/yesodweb/yesod/pull/1797)
## 1.6.24.1
* Adapt to removal of `ListT` from transformers-0.6. [#1796](https://github.com/yesodweb/yesod/pull/1796)
## 1.6.24.0
* Make catching exceptions configurable and set the default back to rethrowing async exceptions. [#1772](https://github.com/yesodweb/yesod/pull/1772).
## 1.6.23.1
* Fix typo in creation of the description `<meta>` tag in `defaultLayout`. [#1766](https://github.com/yesodweb/yesod/pull/1766)
## 1.6.23
* Add idempotent versions of `setDescription`, `setDescriptionI`. These functions
have odd behaviour when called multiple times, so they are now warned against.
This can't be a silent change - if you want to switch to the new functions, make
sure your layouts are updated to use `pageDescription` as well as `pageTitle`.
[#1765](https://github.com/yesodweb/yesod/pull/1765)
## 1.6.22.1
+ Remove sometimes failing superfluous test. [#1756](https://github.com/yesodweb/yesod/pull/1756)
## 1.6.22.0
* Add missing list to documentation for ``Yesod.Core.Dispatch.warp``. [#1745](https://github.com/yesodweb/yesod/pull/1745)
* Add instances for `ToContent Void`, `ToTypedContent Void`. [#1752](https://github.com/yesodweb/yesod/pull/1752)
* Handle async exceptions within yesod rather then warp. [#1753](https://github.com/yesodweb/yesod/pull/1753)
* Support template-haskell 2.18 [#1754](https://github.com/yesodweb/yesod/pull/1754)
## 1.6.21.0
* Export `Yesod.Core.Dispatch.defaultGen` so that users may reuse it for their own `YesodRunnerEnv`s [#1734](https://github.com/yesodweb/yesod/pull/1734)
## 1.6.20.2
* Fix compatibility with template-haskell 2.17 [#1729](https://github.com/yesodweb/yesod/pull/1729)
## 1.6.20.1
* Throw an error in `breadcrumbs` if the trail of breadcrumbs is circular. [#1727](https://github.com/yesodweb/yesod/issues/1727)
## 1.6.20
* Generate CSRF tokens using a secure entropy source [#1726](https://github.com/yesodweb/yesod/pull/1726)
* Change semantics of `yreGen` and `defaultGen`
## 1.6.19.0
* Change order of priority in `languages`[#1721](https://github.com/yesodweb/yesod/pull/1721)
## 1.6.18.8
* Fix test suite for wai-extra change around vary header
## 1.6.18.7
* Fix functions generating Open Graph metadata[#1709](https://github.com/yesodweb/yesod/pull/1709)
## 1.6.18.6
* Update documentation from `HandlerT` to `HandlerFor` [#1703](https://github.com/yesodweb/yesod/pull/1703)
## 1.6.18.5
Document `ErrorResponse` [#1698](https://github.com/yesodweb/yesod/pull/1698)
## 1.6.18.4
* Fixed a bug where `mkYesod` and other TH functions didn't work for datatypes with explicitly stated type variables, including the case with typeclass constraints. [https://github.com/yesodweb/yesod/pull/1697](#1697)
## 1.6.18.3
* Remove mention of an oudated Yesod type (`GHandler`) from the docs for `handlerToIO`. [https://github.com/yesodweb/yesod/pull/1695](#1695)
## 1.6.18.2
* Recommends `.yesodroutes` as the file extension for Yesod routes files. [#1686](https://github.com/yesodweb/yesod/pull/1686)
## 1.6.18.1
* Increase the size of CSRF token
## 1.6.18
* Add functions for setting description and OG meta [#1663](https://github.com/yesodweb/yesod/pull/1663)
* Use `DeriveLift` to implement the `Lift` instances for `ResourceTree`,
`Resource`, `Piece`, and `Dispatch`. Among other benefits, this provides
implementations of `liftTyped` on `template-haskell-2.16` (GHC 8.10) or
later. [#1664](https://github.com/yesodweb/yesod/pull/1664)
## 1.6.17.3
* Support for `unliftio-core` 0.2
## 1.6.17.2
* Support template-haskell 2.16, build with GHC 8.10 [#1657](https://github.com/yesodweb/yesod/pull/1657)
## 1.6.17.1
* Remove unnecessary deriving of Typeable
## 1.6.17
* Adds `contentTypeIsJson` [#1646](https://github.com/yesodweb/yesod/pull/1646)
## 1.6.16.1
* Compiles with GHC 8.8.1
## 1.6.16
* Add `jsAttributesHandler` to run arbitrary Handler code before building the
attributes map for the script tag generated by `widgetFile` [#1622](https://github.com/yesodweb/yesod/pull/1622)
## 1.6.15
* Move `redirectToPost` JavaScript form submission from HTML element to
`<script>` tag for CSP reasons [#1620](https://github.com/yesodweb/yesod/pull/1620)
## 1.6.14
* Introduce `JSONResponse`. [issue #1481](https://github.com/yesodweb/yesod/issues/1481) and [PR #1592](https://github.com/yesodweb/yesod/pull/1592)
## 1.6.13
* Introduce `maxContentLengthIO`. [issue #1588](https://github.com/yesodweb/yesod/issues/1588) and [PR #1589](https://github.com/yesodweb/yesod/pull/1589)
## 1.6.12
* Use at most one valid session cookie per request [#1581](https://github.com/yesodweb/yesod/pull/1581)
## 1.6.11
* Deprecate insecure JSON parsing functions [#1576](https://github.com/yesodweb/yesod/pull/1576)
## 1.6.10.1
* Fix test suite compilation for [commercialhaskell/stackage#4319](https://github.com/commercialhaskell/stackage/issues/4319)
## 1.6.10
* Adds functions to get and set values in the per-request caches. [#1573](https://github.com/yesodweb/yesod/pull/1573)
## 1.6.9
* Add `sendResponseNoContent` [#1565](https://github.com/yesodweb/yesod/pull/1565)
## 1.6.8.1
* Add missing test file to tarball [#1563](https://github.com/yesodweb/yesod/issues/1563)
## 1.6.8
* In the route syntax, allow trailing backslashes to indicate line
continuation. [#1558](https://github.com/yesodweb/yesod/pull/1558)
## 1.6.7
* If no matches are found, `selectRep` chooses first representation regardless
of the presence or absence of a `Content-Type` header in the request
[#1540](https://github.com/yesodweb/yesod/pull/1540)
* Sets the `X-XSS-Protection` header to `1; mode=block` [#1550](https://github.com/yesodweb/yesod/pull/1550)
* Add `PrimMonad` instances for `HandlerFor` and `WidgetFor` [from
StackOverflow](https://stackoverflow.com/q/52692508/369198)
## 1.6.6
* `defaultErrorHandler` handles text/plain requests [#1522](https://github.com/yesodweb/yesod/pull/1520)
## 1.6.5
* Add `fileSourceByteString` [#1503](https://github.com/yesodweb/yesod/pull/1503)
## 1.6.4
* Add `addContentDispositionFileName` [#1504](https://github.com/yesodweb/yesod/pull/1504)
## 1.6.3
* Add missing export for `SubHandlerFor`
## 1.6.2
* Derive a `Show` instance for `ResourceTree` and `FlatResource` [#1492](https://github.com/yesodweb/yesod/pull/1492)
* Some third party packages, like `yesod-routes-flow` derive their own `Show` instance, and this will break those packages.
## 1.6.1
* Add a `Semigroup LiteApp` instance, and explicitly define `(<>)` in the
already existing `Semigroup` instances for `WidgetFor`, `Head`, `Body`,
`GWData`, and `UniqueList`.
## 1.6.0
* Upgrade to conduit 1.3.0
* Switch to `MonadUnliftIO`
* Drop `mwc-random` and `blaze-builder` dependencies
* Strictify some internal data structures
* Add `CI` wrapper to first field in `Header` data constructor
[#1418](https://github.com/yesodweb/yesod/issues/1418)
* Internal only change, users of stable API are unaffected: `WidgetT`
holds its data in an `IORef` so that it is isomorphic to `ReaderT`,
avoiding state-loss issues..
* Overhaul of `HandlerT`/`WidgetT` to no longer be transformers.
* Fix Haddock comment & simplify implementation for `contentTypeTypes` [#1476](https://github.com/yesodweb/yesod/issues/1476)
## 1.4.37.3
* Improve error message when request body is too large [#1477](https://github.com/yesodweb/yesod/pull/1477)
## 1.4.37.2
* Improve error messages for the CSRF checking functions [#1455](https://github.com/yesodweb/yesod/issues/1455)
## 1.4.37.1
* Fix documentation on `languages` function, update `getMessageRender` to use said function. [#1457](https://github.com/yesodweb/yesod/pull/1457)
## 1.4.37
* Add `setWeakEtag` function in Yesod.Core.Handler module.
## 1.4.36
* Add `replaceOrAddHeader` function in Yesod.Core.Handler module. [1416](https://github.com/yesodweb/yesod/issues/1416)
## 1.4.35.1
* TH fix for GHC 8.2
## 1.4.35
* Contexts can be included in generated TH instances. [1365](https://github.com/yesodweb/yesod/issues/1365)
* Type variables can be included in routes.
## 1.4.34
* Add `WaiSubsiteWithAuth`. [#1394](https://github.com/yesodweb/yesod/pull/1394)
## 1.4.33
* Adds curly brackets to route parser. [#1363](https://github.com/yesodweb/yesod/pull/1363)
## 1.4.32
* Fix warnings
* Route parsing handles CRLF line endings
* Add 'getPostParams' in Yesod.Core.Handler
* Haddock rendering improved.
## 1.4.31
* Add `parseCheckJsonBody` and `requireCheckJsonBody`
## 1.4.30
* Add `defaultMessageWidget`
## 1.4.29
* Exports some internals and fix version bounds [#1318](https://github.com/yesodweb/yesod/pull/1318)
## 1.4.28
* Add ToWidget instances for strict text, lazy text, and text builder [#1310](https://github.com/yesodweb/yesod/pull/1310)
## 1.4.27
* Added `jsAttributes` [#1308](https://github.com/yesodweb/yesod/pull/1308)
## 1.4.26
* Modify `languages` so that, if you previously called `setLanguage`, the newly
set language will be reflected.
## 1.4.25
* Add instance of MonadHandler and MonadWidget for ExceptT [#1278](https://github.com/yesodweb/yesod/pull/1278)
## 1.4.24
* cached and cachedBy will not overwrite global state changes [#1268](https://github.com/yesodweb/yesod/pull/1268)
## 1.4.23.1
* Don't allow sending multiple cookies with the same name to the client, in accordance with [RFC 6265](https://tools.ietf.org/html/rfc6265). This fixes an issue where multiple CSRF tokens were sent to the client. [#1258](https://github.com/yesodweb/yesod/pull/1258)
* Default CSRF tokens to the root path "/", fixing an issue where multiple tokens were stored in cookies, and using the wrong one led to CSRF errors [#1248](https://github.com/yesodweb/yesod/pull/1248)
## 1.4.23
* urlParamRenderOverride method for Yesod class [#1257](https://github.com/yesodweb/yesod/pull/1257)
* Add laxSameSiteSessions and strictSameSiteSessions [#1226](https://github.com/yesodweb/yesod/pull/1226)
## 1.4.22
* Proper handling of impure exceptions within `HandlerError` values
## 1.4.21
* Add support for `Encoding` from `aeson-0.11` [#1241](https://github.com/yesodweb/yesod/pull/1241)
## 1.4.20.2
* GHC 8 support
## 1.4.20.1
* Log a warning when a CSRF error occurs [#1200](https://github.com/yesodweb/yesod/pull/1200)
## 1.4.20
* `addMessage`, `addMessageI`, and `getMessages` functions
## 1.4.19.1
* Allow lines of dashes in route files [#1182](https://github.com/yesodweb/yesod/pull/1182)
## 1.4.19
* Auth logout not working with defaultCsrfMiddleware [#1151](https://github.com/yesodweb/yesod/issues/1151)
## 1.4.18.2
* Allow subsites within hierarchical routes [#1144](https://github.com/yesodweb/yesod/pull/1144)
## 1.4.18
* Add hook to apply arbitrary function to all handlers [#1122](https://github.com/yesodweb/yesod/pull/1122)
## 1.4.17
* Add `getApprootText`
## 1.4.16
* Add `guessApproot` and `guessApprootOr`
## 1.4.15.1
* bugfix neverExpires leaked threads
## 1.4.15
* mkYesod avoids using reify when it isn't necessary. This avoids needing to define the site type below the call to mkYesod.
## 1.4.14
* Add CSRF protection functions and middleware based on HTTP cookies and headers [#1017](https://github.com/yesodweb/yesod/pull/1017)
* Add mkYesodWith, which allows creating sites with polymorphic type parameters [#1055](https://github.com/yesodweb/yesod/pull/1055)
* Do not define the site type below a call to mkYesod (or any variant), as it will be required at splicing time for reification.
This was allowed before because reification was not in use. Reification was introduced to allow parametrized types to be used
by mkYesod (and variants), with potentially polymorphic variables.
## 1.4.13
* Add getsYesod function [#1042](https://github.com/yesodweb/yesod/pull/1042)
* Add IsString instance for WidgetT site m () [#1038](https://github.com/yesodweb/yesod/pull/1038)
## 1.4.12
* Don't show source location for logs that don't have that information [#1027](https://github.com/yesodweb/yesod/pull/1027)
## 1.4.11
* Expose `stripHandlerT` and `subHelper`
## 1.4.10
* Export log formatting [#1001](https://github.com/yesodweb/yesod/pull/1001)
## 1.4.9.1
* Deal better with multiple cookie headers
## 1.4.9
* Add simple authentication helpers [#962](https://github.com/yesodweb/yesod/pull/962)
## 1.4.8.3
* Use 307 redirect for cleaning paths and non-GET requests [#951](https://github.com/yesodweb/yesod/issues/951)
## 1.4.8.2
* Allow blaze-builder 0.4
## 1.4.8.1
* Bump upper bound on path-pieces
## 1.4.8
* Add a bunch of `Semigroup` instances
## 1.4.7.3
* Remove defunct reference to SpecialResponse [#925](https://github.com/yesodweb/yesod/issues/925)
## 1.4.7
SSL-only session security [#894](https://github.com/yesodweb/yesod/pull/894)
## 1.4.6.2
monad-control 1.0
## 1.4.6
Added the `Yesod.Core.Unsafe` module.
## 1.4.5
* `envClientSessionBackend`
* Add `MonadLoggerIO` instances (conditional on monad-logger 0.3.10 being used).
## 1.4.4.5
Support time 1.5
## 1.4.4.2
`neverExpires` uses dates one year in the future (instead of in 2037).
## 1.4.4.1
Improvements to etag/if-none-match support #868 #869
## 1.4.4
Add the `notModified` and `setEtag` functions.
## 1.4.3
Switch to mwc-random for token generation.

View File

@ -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.

View File

@ -1 +0,0 @@
Learn more at http://docs.yesodweb.com/

7
yesod-core/README.md Normal file
View File

@ -0,0 +1,7 @@
## yesod-core
This is the main package for Yesod, providing all core functionality on which
other packages can be built. It provides dispatch, handler functions, widgets,
etc.
Yesod is well documented on [its website](http://www.yesodweb.com/).

View File

@ -1,232 +0,0 @@
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE OverloadedStrings #-}
module Yesod.Content
( -- * Content
Content (..)
, emptyContent
, ToContent (..)
-- * Mime types
-- ** Data type
, ContentType
, typeHtml
, typePlain
, typeJson
, typeXml
, typeAtom
, typeRss
, typeJpeg
, typePng
, typeGif
, typeJavascript
, typeCss
, typeFlv
, typeOgv
, typeOctet
-- * Utilities
, simpleContentType
-- * Representations
, ChooseRep
, HasReps (..)
, defChooseRep
-- ** Specific content types
, RepHtml (..)
, RepJson (..)
, RepHtmlJson (..)
, RepPlain (..)
, RepXml (..)
-- * Utilities
, formatW3
, formatRFC1123
, formatRFC822
) where
import Data.Maybe (mapMaybe)
import qualified Data.ByteString as B
import qualified Data.ByteString.Lazy as L
import Data.Text.Lazy (Text, pack)
import qualified Data.Text as T
import Data.Time
import System.Locale
import qualified Data.Text.Encoding
import qualified Data.Text.Lazy.Encoding
import Blaze.ByteString.Builder (Builder, fromByteString, fromLazyByteString)
import Data.Monoid (mempty)
import Text.Hamlet (Html)
import Text.Blaze.Renderer.Utf8 (renderHtmlBuilder)
import Data.String (IsString (fromString))
import Network.Wai (FilePart)
import Data.Conduit (Source, Flush)
data Content = ContentBuilder Builder (Maybe Int) -- ^ The content and optional content length.
| ContentSource (Source IO (Flush Builder))
| ContentFile FilePath (Maybe FilePart)
-- | Zero-length enumerator.
emptyContent :: Content
emptyContent = ContentBuilder mempty $ Just 0
instance IsString Content where
fromString = toContent
-- | Anything which can be converted into 'Content'. Most of the time, you will
-- want to use the 'ContentBuilder' constructor. An easier approach will be to use
-- a pre-defined 'toContent' function, such as converting your data into a lazy
-- bytestring and then calling 'toContent' on that.
--
-- Please note that the built-in instances for lazy data structures ('String',
-- lazy 'L.ByteString', lazy 'Text' and 'Html') will not automatically include
-- the content length for the 'ContentBuilder' constructor.
class ToContent a where
toContent :: a -> Content
instance ToContent Builder where
toContent = flip ContentBuilder Nothing
instance ToContent B.ByteString where
toContent bs = ContentBuilder (fromByteString bs) $ Just $ B.length bs
instance ToContent L.ByteString where
toContent = flip ContentBuilder Nothing . fromLazyByteString
instance ToContent T.Text where
toContent = toContent . Data.Text.Encoding.encodeUtf8
instance ToContent Text where
toContent = toContent . Data.Text.Lazy.Encoding.encodeUtf8
instance ToContent String where
toContent = toContent . pack
instance ToContent Html where
toContent bs = ContentBuilder (renderHtmlBuilder bs) Nothing
-- | A function which gives targetted representations of content based on the
-- content-types the user accepts.
type ChooseRep =
[ContentType] -- ^ list of content-types user accepts, ordered by preference
-> IO (ContentType, Content)
-- | Any type which can be converted to representations.
class HasReps a where
chooseRep :: a -> ChooseRep
-- | A helper method for generating 'HasReps' instances.
--
-- This function should be given a list of pairs of content type and conversion
-- functions. If none of the content types match, the first pair is used.
defChooseRep :: [(ContentType, a -> IO Content)] -> a -> ChooseRep
defChooseRep reps a ts = do
let (ct, c) =
case mapMaybe helper ts of
(x:_) -> x
[] -> case reps of
[] -> error "Empty reps to defChooseRep"
(x:_) -> x
c' <- c a
return (ct, c')
where
helper ct = do
c <- lookup ct reps
return (ct, c)
instance HasReps ChooseRep where
chooseRep = id
instance HasReps () where
chooseRep = defChooseRep [(typePlain, const $ return $ toContent B.empty)]
instance HasReps (ContentType, Content) where
chooseRep = const . return
instance HasReps [(ContentType, Content)] where
chooseRep a cts = return $
case filter (\(ct, _) -> go ct `elem` map go cts) a of
((ct, c):_) -> (ct, c)
_ -> case a of
(x:_) -> x
_ -> error "chooseRep [(ContentType, Content)] of empty"
where
go = simpleContentType
newtype RepHtml = RepHtml Content
instance HasReps RepHtml where
chooseRep (RepHtml c) _ = return (typeHtml, c)
newtype RepJson = RepJson Content
instance HasReps RepJson where
chooseRep (RepJson c) _ = return (typeJson, c)
data RepHtmlJson = RepHtmlJson Content Content
instance HasReps RepHtmlJson where
chooseRep (RepHtmlJson html json) = chooseRep
[ (typeHtml, html)
, (typeJson, json)
]
newtype RepPlain = RepPlain Content
instance HasReps RepPlain where
chooseRep (RepPlain c) _ = return (typePlain, c)
newtype RepXml = RepXml Content
instance HasReps RepXml where
chooseRep (RepXml c) _ = return (typeXml, c)
type ContentType = B.ByteString -- FIXME Text?
typeHtml :: ContentType
typeHtml = "text/html; charset=utf-8"
typePlain :: ContentType
typePlain = "text/plain; charset=utf-8"
typeJson :: ContentType
typeJson = "application/json; charset=utf-8"
typeXml :: ContentType
typeXml = "text/xml"
typeAtom :: ContentType
typeAtom = "application/atom+xml"
typeRss :: ContentType
typeRss = "application/rss+xml"
typeJpeg :: ContentType
typeJpeg = "image/jpeg"
typePng :: ContentType
typePng = "image/png"
typeGif :: ContentType
typeGif = "image/gif"
typeJavascript :: ContentType
typeJavascript = "text/javascript; charset=utf-8"
typeCss :: ContentType
typeCss = "text/css; charset=utf-8"
typeFlv :: ContentType
typeFlv = "video/x-flv"
typeOgv :: ContentType
typeOgv = "video/ogg"
typeOctet :: ContentType
typeOctet = "application/octet-stream"
-- | Removes \"extra\" information at the end of a content type string. In
-- particular, removes everything after the semicolon, if present.
--
-- For example, \"text/html; charset=utf-8\" is commonly used to specify the
-- character encoding for HTML data. This function would return \"text/html\".
simpleContentType :: ContentType -> ContentType
simpleContentType = fst . B.breakByte 59 -- 59 == ;
-- | Format a 'UTCTime' in W3 format.
formatW3 :: UTCTime -> T.Text
formatW3 = T.pack . formatTime defaultTimeLocale "%FT%X-00:00"
-- | Format as per RFC 1123.
formatRFC1123 :: UTCTime -> T.Text
formatRFC1123 = T.pack . formatTime defaultTimeLocale "%a, %d %b %Y %X %Z"
-- | Format as per RFC 822.
formatRFC822 :: UTCTime -> T.Text
formatRFC822 = T.pack . formatTime defaultTimeLocale "%a, %d %b %Y %H:%M:%S %z"

View File

@ -1,87 +0,0 @@
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -fno-warn-warnings-deprecations #-}
module Yesod.Core
( -- * Type classes
Yesod (..)
, YesodDispatch (..)
, RenderRoute (..)
-- ** Breadcrumbs
, YesodBreadcrumbs (..)
, breadcrumbs
-- * Types
, Approot (..)
-- * Utitlities
, maybeAuthorized
, widgetToPageContent
-- * Defaults
, defaultErrorHandler
-- * Data types
, AuthResult (..)
, unauthorizedI
-- * Logging
, LogLevel (..)
, formatLogMessage
, fileLocationToString
, logDebug
, logInfo
, logWarn
, logError
, logOther
-- * Misc
, yesodVersion
, yesodRender
-- * Re-exports
, module Yesod.Content
, module Yesod.Dispatch
, module Yesod.Handler
, module Yesod.Request
, module Yesod.Widget
, module Yesod.Message
) where
import Yesod.Internal.Core
import Yesod.Content
import Yesod.Dispatch
import Yesod.Handler
import Yesod.Request
import Yesod.Widget
import Yesod.Message
import Language.Haskell.TH.Syntax
import qualified Language.Haskell.TH.Syntax as TH
import Data.Text (Text)
logTH :: LogLevel -> Q Exp
logTH level =
[|messageLoggerHandler $(qLocation >>= liftLoc) $(TH.lift level)|]
where
liftLoc :: Loc -> Q Exp
liftLoc (Loc a b c d e) = [|Loc $(TH.lift a) $(TH.lift b) $(TH.lift c) $(TH.lift d) $(TH.lift e)|]
-- | Generates a function that takes a 'Text' and logs a 'LevelDebug' message. Usage:
--
-- > $(logDebug) "This is a debug log message"
logDebug :: Q Exp
logDebug = logTH LevelDebug
-- | See 'logDebug'
logInfo :: Q Exp
logInfo = logTH LevelInfo
-- | See 'logDebug'
logWarn :: Q Exp
logWarn = logTH LevelWarn
-- | See 'logDebug'
logError :: Q Exp
logError = logTH LevelError
-- | Generates a function that takes a 'Text' and logs a 'LevelOther' message. Usage:
--
-- > $(logOther "My new level") "This is a log message"
logOther :: Text -> Q Exp
logOther = logTH . LevelOther
-- | Return an 'Unauthorized' value, with the given i18n message.
unauthorizedI :: RenderMessage master msg => msg -> GHandler sub master AuthResult
unauthorizedI msg =do
mr <- getMessageRender
return $ Unauthorized $ mr msg

View File

@ -1,190 +0,0 @@
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}
module Yesod.Dispatch
( -- * Quasi-quoted routing
parseRoutes
, parseRoutesNoCheck
, parseRoutesFile
, parseRoutesFileNoCheck
, mkYesod
, mkYesodSub
-- ** More fine-grained
, mkYesodData
, mkYesodSubData
, mkYesodDispatch
, mkYesodSubDispatch
-- ** Path pieces
, PathPiece (..)
, PathMultiPiece (..)
, Texts
-- * Convert to WAI
, toWaiApp
, toWaiAppPlain
) where
import Data.Functor ((<$>))
import Prelude hiding (exp)
import Yesod.Internal.Core
import Yesod.Handler hiding (lift)
import Yesod.Widget (GWidget)
import Web.PathPieces
import Language.Haskell.TH.Syntax
import qualified Network.Wai as W
import Network.Wai.Middleware.Gzip
import Network.Wai.Middleware.Autohead
import Data.ByteString.Lazy.Char8 ()
import Web.ClientSession
import Data.Text (Text)
import Data.Text.Encoding (decodeUtf8With)
import Data.Text.Encoding.Error (lenientDecode)
import Data.Monoid (mappend)
import qualified Data.ByteString as S
import qualified Blaze.ByteString.Builder
import Network.HTTP.Types (status301)
import Yesod.Routes.TH
import Yesod.Content (chooseRep)
import Yesod.Routes.Parse
type Texts = [Text]
-- | Generates URL datatype and site function for the given 'Resource's. This
-- is used for creating sites, /not/ subsites. See 'mkYesodSub' for the latter.
-- Use 'parseRoutes' to create the 'Resource's.
mkYesod :: String -- ^ name of the argument datatype
-> [Resource String]
-> Q [Dec]
mkYesod name = fmap (uncurry (++)) . mkYesodGeneral name [] [] False
-- | Generates URL datatype and site function for the given 'Resource's. This
-- is used for creating subsites, /not/ sites. See 'mkYesod' for the latter.
-- Use 'parseRoutes' to create the 'Resource's. In general, a subsite is not
-- executable by itself, but instead provides functionality to
-- be embedded in other sites.
mkYesodSub :: String -- ^ name of the argument datatype
-> Cxt
-> [Resource String]
-> Q [Dec]
mkYesodSub name clazzes =
fmap (uncurry (++)) . mkYesodGeneral name' rest clazzes True
where
(name':rest) = words name
-- | Sometimes, you will want to declare your routes in one file and define
-- your handlers elsewhere. For example, this is the only way to break up a
-- monolithic file into smaller parts. Use this function, paired with
-- 'mkYesodDispatch', to do just that.
mkYesodData :: String -> [Resource String] -> Q [Dec]
mkYesodData name res = mkYesodDataGeneral name [] False res
mkYesodSubData :: String -> Cxt -> [Resource String] -> Q [Dec]
mkYesodSubData name clazzes res = mkYesodDataGeneral name clazzes True res
mkYesodDataGeneral :: String -> Cxt -> Bool -> [Resource String] -> Q [Dec]
mkYesodDataGeneral name clazzes isSub res = do
let (name':rest) = words name
(x, _) <- mkYesodGeneral name' rest clazzes isSub res
let rname = mkName $ "resources" ++ name
eres <- lift res
let y = [ SigD rname $ ListT `AppT` (ConT ''Resource `AppT` ConT ''String)
, FunD rname [Clause [] (NormalB eres) []]
]
return $ x ++ y
-- | See 'mkYesodData'.
mkYesodDispatch :: String -> [Resource String] -> Q [Dec]
mkYesodDispatch name = fmap snd . mkYesodGeneral name [] [] False
mkYesodSubDispatch :: String -> Cxt -> [Resource String] -> Q [Dec]
mkYesodSubDispatch name clazzes = fmap snd . mkYesodGeneral name' rest clazzes True
where (name':rest) = words name
mkYesodGeneral :: String -- ^ foundation type
-> [String]
-> Cxt -- ^ classes
-> Bool -- ^ is subsite?
-> [Resource String]
-> Q ([Dec], [Dec])
mkYesodGeneral name args clazzes isSub resS = do
let args' = map mkName args
arg = foldl AppT (ConT name') $ map VarT args'
let res = map (fmap parseType) resS
renderRouteDec <- mkRenderRouteInstance arg res
disp <- mkDispatchClause [|yesodRunner|] [|yesodDispatch|] [|fmap chooseRep|] res
let master = mkName "master"
let ctx = if isSub
then ClassP (mkName "Yesod") [VarT master] : clazzes
else []
let ytyp = if isSub
then ConT ''YesodDispatch `AppT` arg `AppT` VarT master
else ConT ''YesodDispatch `AppT` arg `AppT` arg
let yesodDispatch' =
InstanceD ctx ytyp [FunD (mkName "yesodDispatch") [disp]]
return (renderRouteDec : masterTypSyns, [yesodDispatch'])
where
name' = mkName name
masterTypSyns
| isSub = []
| otherwise =
[ TySynD
(mkName "Handler")
[]
(ConT ''GHandler `AppT` ConT name' `AppT` ConT name')
, TySynD
(mkName "Widget")
[]
(ConT ''GWidget `AppT` ConT name' `AppT` ConT name' `AppT` TupleT 0)
]
-- | Convert the given argument into a WAI application, executable with any WAI
-- handler. This is the same as 'toWaiAppPlain', except it includes two
-- middlewares: GZIP compression and autohead. This is the
-- recommended approach for most users.
toWaiApp :: ( Yesod master
, YesodDispatch master master
) => master -> IO W.Application
toWaiApp y = gzip (gzipSettings y) . autohead <$> toWaiAppPlain y
-- | Convert the given argument into a WAI application, executable with any WAI
-- handler. This differs from 'toWaiApp' in that it uses no middlewares.
toWaiAppPlain :: ( Yesod master
, YesodDispatch master master
) => master -> IO W.Application
toWaiAppPlain a = toWaiApp' a <$> encryptKey a
toWaiApp' :: ( Yesod master
, YesodDispatch master master
)
=> master
-> Maybe Key
-> W.Application
toWaiApp' y key' env =
case cleanPath y $ W.pathInfo env of
Left pieces -> sendRedirect y pieces env
Right pieces ->
yesodDispatch y y id app404 handler405 method pieces key' env
where
app404 = yesodRunner notFound y y Nothing id
handler405 route = yesodRunner badMethod y y (Just route) id
method = decodeUtf8With lenientDecode $ W.requestMethod env
sendRedirect :: Yesod master => master -> [Text] -> W.Application
sendRedirect y segments' env =
return $ W.responseLBS status301
[ ("Content-Type", "text/plain")
, ("Location", Blaze.ByteString.Builder.toByteString dest')
] "Redirecting"
where
dest = joinPath y (resolveApproot y env) segments' []
dest' =
if S.null (W.rawQueryString env)
then dest
else (dest `mappend`
Blaze.ByteString.Builder.fromByteString (W.rawQueryString env))

View File

@ -1,933 +0,0 @@
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE DeriveDataTypeable #-}
---------------------------------------------------------
--
-- Module : Yesod.Handler
-- Copyright : Michael Snoyman
-- License : BSD3
--
-- Maintainer : Michael Snoyman <michael@snoyman.com>
-- Stability : stable
-- Portability : portable
--
-- Define Handler stuff.
--
---------------------------------------------------------
module Yesod.Handler
( -- * Type families
YesodSubRoute (..)
-- * Handler monad
, GHandler
-- ** Read information from handler
, getYesod
, getYesodSub
, getUrlRender
, getUrlRenderParams
, getCurrentRoute
, getRouteToMaster
, getRequest
, waiRequest
, runRequestBody
-- * Special responses
-- ** Redirecting
, RedirectUrl (..)
, redirect
, redirectWith
, redirectToPost
-- ** Errors
, notFound
, badMethod
, permissionDenied
, permissionDeniedI
, invalidArgs
, invalidArgsI
-- ** Short-circuit responses.
, sendFile
, sendFilePart
, sendResponse
, sendResponseStatus
, sendResponseCreated
, sendWaiResponse
-- * Setting headers
, setCookie
, getExpires
, deleteCookie
, setHeader
, setLanguage
-- ** Content caching and expiration
, cacheSeconds
, neverExpires
, alreadyExpired
, expiresAt
-- * Session
, SessionMap
, lookupSession
, lookupSessionBS
, getSession
, setSession
, setSessionBS
, deleteSession
-- ** Ultimate destination
, setUltDest
, setUltDestCurrent
, setUltDestReferer
, redirectUltDest
, clearUltDest
-- ** Messages
, setMessage
, setMessageI
, getMessage
-- * Helpers for specific content
-- ** Hamlet
, hamletToContent
, hamletToRepHtml
-- ** Misc
, newIdent
-- * Lifting
, MonadLift (..)
-- * i18n
, getMessageRender
-- * Per-request caching
, CacheKey
, mkCacheKey
, cacheLookup
, cacheInsert
, cacheDelete
-- * Internal Yesod
, runHandler
, YesodApp (..)
, runSubsiteGetter
, toMasterHandler
, toMasterHandlerDyn
, toMasterHandlerMaybe
, localNoCurrent
, HandlerData
, ErrorResponse (..)
, YesodAppResult (..)
, handlerToYAR
, yarToResponse
, headerToPair
) where
import Prelude hiding (catch)
import Yesod.Internal.Request
import Yesod.Internal
import Data.Time (UTCTime, getCurrentTime, addUTCTime)
import Control.Exception hiding (Handler, catch, finally)
import Control.Applicative
import Control.Monad (liftM)
import Control.Monad.IO.Class
import Control.Monad.Trans.Class (MonadTrans)
import qualified Control.Monad.Trans.Class
import System.IO
import qualified Network.Wai as W
import qualified Network.HTTP.Types as H
import Text.Hamlet
import qualified Text.Blaze.Renderer.Text
import qualified Data.Text as T
import Data.Text.Encoding (encodeUtf8, decodeUtf8With)
import Data.Text.Encoding.Error (lenientDecode)
import qualified Data.Text.Lazy as TL
import qualified Data.Map as Map
import qualified Data.ByteString as S
import Network.Wai.Parse (parseHttpAccept)
import Yesod.Content
import Data.Maybe (fromMaybe)
import Web.Cookie (SetCookie (..), renderSetCookie)
import Control.Arrow ((***))
import qualified Network.Wai.Parse as NWP
import Data.Monoid (mappend, mempty, Endo (..))
import qualified Data.ByteString.Char8 as S8
import Data.CaseInsensitive (CI)
import qualified Data.CaseInsensitive as CI
import Blaze.ByteString.Builder (toByteString)
import Data.Text (Text)
import Yesod.Message (RenderMessage (..))
import Text.Blaze (toHtml, preEscapedText)
import qualified Yesod.Internal.Cache as Cache
import Yesod.Internal.Cache (mkCacheKey, CacheKey)
import Data.Typeable (Typeable)
import qualified Data.IORef as I
import Control.Monad.Trans.Resource
import Control.Exception.Lifted (catch)
import Control.Monad.Trans.Control
import Control.Monad.Base
import Yesod.Routes.Class
class YesodSubRoute s y where
fromSubRoute :: s -> y -> Route s -> Route y
data HandlerData sub master = HandlerData
{ handlerRequest :: Request
, handlerSub :: sub
, handlerMaster :: master
, handlerRoute :: Maybe (Route sub)
, handlerRender :: Route master -> [(Text, Text)] -> Text
, handlerToMaster :: Route sub -> Route master
, handlerState :: I.IORef GHState
}
handlerSubData :: (Route sub -> Route master)
-> (master -> sub)
-> Route sub
-> HandlerData oldSub master
-> HandlerData sub master
handlerSubData tm ts = handlerSubDataMaybe tm ts . Just
handlerSubDataMaybe :: (Route sub -> Route master)
-> (master -> sub)
-> Maybe (Route sub)
-> HandlerData oldSub master
-> HandlerData sub master
handlerSubDataMaybe tm ts route hd = hd
{ handlerSub = ts $ handlerMaster hd
, handlerToMaster = tm
, handlerRoute = route
}
get :: GHandler sub master GHState
get = do
hd <- ask
liftIO $ I.readIORef $ handlerState hd
put :: GHState -> GHandler sub master ()
put g = do
hd <- ask
liftIO $ I.writeIORef (handlerState hd) g
modify :: (GHState -> GHState) -> GHandler sub master ()
modify f = do
hd <- ask
liftIO $ I.atomicModifyIORef (handlerState hd) $ \g -> (f g, ())
tell :: Endo [Header] -> GHandler sub master ()
tell hs = modify $ \g -> g { ghsHeaders = ghsHeaders g `mappend` hs }
-- | Used internally for promoting subsite handler functions to master site
-- handler functions. Should not be needed by users.
toMasterHandler :: (Route sub -> Route master)
-> (master -> sub)
-> Route sub
-> GHandler sub master a
-> GHandler sub' master a
toMasterHandler tm ts route = local (handlerSubData tm ts route)
-- | FIXME do we need this?
toMasterHandlerDyn :: (Route sub -> Route master)
-> GHandler sub' master sub
-> Route sub
-> GHandler sub master a
-> GHandler sub' master a
toMasterHandlerDyn tm getSub route h = do
sub <- getSub
local (handlerSubData tm (const sub) route) h
class SubsiteGetter g m s | g -> s where
runSubsiteGetter :: g -> m s
instance (master ~ master'
) => SubsiteGetter (master -> sub) (GHandler anySub master') sub where
runSubsiteGetter getter = getter <$> getYesod
instance (anySub ~ anySub'
,master ~ master'
) => SubsiteGetter (GHandler anySub master sub) (GHandler anySub' master') sub where
runSubsiteGetter = id
toMasterHandlerMaybe :: (Route sub -> Route master)
-> (master -> sub)
-> Maybe (Route sub)
-> GHandler sub master a
-> GHandler sub' master a
toMasterHandlerMaybe tm ts route = local (handlerSubDataMaybe tm ts route)
-- | A generic handler monad, which can have a different subsite and master
-- site. We define a newtype for better error message.
newtype GHandler sub master a = GHandler
{ unGHandler :: HandlerData sub master -> ResourceT IO a
}
data GHState = GHState
{ ghsSession :: SessionMap
, ghsRBC :: Maybe RequestBodyContents
, ghsIdent :: Int
, ghsCache :: Cache.Cache
, ghsHeaders :: Endo [Header]
}
type SessionMap = Map.Map Text S.ByteString
-- | An extension of the basic WAI 'W.Application' datatype to provide extra
-- features needed by Yesod. Users should never need to use this directly, as
-- the 'GHandler' monad and template haskell code should hide it away.
newtype YesodApp = YesodApp
{ unYesodApp
:: (ErrorResponse -> YesodApp)
-> Request
-> [ContentType]
-> SessionMap
-> ResourceT IO YesodAppResult
}
data YesodAppResult
= YARWai W.Response
| YARPlain H.Status [Header] ContentType Content SessionMap
data HandlerContents =
HCContent H.Status ChooseRep
| HCError ErrorResponse
| HCSendFile ContentType FilePath (Maybe W.FilePart) -- FIXME replace FilePath with opaque type from system-filepath?
| HCRedirect H.Status Text
| HCCreated Text
| HCWai W.Response
deriving Typeable
instance Show HandlerContents where
show _ = "Cannot show a HandlerContents"
instance Exception HandlerContents
getRequest :: GHandler s m Request
getRequest = handlerRequest `liftM` ask
hcError :: ErrorResponse -> GHandler sub master a
hcError = liftIO . throwIO . HCError
runRequestBody :: GHandler s m RequestBodyContents
runRequestBody = do
x <- get
case ghsRBC x of
Just rbc -> return rbc
Nothing -> do
rr <- waiRequest
rbc <- lift $ rbHelper rr
put x { ghsRBC = Just rbc }
return rbc
rbHelper :: W.Request -> ResourceT IO RequestBodyContents
rbHelper req =
(map fix1 *** map fix2) <$> (NWP.parseRequestBody NWP.lbsBackEnd req)
where
fix1 = go *** go
fix2 (x, NWP.FileInfo a b c) =
(go x, FileInfo (go a) (go b) c)
go = decodeUtf8With lenientDecode
-- | Get the sub application argument.
getYesodSub :: GHandler sub master sub
getYesodSub = handlerSub `liftM` ask
-- | Get the master site appliation argument.
getYesod :: GHandler sub master master
getYesod = handlerMaster `liftM` ask
-- | Get the URL rendering function.
getUrlRender :: GHandler sub master (Route master -> Text)
getUrlRender = do
x <- handlerRender `liftM` ask
return $ flip x []
-- | The URL rendering function with query-string parameters.
getUrlRenderParams
:: GHandler sub master (Route master -> [(Text, Text)] -> Text)
getUrlRenderParams = handlerRender `liftM` ask
-- | Get the route requested by the user. If this is a 404 response- where the
-- user requested an invalid route- this function will return 'Nothing'.
getCurrentRoute :: GHandler sub master (Maybe (Route sub))
getCurrentRoute = handlerRoute `liftM` ask
-- | Get the function to promote a route for a subsite to a route for the
-- master site.
getRouteToMaster :: GHandler sub master (Route sub -> Route master)
getRouteToMaster = handlerToMaster `liftM` ask
-- | Function used internally by Yesod in the process of converting a
-- 'GHandler' into an 'W.Application'. Should not be needed by users.
runHandler :: HasReps c
=> GHandler sub master c
-> (Route master -> [(Text, Text)] -> Text)
-> Maybe (Route sub)
-> (Route sub -> Route master)
-> master
-> sub
-> YesodApp
runHandler handler mrender sroute tomr master sub =
YesodApp $ \eh rr cts initSession -> do
let toErrorHandler e =
case fromException e of
Just x -> x
Nothing -> InternalError $ T.pack $ show e
istate <- liftIO $ I.newIORef GHState
{ ghsSession = initSession
, ghsRBC = Nothing
, ghsIdent = 1
, ghsCache = mempty
, ghsHeaders = mempty
}
let hd = HandlerData
{ handlerRequest = rr
, handlerSub = sub
, handlerMaster = master
, handlerRoute = sroute
, handlerRender = mrender
, handlerToMaster = tomr
, handlerState = istate
}
contents' <- catch (fmap Right $ unGHandler handler hd)
(\e -> return $ Left $ maybe (HCError $ toErrorHandler e) id
$ fromException e)
state <- liftIO $ I.readIORef istate
let finalSession = ghsSession state
let headers = ghsHeaders state
let contents = either id (HCContent H.status200 . chooseRep) contents'
let handleError e = do
yar <- unYesodApp (eh e) safeEh rr cts finalSession
case yar of
YARPlain _ hs ct c sess ->
let hs' = appEndo headers hs
in return $ YARPlain (getStatus e) hs' ct c sess
YARWai _ -> return yar
let sendFile' ct fp p =
return $ YARPlain H.status200 (appEndo headers []) ct (ContentFile fp p) finalSession
case contents of
HCContent status a -> do
(ct, c) <- liftIO $ a cts
return $ YARPlain status (appEndo headers []) ct c finalSession
HCError e -> handleError e
HCRedirect status loc -> do
let hs = Header "Location" (encodeUtf8 loc) : appEndo headers []
return $ YARPlain
status hs typePlain emptyContent
finalSession
HCSendFile ct fp p -> catch
(sendFile' ct fp p)
(handleError . toErrorHandler)
HCCreated loc -> do
let hs = Header "Location" (encodeUtf8 loc) : appEndo headers []
return $ YARPlain
H.status201
hs
typePlain
emptyContent
finalSession
HCWai r -> return $ YARWai r
safeEh :: ErrorResponse -> YesodApp
safeEh er = YesodApp $ \_ _ _ session -> do
liftIO $ hPutStrLn stderr $ "Error handler errored out: " ++ show er
return $ YARPlain
H.status500
[]
typePlain
(toContent ("Internal Server Error" :: S.ByteString))
session
-- | Redirect to the given route.
-- HTTP status code 303 for HTTP 1.1 clients and 302 for HTTP 1.0
-- This is the appropriate choice for a get-following-post
-- technique, which should be the usual use case.
--
-- If you want direct control of the final status code, or need a different
-- status code, please use 'redirectWith'.
redirect :: RedirectUrl master url => url -> GHandler sub master a
redirect url = do
req <- waiRequest
let status =
if W.httpVersion req == H.http11
then H.status303
else H.status302
redirectWith status url
-- | Redirect to the given URL with the specified status code.
redirectWith :: RedirectUrl master url => H.Status -> url -> GHandler sub master a
redirectWith status url = do
urlText <- toTextUrl url
liftIO $ throwIO $ HCRedirect status urlText
ultDestKey :: Text
ultDestKey = "_ULT"
-- | Sets the ultimate destination variable to the given route.
--
-- An ultimate destination is stored in the user session and can be loaded
-- later by 'redirectUltDest'.
setUltDest :: RedirectUrl master url => url -> GHandler sub master ()
setUltDest url = do
urlText <- toTextUrl url
setSession ultDestKey urlText
-- | Same as 'setUltDest', but uses the current page.
--
-- If this is a 404 handler, there is no current page, and then this call does
-- nothing.
setUltDestCurrent :: GHandler sub master ()
setUltDestCurrent = do
route <- getCurrentRoute
case route of
Nothing -> return ()
Just r -> do
tm <- getRouteToMaster
gets' <- reqGetParams `liftM` handlerRequest `liftM` ask
setUltDest (tm r, gets')
-- | Sets the ultimate destination to the referer request header, if present.
--
-- This function will not overwrite an existing ultdest.
setUltDestReferer :: GHandler sub master ()
setUltDestReferer = do
mdest <- lookupSession ultDestKey
maybe
(waiRequest >>= maybe (return ()) setUltDestBS . lookup "referer" . W.requestHeaders)
(const $ return ())
mdest
where
setUltDestBS = setUltDest . T.pack . S8.unpack
-- | Redirect to the ultimate destination in the user's session. Clear the
-- value from the session.
--
-- The ultimate destination is set with 'setUltDest'.
--
-- This function uses 'redirect', and thus will perform a temporary redirect to
-- a GET request.
redirectUltDest :: RedirectUrl master url
=> url -- ^ default destination if nothing in session
-> GHandler sub master a
redirectUltDest def = do
mdest <- lookupSession ultDestKey
deleteSession ultDestKey
maybe (redirect def) redirect mdest
-- | Remove a previously set ultimate destination. See 'setUltDest'.
clearUltDest :: GHandler sub master ()
clearUltDest = deleteSession ultDestKey
msgKey :: Text
msgKey = "_MSG"
-- | Sets a message in the user's session.
--
-- See 'getMessage'.
setMessage :: Html -> GHandler sub master ()
setMessage = setSession msgKey . T.concat . TL.toChunks . Text.Blaze.Renderer.Text.renderHtml
-- | Sets a message in the user's session.
--
-- See 'getMessage'.
setMessageI :: (RenderMessage y msg) => msg -> GHandler sub y ()
setMessageI msg = do
mr <- getMessageRender
setMessage $ toHtml $ mr msg
-- | Gets the message in the user's session, if available, and then clears the
-- variable.
--
-- See 'setMessage'.
getMessage :: GHandler sub master (Maybe Html)
getMessage = do
mmsg <- liftM (fmap preEscapedText) $ lookupSession msgKey
deleteSession msgKey
return mmsg
-- | Bypass remaining handler code and output the given file.
--
-- For some backends, this is more efficient than reading in the file to
-- memory, since they can optimize file sending via a system call to sendfile.
sendFile :: ContentType -> FilePath -> GHandler sub master a
sendFile ct fp = liftIO . throwIO $ HCSendFile ct fp Nothing
-- | Same as 'sendFile', but only sends part of a file.
sendFilePart :: ContentType
-> FilePath
-> Integer -- ^ offset
-> Integer -- ^ count
-> GHandler sub master a
sendFilePart ct fp off count =
liftIO . throwIO $ HCSendFile ct fp $ Just $ W.FilePart off count
-- | Bypass remaining handler code and output the given content with a 200
-- status code.
sendResponse :: HasReps c => c -> GHandler sub master a
sendResponse = liftIO . throwIO . HCContent H.status200
. chooseRep
-- | Bypass remaining handler code and output the given content with the given
-- status code.
sendResponseStatus :: HasReps c => H.Status -> c -> GHandler s m a
sendResponseStatus s = liftIO . throwIO . HCContent s
. chooseRep
-- | Send a 201 "Created" response with the given route as the Location
-- response header.
sendResponseCreated :: Route m -> GHandler s m a
sendResponseCreated url = do
r <- getUrlRender
liftIO . throwIO $ HCCreated $ r url
-- | Send a 'W.Response'. Please note: this function is rarely
-- necessary, and will /disregard/ any changes to response headers and session
-- that you have already specified. This function short-circuits. It should be
-- considered only for very specific needs. If you are not sure if you need it,
-- you don't.
sendWaiResponse :: W.Response -> GHandler s m b
sendWaiResponse = liftIO . throwIO . HCWai
-- | Return a 404 not found page. Also denotes no handler available.
notFound :: GHandler sub master a
notFound = hcError NotFound
-- | Return a 405 method not supported page.
badMethod :: GHandler sub master a
badMethod = do
w <- waiRequest
hcError $ BadMethod $ W.requestMethod w
-- | Return a 403 permission denied page.
permissionDenied :: Text -> GHandler sub master a
permissionDenied = hcError . PermissionDenied
-- | Return a 403 permission denied page.
permissionDeniedI :: RenderMessage master msg => msg -> GHandler sub master a
permissionDeniedI msg = do
mr <- getMessageRender
permissionDenied $ mr msg
-- | Return a 400 invalid arguments page.
invalidArgs :: [Text] -> GHandler sub master a
invalidArgs = hcError . InvalidArgs
-- | Return a 400 invalid arguments page.
invalidArgsI :: RenderMessage y msg => [msg] -> GHandler s y a
invalidArgsI msg = do
mr <- getMessageRender
invalidArgs $ map mr msg
------- Headers
-- | Set the cookie on the client.
setCookie :: SetCookie
-> GHandler sub master ()
setCookie = addHeader . AddCookie
-- | Helper function for setCookieExpires value
getExpires :: Int -- ^ minutes
-> IO UTCTime
getExpires m = do
now <- liftIO getCurrentTime
return $ fromIntegral (m * 60) `addUTCTime` now
-- | Unset the cookie on the client.
--
-- Note: although the value used for key and path is 'Text', you should only
-- use ASCII values to be HTTP compliant.
deleteCookie :: Text -- ^ key
-> Text -- ^ path
-> GHandler sub master ()
deleteCookie a = addHeader . DeleteCookie (encodeUtf8 a) . encodeUtf8
-- | Set the language in the user session. Will show up in 'languages' on the
-- next request.
setLanguage :: Text -> GHandler sub master ()
setLanguage = setSession langKey
-- | Set an arbitrary response header.
--
-- Note that, while the data type used here is 'Text', you must provide only
-- ASCII value to be HTTP compliant.
setHeader :: Text -> Text -> GHandler sub master ()
setHeader a = addHeader . Header (encodeUtf8 a) . encodeUtf8
-- | Set the Cache-Control header to indicate this response should be cached
-- for the given number of seconds.
cacheSeconds :: Int -> GHandler s m ()
cacheSeconds i = setHeader "Cache-Control" $ T.concat
[ "max-age="
, T.pack $ show i
, ", public"
]
-- | Set the Expires header to some date in 2037. In other words, this content
-- is never (realistically) expired.
neverExpires :: GHandler s m ()
neverExpires = setHeader "Expires" "Thu, 31 Dec 2037 23:55:55 GMT"
-- | Set an Expires header in the past, meaning this content should not be
-- cached.
alreadyExpired :: GHandler s m ()
alreadyExpired = setHeader "Expires" "Thu, 01 Jan 1970 05:05:05 GMT"
-- | Set an Expires header to the given date.
expiresAt :: UTCTime -> GHandler s m ()
expiresAt = setHeader "Expires" . formatRFC1123
-- | Set a variable in the user's session.
--
-- The session is handled by the clientsession package: it sets an encrypted
-- and hashed cookie on the client. This ensures that all data is secure and
-- not tampered with.
setSession :: Text -- ^ key
-> Text -- ^ value
-> GHandler sub master ()
setSession k = setSessionBS k . encodeUtf8
-- | Same as 'setSession', but uses binary data for the value.
setSessionBS :: Text
-> S.ByteString
-> GHandler sub master ()
setSessionBS k = modify . modSession . Map.insert k
-- | Unsets a session variable. See 'setSession'.
deleteSession :: Text -> GHandler sub master ()
deleteSession = modify . modSession . Map.delete
modSession :: (SessionMap -> SessionMap) -> GHState -> GHState
modSession f x = x { ghsSession = f $ ghsSession x }
-- | Internal use only, not to be confused with 'setHeader'.
addHeader :: Header -> GHandler sub master ()
addHeader = tell . Endo . (:)
getStatus :: ErrorResponse -> H.Status
getStatus NotFound = H.status404
getStatus (InternalError _) = H.status500
getStatus (InvalidArgs _) = H.status400
getStatus (PermissionDenied _) = H.status403
getStatus (BadMethod _) = H.status405
-- | Some value which can be turned into a URL for redirects.
class RedirectUrl master a where
-- | Converts the value to the URL and a list of query-string parameters.
toTextUrl :: a -> GHandler sub master Text
instance RedirectUrl master Text where
toTextUrl = return
instance RedirectUrl master String where
toTextUrl = toTextUrl . T.pack
instance RedirectUrl master (Route master) where
toTextUrl url = do
r <- getUrlRender
return $ r url
instance (key ~ Text, val ~ Text) => RedirectUrl master (Route master, [(key, val)]) where
toTextUrl (url, params) = do
r <- getUrlRenderParams
return $ r url params
localNoCurrent :: GHandler s m a -> GHandler s m a
localNoCurrent =
local (\hd -> hd { handlerRoute = Nothing })
-- | Lookup for session data.
lookupSession :: Text -> GHandler s m (Maybe Text)
lookupSession = (fmap . fmap) (decodeUtf8With lenientDecode) . lookupSessionBS
-- | Lookup for session data in binary format.
lookupSessionBS :: Text -> GHandler s m (Maybe S.ByteString)
lookupSessionBS n = do
m <- liftM ghsSession get
return $ Map.lookup n m
-- | Get all session variables.
getSession :: GHandler sub master SessionMap
getSession = liftM ghsSession get
handlerToYAR :: (HasReps a, HasReps b)
=> master -- ^ master site foundation
-> sub -- ^ sub site foundation
-> (Route sub -> Route master)
-> (Route master -> [(Text, Text)] -> Text) -- route renderer
-> (ErrorResponse -> GHandler sub master a)
-> Request
-> Maybe (Route sub)
-> SessionMap
-> GHandler sub master b
-> ResourceT IO YesodAppResult
handlerToYAR y s toMasterRoute render errorHandler rr murl sessionMap h =
unYesodApp ya eh' rr types sessionMap
where
ya = runHandler h render murl toMasterRoute y s
eh' er = runHandler (errorHandler' er) render murl toMasterRoute y s
types = httpAccept $ reqWaiRequest rr
errorHandler' = localNoCurrent . errorHandler
type HeaderRenderer = [Header]
-> ContentType
-> SessionMap
-> [(CI H.Ascii, H.Ascii)]
yarToResponse :: HeaderRenderer -> YesodAppResult -> W.Response
yarToResponse _ (YARWai a) = a
yarToResponse renderHeaders (YARPlain s hs ct c sessionFinal) =
case c of
ContentBuilder b mlen ->
let hs' = maybe finalHeaders finalHeaders' mlen
in W.ResponseBuilder s hs' b
ContentFile fp p -> W.ResponseFile s finalHeaders fp p
ContentSource body -> W.ResponseSource s finalHeaders body
where
finalHeaders = renderHeaders hs ct sessionFinal
finalHeaders' len = ("Content-Length", S8.pack $ show len)
: finalHeaders
httpAccept :: W.Request -> [ContentType]
httpAccept = parseHttpAccept
. fromMaybe mempty
. lookup "Accept"
. W.requestHeaders
-- | Convert Header to a key/value pair.
headerToPair :: Header
-> (CI H.Ascii, H.Ascii)
headerToPair (AddCookie sc) =
("Set-Cookie", toByteString $ renderSetCookie $ sc)
headerToPair (DeleteCookie key path) =
( "Set-Cookie"
, S.concat
[ key
, "=; path="
, path
, "; expires=Thu, 01-Jan-1970 00:00:00 GMT"
]
)
headerToPair (Header key value) = (CI.mk key, value)
-- | Get a unique identifier.
newIdent :: GHandler sub master Text
newIdent = do
x <- get
let i' = ghsIdent x + 1
put x { ghsIdent = i' }
return $ T.pack $ 'h' : show i'
-- | Redirect to a POST resource.
--
-- This is not technically a redirect; instead, it returns an HTML page with a
-- POST form, and some Javascript to automatically submit the form. This can be
-- useful when you need to post a plain link somewhere that needs to cause
-- changes on the server.
redirectToPost :: RedirectUrl master url => url -> GHandler sub master a
redirectToPost url = do
urlText <- toTextUrl url
hamletToRepHtml
#if GHC7
[hamlet|
#else
[$hamlet|
#endif
\<!DOCTYPE html>
<html>
<head>
<title>Redirecting...
<body onload="document.getElementById('form').submit()">
<form id="form" method="post" action=#{urlText}>
<noscript>
<p>Javascript has been disabled; please click on the button below to be redirected.
<input type="submit" value="Continue">
|] >>= sendResponse
-- | Converts the given Hamlet template into 'Content', which can be used in a
-- Yesod 'Response'.
hamletToContent :: HtmlUrl (Route master) -> GHandler sub master Content
hamletToContent h = do
render <- getUrlRenderParams
return $ toContent $ h render
-- | Wraps the 'Content' generated by 'hamletToContent' in a 'RepHtml'.
hamletToRepHtml :: HtmlUrl (Route master) -> GHandler sub master RepHtml
hamletToRepHtml = liftM RepHtml . hamletToContent
-- | Get the request\'s 'W.Request' value.
waiRequest :: GHandler sub master W.Request
waiRequest = reqWaiRequest `liftM` getRequest
getMessageRender :: RenderMessage master message => GHandler s master (message -> Text)
getMessageRender = do
m <- getYesod
l <- reqLangs `liftM` getRequest
return $ renderMessage m l
cacheLookup :: CacheKey a -> GHandler sub master (Maybe a)
cacheLookup k = do
gs <- get
return $ Cache.lookup k $ ghsCache gs
cacheInsert :: CacheKey a -> a -> GHandler sub master ()
cacheInsert k v = modify $ \gs ->
gs { ghsCache = Cache.insert k v $ ghsCache gs }
cacheDelete :: CacheKey a -> GHandler sub master ()
cacheDelete k = modify $ \gs ->
gs { ghsCache = Cache.delete k $ ghsCache gs }
ask :: GHandler sub master (HandlerData sub master)
ask = GHandler return
local :: (HandlerData sub' master' -> HandlerData sub master)
-> GHandler sub master a
-> GHandler sub' master' a
local f (GHandler x) = GHandler $ \r -> x $ f r
-- | The standard @MonadTrans@ class only allows lifting for monad
-- transformers. While @GHandler@ and @GWidget@ should allow lifting, their
-- types do not express that they actually are transformers. This replacement
-- class accounts for this.
class MonadLift base m | m -> base where
lift :: base a -> m a
instance (Monad m, MonadTrans t) => MonadLift m (t m) where
lift = Control.Monad.Trans.Class.lift
instance MonadLift (ResourceT IO) (GHandler sub master) where
lift = GHandler . const
-- Instances for GHandler
instance Functor (GHandler sub master) where
fmap f (GHandler x) = GHandler $ \r -> fmap f (x r)
instance Applicative (GHandler sub master) where
pure = GHandler . const . pure
GHandler f <*> GHandler x = GHandler $ \r -> f r <*> x r
instance Monad (GHandler sub master) where
return = pure
GHandler x >>= f = GHandler $ \r -> x r >>= \x' -> unGHandler (f x') r
instance MonadIO (GHandler sub master) where
liftIO = GHandler . const . lift
instance MonadBase IO (GHandler sub master) where
liftBase = GHandler . const . lift
instance MonadBaseControl IO (GHandler sub master) where
data StM (GHandler sub master) a = StH (StM (ResourceT IO) a)
liftBaseWith f = GHandler $ \reader ->
liftBaseWith $ \runInBase ->
f $ liftM StH . runInBase . (\(GHandler r) -> r reader)
restoreM (StH base) = GHandler $ const $ restoreM base
instance Resource (GHandler sub master) where
type Base (GHandler sub master) = IO
resourceLiftBase = liftIO
resourceBracket_ a b c = control $ \run -> resourceBracket_ a b (run c)
instance ResourceUnsafeIO (GHandler sub master) where
unsafeFromIO = liftIO
instance ResourceThrow (GHandler sub master) where
resourceThrow = liftIO . throwIO
instance ResourceIO (GHandler sub master)

View File

@ -1,130 +0,0 @@
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DeriveDataTypeable #-}
-- | Normal users should never need access to these.
module Yesod.Internal
( -- * Error responses
ErrorResponse (..)
-- * Header
, Header (..)
-- * Cookie names
, langKey
-- * Widgets
, GWData (..)
, Location (..)
, UniqueList (..)
, Script (..)
, Stylesheet (..)
, Title (..)
, Head (..)
, Body (..)
, locationToHtmlUrl
, runUniqueList
, toUnique
-- * Names
, sessionName
, nonceKey
) where
import Text.Hamlet (HtmlUrl, hamlet, Html)
import Text.Julius (JavascriptUrl)
import Data.Monoid (Monoid (..), Last)
import Data.List (nub)
import Data.Text (Text)
import Data.Typeable (Typeable)
import Control.Exception (Exception)
import qualified Network.HTTP.Types as H
import Data.String (IsString)
import qualified Data.Map as Map
import Data.Text.Lazy.Builder (Builder)
import Network.HTTP.Types (Ascii)
import Web.Cookie (SetCookie (..))
#if GHC7
#define HAMLET hamlet
#else
#define HAMLET $hamlet
#endif
-- | Responses to indicate some form of an error occurred. These are different
-- from 'SpecialResponse' in that they allow for custom error pages.
data ErrorResponse =
NotFound
| InternalError Text
| InvalidArgs [Text]
| PermissionDenied Text
| BadMethod H.Method
deriving (Show, Eq, Typeable)
instance Exception ErrorResponse
----- header stuff
-- | Headers to be added to a 'Result'.
data Header =
AddCookie SetCookie
| DeleteCookie Ascii Ascii
| Header Ascii Ascii
deriving (Eq, Show)
langKey :: IsString a => a
langKey = "_LANG"
data Location url = Local url | Remote Text
deriving (Show, Eq)
locationToHtmlUrl :: Location url -> HtmlUrl url
locationToHtmlUrl (Local url) = [HAMLET|\@{url}
|]
locationToHtmlUrl (Remote s) = [HAMLET|\#{s}
|]
newtype UniqueList x = UniqueList ([x] -> [x])
instance Monoid (UniqueList x) where
mempty = UniqueList id
UniqueList x `mappend` UniqueList y = UniqueList $ x . y
runUniqueList :: Eq x => UniqueList x -> [x]
runUniqueList (UniqueList x) = nub $ x []
toUnique :: x -> UniqueList x
toUnique = UniqueList . (:)
data Script url = Script { scriptLocation :: Location url, scriptAttributes :: [(Text, Text)] }
deriving (Show, Eq)
data Stylesheet url = Stylesheet { styleLocation :: Location url, styleAttributes :: [(Text, Text)] }
deriving (Show, Eq)
newtype Title = Title { unTitle :: Html }
newtype Head url = Head (HtmlUrl url)
deriving Monoid
newtype Body url = Body (HtmlUrl url)
deriving Monoid
nonceKey :: IsString a => a
nonceKey = "_NONCE"
sessionName :: IsString a => a
sessionName = "_SESSION"
type CssBuilderUrl a = (a -> [(Text, Text)] -> Text) -> Builder
data GWData a = GWData
!(Body a)
!(Last Title)
!(UniqueList (Script a))
!(UniqueList (Stylesheet a))
!(Map.Map (Maybe Text) (CssBuilderUrl a)) -- media type
!(Maybe (JavascriptUrl a))
!(Head a)
instance Monoid (GWData a) where
mempty = GWData mempty mempty mempty mempty mempty mempty mempty
mappend (GWData a1 a2 a3 a4 a5 a6 a7)
(GWData b1 b2 b3 b4 b5 b6 b7) = GWData
(a1 `mappend` b1)
(a2 `mappend` b2)
(a3 `mappend` b3)
(a4 `mappend` b4)
(Map.unionWith mappend a5 b5)
(a6 `mappend` b6)
(a7 `mappend` b7)

View File

@ -1,38 +0,0 @@
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE TemplateHaskell #-}
module Yesod.Internal.Cache
( Cache
, CacheKey
, mkCacheKey
, lookup
, insert
, delete
) where
import Prelude hiding (lookup)
import qualified Data.IntMap as Map
import Language.Haskell.TH.Syntax (Q, Exp, runIO, Exp (LitE), Lit (IntegerL))
import Language.Haskell.TH (appE)
import Data.Unique (hashUnique, newUnique)
import GHC.Exts (Any)
import Unsafe.Coerce (unsafeCoerce)
import Data.Monoid (Monoid)
import Control.Applicative ((<$>))
newtype Cache = Cache (Map.IntMap Any)
deriving Monoid
newtype CacheKey a = CacheKey Int
-- | Generate a new 'CacheKey'. Be sure to give a full type signature.
mkCacheKey :: Q Exp
mkCacheKey = [|CacheKey|] `appE` (LitE . IntegerL . fromIntegral . hashUnique <$> runIO newUnique)
lookup :: CacheKey a -> Cache -> Maybe a
lookup (CacheKey i) (Cache m) = unsafeCoerce <$> Map.lookup i m
insert :: CacheKey a -> a -> Cache -> Cache
insert (CacheKey k) v (Cache m) = Cache (Map.insert k (unsafeCoerce v) m)
delete :: CacheKey a -> Cache -> Cache
delete (CacheKey k) (Cache m) = Cache (Map.delete k m)

View File

@ -1,674 +0,0 @@
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE TemplateHaskell #-}
-- | The basic typeclass for a Yesod application.
module Yesod.Internal.Core
( -- * Type classes
Yesod (..)
, YesodDispatch (..)
, RenderRoute (..)
-- ** Breadcrumbs
, YesodBreadcrumbs (..)
, breadcrumbs
-- * Utitlities
, maybeAuthorized
, widgetToPageContent
-- * Defaults
, defaultErrorHandler
-- * Data types
, AuthResult (..)
-- * Logging
, LogLevel (..)
, formatLogMessage
, fileLocationToString
, messageLoggerHandler
-- * Misc
, yesodVersion
, yesodRender
, resolveApproot
, Approot (..)
) where
import Yesod.Content
import Yesod.Handler hiding (lift, getExpires)
import Yesod.Routes.Class
import Control.Arrow ((***))
import Control.Monad (forM)
import Yesod.Widget
import Yesod.Request
import qualified Network.Wai as W
import Yesod.Internal
import Yesod.Internal.Session
import Yesod.Internal.Request
import Web.ClientSession (getKey, defaultKeyFile)
import qualified Web.ClientSession as CS
import qualified Data.ByteString.Char8 as S8
import qualified Data.ByteString.Lazy as L
import Data.Monoid
import Text.Hamlet
import Text.Julius
import Text.Blaze ((!), customAttribute, textTag, toValue, unsafeLazyByteString)
import qualified Text.Blaze.Html5 as TBH
import Data.Text.Lazy.Builder (toLazyText)
import Data.Text.Lazy.Encoding (encodeUtf8)
import Data.Maybe (fromMaybe)
import Control.Monad.IO.Class (MonadIO (liftIO))
import Web.Cookie (parseCookies)
import qualified Data.Map as Map
import Data.Time
import Network.HTTP.Types (encodePath)
import qualified Data.Text as T
import Data.Text (Text)
import qualified Data.Text.Encoding as TE
import qualified Data.Text.Encoding.Error as TEE
import Blaze.ByteString.Builder (Builder, toByteString)
import Blaze.ByteString.Builder.Char.Utf8 (fromText)
import Data.List (foldl')
import qualified Network.HTTP.Types as H
import Web.Cookie (SetCookie (..))
import qualified Data.Text.Lazy as TL
import qualified Data.Text.Lazy.IO
import qualified Data.Text.Lazy.Builder as TB
import Language.Haskell.TH.Syntax (Loc (..), Lift (..))
import Text.Blaze (preEscapedLazyText)
import Data.Aeson (Value (Array, String))
import Data.Aeson.Encode (encode)
import qualified Data.Vector as Vector
import Network.Wai.Middleware.Gzip (GzipSettings, def)
-- mega repo can't access this
#ifndef MEGA
import qualified Paths_yesod_core
import Data.Version (showVersion)
yesodVersion :: String
yesodVersion = showVersion Paths_yesod_core.version
#else
yesodVersion :: String
yesodVersion = "0.9.4"
#endif
#if GHC7
#define HAMLET hamlet
#else
#define HAMLET $hamlet
#endif
-- | This class is automatically instantiated when you use the template haskell
-- mkYesod function. You should never need to deal with it directly.
class YesodDispatch sub master where
yesodDispatch
:: Yesod master
=> master
-> sub
-> (Route sub -> Route master)
-> (Maybe CS.Key -> W.Application) -- ^ 404 handler
-> (Route sub -> Maybe CS.Key -> W.Application) -- ^ 405 handler
-> Text -- ^ request method
-> [Text] -- ^ pieces
-> Maybe CS.Key
-> W.Application
yesodRunner :: Yesod master
=> GHandler sub master ChooseRep
-> master
-> sub
-> Maybe (Route sub)
-> (Route sub -> Route master)
-> Maybe CS.Key
-> W.Application
yesodRunner = defaultYesodRunner
-- | How to determine the root of the application for constructing URLs.
--
-- Note that future versions of Yesod may add new constructors without bumping
-- the major version number. As a result, you should /not/ pattern match on
-- @Approot@ values.
data Approot master = ApprootRelative -- ^ No application root.
| ApprootStatic Text
| ApprootMaster (master -> Text)
| ApprootRequest (master -> W.Request -> Text)
type ResolvedApproot = Text
-- | Define settings for a Yesod applications. All methods have intelligent
-- defaults, and therefore no implementation is required.
class RenderRoute a => Yesod a where
-- | An absolute URL to the root of the application. Do not include
-- trailing slash.
--
-- Default value: 'ApprootRelative'. This is valid under the following
-- conditions:
--
-- * Your application is served from the root of the domain.
--
-- * You do not use any features that require absolute URLs, such as Atom
-- feeds and XML sitemaps.
--
-- If this is not true, you should override with a different
-- implementation.
approot :: Approot a
approot = ApprootRelative
-- | The encryption key to be used for encrypting client sessions.
-- Returning 'Nothing' disables sessions.
encryptKey :: a -> IO (Maybe CS.Key)
encryptKey _ = fmap Just $ getKey defaultKeyFile
-- | Number of minutes before a client session times out. Defaults to
-- 120 (2 hours).
clientSessionDuration :: a -> Int
clientSessionDuration = const 120
-- | Output error response pages.
errorHandler :: ErrorResponse -> GHandler sub a ChooseRep
errorHandler = defaultErrorHandler
-- | Applies some form of layout to the contents of a page.
defaultLayout :: GWidget sub a () -> GHandler sub a RepHtml
defaultLayout w = do
p <- widgetToPageContent w
mmsg <- getMessage
hamletToRepHtml [HAMLET|
!!!
<html>
<head>
<title>#{pageTitle p}
^{pageHead p}
<body>
$maybe msg <- mmsg
<p .message>#{msg}
^{pageBody p}
|]
-- | Override the rendering function for a particular URL. One use case for
-- this is to offload static hosting to a different domain name to avoid
-- sending cookies.
urlRenderOverride :: a -> Route a -> Maybe Builder
urlRenderOverride _ _ = Nothing
-- | Determine if a request is authorized or not.
--
-- Return 'Authorized' if the request is authorized,
-- 'Unauthorized' a message if unauthorized.
-- If authentication is required, return 'AuthenticationRequired'.
isAuthorized :: Route a
-> Bool -- ^ is this a write request?
-> GHandler s a AuthResult
isAuthorized _ _ = return Authorized
-- | Determines whether the current request is a write request. By default,
-- this assumes you are following RESTful principles, and determines this
-- from request method. In particular, all except the following request
-- methods are considered write: GET HEAD OPTIONS TRACE.
--
-- This function is used to determine if a request is authorized; see
-- 'isAuthorized'.
isWriteRequest :: Route a -> GHandler s a Bool
isWriteRequest _ = do
wai <- waiRequest
return $ W.requestMethod wai `notElem`
["GET", "HEAD", "OPTIONS", "TRACE"]
-- | The default route for authentication.
--
-- Used in particular by 'isAuthorized', but library users can do whatever
-- they want with it.
authRoute :: a -> Maybe (Route a)
authRoute _ = Nothing
-- | A function used to clean up path segments. It returns 'Right' with a
-- clean path or 'Left' with a new set of pieces the user should be
-- redirected to. The default implementation enforces:
--
-- * No double slashes
--
-- * There is no trailing slash.
--
-- Note that versions of Yesod prior to 0.7 used a different set of rules
-- involing trailing slashes.
cleanPath :: a -> [Text] -> Either [Text] [Text]
cleanPath _ s =
if corrected == s
then Right s
else Left corrected
where
corrected = filter (not . T.null) s
-- | Builds an absolute URL by concatenating the application root with the
-- pieces of a path and a query string, if any.
-- Note that the pieces of the path have been previously cleaned up by 'cleanPath'.
joinPath :: a
-> T.Text -- ^ application root
-> [T.Text] -- ^ path pieces
-> [(T.Text, T.Text)] -- ^ query string
-> Builder
joinPath _ ar pieces' qs' = fromText ar `mappend` encodePath pieces qs
where
pieces = if null pieces' then [""] else pieces'
qs = map (TE.encodeUtf8 *** go) qs'
go "" = Nothing
go x = Just $ TE.encodeUtf8 x
-- | This function is used to store some static content to be served as an
-- external file. The most common case of this is stashing CSS and
-- JavaScript content in an external file; the "Yesod.Widget" module uses
-- this feature.
--
-- The return value is 'Nothing' if no storing was performed; this is the
-- default implementation. A 'Just' 'Left' gives the absolute URL of the
-- file, whereas a 'Just' 'Right' gives the type-safe URL. The former is
-- necessary when you are serving the content outside the context of a
-- Yesod application, such as via memcached.
addStaticContent :: Text -- ^ filename extension
-> Text -- ^ mime-type
-> L.ByteString -- ^ content
-> GHandler sub a (Maybe (Either Text (Route a, [(Text, Text)])))
addStaticContent _ _ _ = return Nothing
{- Temporarily disabled until we have a better interface.
-- | Whether or not to tie a session to a specific IP address. Defaults to
-- 'False'.
--
-- Note: This setting has two known problems: it does not work correctly
-- when behind a reverse proxy (including load balancers), and it may not
-- function correctly if the user is behind a proxy.
sessionIpAddress :: a -> Bool
sessionIpAddress _ = False
-}
-- | The path value to set for cookies. By default, uses \"\/\", meaning
-- cookies will be sent to every page on the current domain.
cookiePath :: a -> S8.ByteString
cookiePath _ = "/"
-- | Maximum allowed length of the request body, in bytes.
maximumContentLength :: a -> Maybe (Route a) -> Int
maximumContentLength _ _ = 2 * 1024 * 1024 -- 2 megabytes
-- | Send a message to the log. By default, prints to stdout.
messageLogger :: a
-> Loc -- ^ position in source code
-> LogLevel
-> Text -- ^ message
-> IO ()
messageLogger a loc level msg =
if level < logLevel a
then return ()
else
formatLogMessage loc level msg >>=
Data.Text.Lazy.IO.putStrLn
-- | The logging level in place for this application. Any messages below
-- this level will simply be ignored.
logLevel :: a -> LogLevel
logLevel _ = LevelInfo
-- | GZIP settings.
gzipSettings :: a -> GzipSettings
gzipSettings _ = def
-- | Location of yepnope.js, if any. If one is provided, then all
-- Javascript files will be loaded asynchronously.
yepnopeJs :: a -> Maybe (Either Text (Route a))
yepnopeJs _ = Nothing
messageLoggerHandler :: Yesod m
=> Loc -> LogLevel -> Text -> GHandler s m ()
messageLoggerHandler loc level msg = do
y <- getYesod
liftIO $ messageLogger y loc level msg
data LogLevel = LevelDebug | LevelInfo | LevelWarn | LevelError | LevelOther Text
deriving (Eq, Show, Read, Ord)
instance Lift LogLevel where
lift LevelDebug = [|LevelDebug|]
lift LevelInfo = [|LevelInfo|]
lift LevelWarn = [|LevelWarn|]
lift LevelError = [|LevelError|]
lift (LevelOther x) = [|LevelOther $ T.pack $(lift $ T.unpack x)|]
formatLogMessage :: Loc
-> LogLevel
-> Text -- ^ message
-> IO TL.Text
formatLogMessage loc level msg = do
now <- getCurrentTime
return $ TB.toLazyText $
TB.fromText (T.pack $ show now)
`mappend` TB.fromText " ["
`mappend` TB.fromText (T.pack $ drop 5 $ show level)
`mappend` TB.fromText "] "
`mappend` TB.fromText msg
`mappend` TB.fromText " @("
`mappend` TB.fromText (T.pack $ fileLocationToString loc)
`mappend` TB.fromText ") "
-- taken from file-location package
-- turn the TH Loc loaction information into a human readable string
-- leaving out the loc_end parameter
fileLocationToString :: Loc -> String
fileLocationToString loc = (loc_package loc) ++ ':' : (loc_module loc) ++
' ' : (loc_filename loc) ++ ':' : (line loc) ++ ':' : (char loc)
where
line = show . fst . loc_start
char = show . snd . loc_start
defaultYesodRunner :: Yesod master
=> GHandler sub master ChooseRep
-> master
-> sub
-> Maybe (Route sub)
-> (Route sub -> Route master)
-> Maybe CS.Key
-> W.Application
defaultYesodRunner _ master _ murl toMaster _ req
| maximumContentLength master (fmap toMaster murl) < len =
return $ W.responseLBS
(H.Status 413 "Too Large")
[("Content-Type", "text/plain")]
"Request body too large to be processed."
where
len = fromMaybe 0 $ lookup "content-length" (W.requestHeaders req) >>= readMay
readMay s =
case reads $ S8.unpack s of
[] -> Nothing
(x, _):_ -> Just x
defaultYesodRunner handler master sub murl toMasterRoute mkey req = do
now <- {-# SCC "getCurrentTime" #-} liftIO getCurrentTime
let getExpires m = {-# SCC "getExpires" #-} fromIntegral (m * 60) `addUTCTime` now
let exp' = {-# SCC "exp'" #-} getExpires $ clientSessionDuration master
--let rh = {-# SCC "rh" #-} takeWhile (/= ':') $ show $ W.remoteHost req
let host = "" -- FIXME if sessionIpAddress master then S8.pack rh else ""
let session' = {-# SCC "session'" #-}
case mkey of
Nothing -> []
Just key -> fromMaybe [] $ do
raw <- lookup "Cookie" $ W.requestHeaders req
val <- lookup sessionName $ parseCookies raw
decodeSession key now host val
rr <- liftIO $ parseWaiRequest req session' mkey
let h = {-# SCC "h" #-} do
case murl of
Nothing -> handler
Just url -> do
isWrite <- isWriteRequest $ toMasterRoute url
ar <- isAuthorized (toMasterRoute url) isWrite
case ar of
Authorized -> return ()
AuthenticationRequired ->
case authRoute master of
Nothing ->
permissionDenied "Authentication required"
Just url' -> do
setUltDestCurrent
redirect url'
Unauthorized s' -> permissionDenied s'
handler
let sessionMap = Map.fromList
$ filter (\(x, _) -> x /= nonceKey) session'
let ra = resolveApproot master req
yar <- handlerToYAR master sub toMasterRoute (yesodRender master ra) errorHandler rr murl sessionMap h
let mnonce = reqNonce rr
-- FIXME should we be caching this IV value and reusing it for efficiency?
iv <- {-# SCC "iv" #-} maybe (return $ error "Should not be used") (const $ liftIO CS.randomIV) mkey
return $ yarToResponse (hr iv mnonce getExpires host exp') yar
where
hr iv mnonce getExpires host exp' hs ct sm =
hs'''
where
sessionVal =
case (mkey, mnonce) of
(Just key, Just nonce)
-> encodeSession key iv exp' host
$ Map.toList
$ Map.insert nonceKey (TE.encodeUtf8 nonce) sm
_ -> mempty
hs' =
case mkey of
Nothing -> hs
Just _ -> AddCookie def
{ setCookieName = sessionName
, setCookieValue = sessionVal
, setCookiePath = Just (cookiePath master)
, setCookieExpires = Just $ getExpires (clientSessionDuration master)
, setCookieDomain = Nothing
, setCookieHttpOnly = True
}
: hs
hs'' = map headerToPair hs'
hs''' = ("Content-Type", ct) : hs''
data AuthResult = Authorized | AuthenticationRequired | Unauthorized Text
deriving (Eq, Show, Read)
-- | A type-safe, concise method of creating breadcrumbs for pages. For each
-- resource, you declare the title of the page and the parent resource (if
-- present).
class YesodBreadcrumbs y where
-- | Returns the title and the parent resource, if available. If you return
-- a 'Nothing', then this is considered a top-level page.
breadcrumb :: Route y -> GHandler sub y (Text , Maybe (Route y))
-- | Gets the title of the current page and the hierarchy of parent pages,
-- along with their respective titles.
breadcrumbs :: YesodBreadcrumbs y => GHandler sub y (Text, [(Route y, Text)])
breadcrumbs = do
x' <- getCurrentRoute
tm <- getRouteToMaster
let x = fmap tm x'
case x of
Nothing -> return ("Not found", [])
Just y -> do
(title, next) <- breadcrumb y
z <- go [] next
return (title, z)
where
go back Nothing = return back
go back (Just this) = do
(title, next) <- breadcrumb this
go ((this, title) : back) next
applyLayout' :: Yesod master
=> Html -- ^ title
-> HtmlUrl (Route master) -- ^ body
-> GHandler sub master ChooseRep
applyLayout' title body = fmap chooseRep $ defaultLayout $ do
setTitle title
addHamlet body
-- | The default error handler for 'errorHandler'.
defaultErrorHandler :: Yesod y => ErrorResponse -> GHandler sub y ChooseRep
defaultErrorHandler NotFound = do
r <- waiRequest
let path' = TE.decodeUtf8With TEE.lenientDecode $ W.rawPathInfo r
applyLayout' "Not Found"
[HAMLET|
<h1>Not Found
<p>#{path'}
|]
defaultErrorHandler (PermissionDenied msg) =
applyLayout' "Permission Denied"
[HAMLET|
<h1>Permission denied
<p>#{msg}
|]
defaultErrorHandler (InvalidArgs ia) =
applyLayout' "Invalid Arguments"
[HAMLET|
<h1>Invalid Arguments
<ul>
$forall msg <- ia
<li>#{msg}
|]
defaultErrorHandler (InternalError e) =
applyLayout' "Internal Server Error"
[HAMLET|
<h1>Internal Server Error
<p>#{e}
|]
defaultErrorHandler (BadMethod m) =
applyLayout' "Bad Method"
[HAMLET|
<h1>Method Not Supported
<p>Method "#{S8.unpack m}" not supported
|]
-- | Return the same URL if the user is authorized to see it.
--
-- Built on top of 'isAuthorized'. This is useful for building page that only
-- contain links to pages the user is allowed to see.
maybeAuthorized :: Yesod a
=> Route a
-> Bool -- ^ is this a write request?
-> GHandler s a (Maybe (Route a))
maybeAuthorized r isWrite = do
x <- isAuthorized r isWrite
return $ if x == Authorized then Just r else Nothing
jsToHtml :: Javascript -> Html
jsToHtml (Javascript b) = preEscapedLazyText $ toLazyText b
jelper :: JavascriptUrl url -> HtmlUrl url
jelper = fmap jsToHtml
-- | Convert a widget to a 'PageContent'.
widgetToPageContent :: (Eq (Route master), Yesod master)
=> GWidget sub master ()
-> GHandler sub master (PageContent (Route master))
widgetToPageContent w = do
master <- getYesod
((), GWData (Body body) (Last mTitle) scripts' stylesheets' style jscript (Head head')) <- unGWidget w
let title = maybe mempty unTitle mTitle
scripts = runUniqueList scripts'
stylesheets = runUniqueList stylesheets'
render <- getUrlRenderParams
let renderLoc x =
case x of
Nothing -> Nothing
Just (Left s) -> Just s
Just (Right (u, p)) -> Just $ render u p
css <- forM (Map.toList style) $ \(mmedia, content) -> do
let rendered = toLazyText $ content render
x <- addStaticContent "css" "text/css; charset=utf-8"
$ encodeUtf8 rendered
return (mmedia,
case x of
Nothing -> Left $ preEscapedLazyText rendered
Just y -> Right $ either id (uncurry render) y)
jsLoc <-
case jscript of
Nothing -> return Nothing
Just s -> do
x <- addStaticContent "js" "text/javascript; charset=utf-8"
$ encodeUtf8 $ renderJavascriptUrl render s
return $ renderLoc x
-- modernizr should be at the end of the <head> http://www.modernizr.com/docs/#installing
-- the asynchronous loader means your page doesn't have to wait for all the js to load
let (mcomplete, ynscripts) = ynHelper render scripts jscript jsLoc
headAll = [HAMLET|
\^{head'}
$forall s <- stylesheets
^{mkLinkTag s}
$forall s <- css
$maybe t <- right $ snd s
$maybe media <- fst s
<link rel=stylesheet media=#{media} href=#{t}
$nothing
<link rel=stylesheet href=#{t}
$maybe content <- left $ snd s
$maybe media <- fst s
<style media=#{media}>#{content}
$nothing
<style>#{content}
$maybe eyn <- yepnopeJs master
$maybe yn <- left eyn
<script src=#{yn}>
$maybe yn <- right eyn
<script src=@{yn}>
$maybe complete <- mcomplete
<script>yepnope({load:#{ynscripts},complete:function(){^{complete}}})
$nothing
<script>yepnope({load:#{ynscripts}})
$nothing
$forall s <- scripts
^{mkScriptTag s}
$maybe j <- jscript
$maybe s <- jsLoc
<script src="#{s}">
$nothing
<script>^{jelper j}
|]
return $ PageContent title headAll body
where
left (Left x) = Just x
left _ = Nothing
right (Right x) = Just x
right _ = Nothing
renderLoc' render' (Local url) = render' url []
renderLoc' _ (Remote s) = s
addAttr x (y, z) = x ! customAttribute (textTag y) (toValue z)
mkScriptTag (Script loc attrs) render' =
foldl' addAttr TBH.script (("src", renderLoc' render' loc) : attrs) $ return ()
mkLinkTag (Stylesheet loc attrs) render' =
foldl' addAttr TBH.link
( ("rel", "stylesheet")
: ("href", renderLoc' render' loc)
: attrs
)
ynHelper :: (url -> [x] -> Text)
-> [Script (url)]
-> Maybe (JavascriptUrl (url))
-> Maybe Text
-> (Maybe (HtmlUrl (url)), Html)
ynHelper render scripts jscript jsLoc =
(mcomplete, unsafeLazyByteString $ encode $ Array $ Vector.fromList $ map String scripts'')
where
scripts' = map goScript scripts
scripts'' =
case jsLoc of
Just s -> scripts' ++ [s]
Nothing -> scripts'
goScript (Script (Local url) _) = render url []
goScript (Script (Remote s) _) = s
mcomplete =
case jsLoc of
Just{} -> Nothing
Nothing ->
case jscript of
Nothing -> Nothing
Just j -> Just $ jelper j
yesodRender :: Yesod y
=> y
-> ResolvedApproot
-> Route y
-> [(Text, Text)] -- ^ url query string
-> Text
yesodRender y ar url params =
TE.decodeUtf8 $ toByteString $
fromMaybe
(joinPath y ar ps
$ params ++ params')
(urlRenderOverride y url)
where
(ps, params') = renderRoute url
resolveApproot :: Yesod master => master -> W.Request -> ResolvedApproot
resolveApproot master req =
case approot of
ApprootRelative -> ""
ApprootStatic t -> t
ApprootMaster f -> f master
ApprootRequest f -> f master req

View File

@ -1,117 +0,0 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE CPP #-}
module Yesod.Internal.Request
( parseWaiRequest
, Request (..)
, RequestBodyContents
, FileInfo (..)
-- The below are exported for testing.
, randomString
, parseWaiRequest'
) where
import Control.Applicative ((<$>))
import Control.Arrow (second)
import qualified Network.Wai.Parse as NWP
import Yesod.Internal
import qualified Network.Wai as W
import System.Random (RandomGen, newStdGen, randomRs)
import Web.Cookie (parseCookiesText)
import Data.ByteString (ByteString)
import qualified Data.ByteString.Char8 as S8
import Data.Text (Text, pack)
import Network.HTTP.Types (queryToQueryText)
import Control.Monad (join)
import Data.Maybe (fromMaybe, catMaybes)
import qualified Data.ByteString.Lazy as L
import qualified Data.Set as Set
import qualified Data.Text as T
import Data.Text.Encoding (decodeUtf8With)
import Data.Text.Encoding.Error (lenientDecode)
-- | The parsed request information.
data Request = Request
{ reqGetParams :: [(Text, Text)]
, reqCookies :: [(Text, Text)]
, reqWaiRequest :: W.Request
-- | Languages which the client supports.
, reqLangs :: [Text]
-- | A random, session-specific nonce used to prevent CSRF attacks.
, reqNonce :: Maybe Text
}
parseWaiRequest :: W.Request
-> [(Text, ByteString)] -- ^ session
-> Maybe a
-> IO Request
parseWaiRequest env session' key' = parseWaiRequest' env session' key' <$> newStdGen
parseWaiRequest' :: RandomGen g
=> W.Request
-> [(Text, ByteString)] -- ^ session
-> Maybe a
-> g
-> Request
parseWaiRequest' env session' key' gen = Request gets'' cookies' env langs'' nonce
where
gets' = queryToQueryText $ W.queryString env
gets'' = map (second $ fromMaybe "") gets'
reqCookie = lookup "Cookie" $ W.requestHeaders env
cookies' = maybe [] parseCookiesText reqCookie
acceptLang = lookup "Accept-Language" $ W.requestHeaders env
langs = map (pack . S8.unpack) $ maybe [] NWP.parseHttpAccept acceptLang
lookupText k = fmap (decodeUtf8With lenientDecode) . lookup k
-- The language preferences are prioritized as follows:
langs' = catMaybes [ join $ lookup langKey gets' -- Query _LANG
, lookup langKey cookies' -- Cookie _LANG
, lookupText langKey session' -- Session _LANG
] ++ langs -- Accept-Language(s)
-- Github issue #195. We want to add an extra two-letter version of any
-- language in the list.
langs'' = addTwoLetters (id, Set.empty) langs'
-- If sessions are disabled nonces should not be used (any
-- nonceKey present in the session is ignored). If sessions
-- are enabled and a session has no nonceKey a new one is
-- generated.
nonce = case (key', lookup nonceKey session') of
(Nothing, _) -> Nothing
(_, Just x) -> Just $ decodeUtf8With lenientDecode x
_ -> Just $ pack $ randomString 10 gen
addTwoLetters :: ([Text] -> [Text], Set.Set Text) -> [Text] -> [Text]
addTwoLetters (toAdd, exist) [] =
filter (flip Set.notMember exist) $ toAdd []
addTwoLetters (toAdd, exist) (l:ls) =
l : addTwoLetters (toAdd', exist') ls
where
(toAdd', exist')
| T.length l > 2 = (toAdd . (T.take 2 l:), exist)
| otherwise = (toAdd, Set.insert l exist)
-- | Generate a random String of alphanumerical characters
-- (a-z, A-Z, and 0-9) of the given length using the given
-- random number generator.
randomString :: RandomGen g => Int -> g -> String
randomString len = take len . map toChar . randomRs (0, 61)
where
toChar i
| i < 26 = toEnum $ i + fromEnum 'A'
| i < 52 = toEnum $ i + fromEnum 'a' - 26
| otherwise = toEnum $ i + fromEnum '0' - 52
-- | A tuple containing both the POST parameters and submitted files.
type RequestBodyContents =
( [(Text, Text)]
, [(Text, FileInfo)]
)
data FileInfo = FileInfo
{ fileName :: Text
, fileContentType :: Text
, fileContent :: L.ByteString
}
deriving (Eq, Show)

View File

@ -1,57 +0,0 @@
module Yesod.Internal.Session
( encodeSession
, decodeSession
) where
import qualified Web.ClientSession as CS
import Data.Serialize
import Data.Time
import Data.ByteString (ByteString)
import Control.Monad (guard)
import Data.Text (Text, pack, unpack)
import Control.Arrow (first)
import Control.Applicative ((<$>))
encodeSession :: CS.Key
-> CS.IV
-> UTCTime -- ^ expire time
-> ByteString -- ^ remote host
-> [(Text, ByteString)] -- ^ session
-> ByteString -- ^ cookie value
encodeSession key iv expire rhost session' =
CS.encrypt key iv $ encode $ SessionCookie expire rhost session'
decodeSession :: CS.Key
-> UTCTime -- ^ current time
-> ByteString -- ^ remote host field
-> ByteString -- ^ cookie value
-> Maybe [(Text, ByteString)]
decodeSession key now rhost encrypted = do
decrypted <- CS.decrypt key encrypted
SessionCookie expire rhost' session' <-
either (const Nothing) Just $ decode decrypted
guard $ expire > now
guard $ rhost' == rhost
return session'
data SessionCookie = SessionCookie UTCTime ByteString [(Text, ByteString)]
deriving (Show, Read)
instance Serialize SessionCookie where
put (SessionCookie a b c) = putTime a >> put b >> put (map (first unpack) c)
get = do
a <- getTime
b <- get
c <- map (first pack) <$> get
return $ SessionCookie a b c
putTime :: Putter UTCTime
putTime t@(UTCTime d _) = do
put $ toModifiedJulianDay d
let ndt = diffUTCTime t $ UTCTime d 0
put $ toRational ndt
getTime :: Get UTCTime
getTime = do
d <- get
ndt <- get
return $ fromRational ndt `addUTCTime` UTCTime (ModifiedJulianDay d) 0

View File

@ -1,11 +0,0 @@
--
-- | WARNING: This module exposes internal interfaces solely for the
-- purpose of facilitating cabal-driven testing of said interfaces.
-- This module is NOT part of the public Yesod API and should NOT be
-- imported by library users.
--
module Yesod.Internal.TestApi
( randomString, parseWaiRequest'
) where
import Yesod.Internal.Request (randomString, parseWaiRequest')

View File

@ -1,138 +0,0 @@
{-# LANGUAGE BangPatterns #-}
module Yesod.Logger
( Logger
, handle
, developmentLogger, productionLogger
, defaultDevelopmentLogger, defaultProductionLogger
, toProduction
, flushLogger
, logText
, logLazyText
, logString
, logBS
, logMsg
, formatLogText
, timed
-- * Deprecated
, makeLoggerWithHandle
, makeDefaultLogger
) where
import System.IO (Handle, stdout, hFlush)
import Data.ByteString (ByteString)
import Data.ByteString.Char8 (pack)
import Data.ByteString.Lazy (toChunks)
import qualified Data.Text.Lazy as TL
import Data.Text (Text)
import Data.Text.Encoding (encodeUtf8)
import qualified Data.Text.Lazy.Encoding as TLE
import System.Log.FastLogger
import Network.Wai.Logger.Date (DateRef, dateInit, getDate)
-- for timed logging
import Data.Time (getCurrentTime, diffUTCTime)
import Control.Monad.IO.Class (MonadIO, liftIO)
import Text.Printf (printf)
import Data.Text (unpack)
-- for formatter
import Language.Haskell.TH.Syntax (Loc)
import Yesod.Core (LogLevel, fileLocationToString)
data Logger = Logger {
loggerLogFun :: [LogStr] -> IO ()
, loggerHandle :: Handle
, loggerDateRef :: DateRef
}
handle :: Logger -> Handle
handle = loggerHandle
flushLogger :: Logger -> IO ()
flushLogger = hFlush . loggerHandle
makeDefaultLogger :: IO Logger
makeDefaultLogger = defaultDevelopmentLogger
{-# DEPRECATED makeDefaultLogger "Use defaultProductionLogger or defaultDevelopmentLogger instead" #-}
makeLoggerWithHandle, developmentLogger, productionLogger :: Handle -> IO Logger
makeLoggerWithHandle = productionLogger
{-# DEPRECATED makeLoggerWithHandle "Use productionLogger or developmentLogger instead" #-}
-- | uses stdout handle
defaultProductionLogger, defaultDevelopmentLogger :: IO Logger
defaultProductionLogger = productionLogger stdout
defaultDevelopmentLogger = developmentLogger stdout
productionLogger h = mkLogger h (handleToLogFun h)
-- | a development logger gets automatically flushed
developmentLogger h = mkLogger h (\bs -> (handleToLogFun h) bs >> hFlush h)
mkLogger :: Handle -> ([LogStr] -> IO ()) -> IO Logger
mkLogger h logFun = do
initHandle h
dateInit >>= return . Logger logFun h
-- convert (a development) logger to production settings
toProduction :: Logger -> Logger
toProduction (Logger _ h d) = Logger (handleToLogFun h) h d
handleToLogFun :: Handle -> ([LogStr] -> IO ())
handleToLogFun = hPutLogStr
logMsg :: Logger -> [LogStr] -> IO ()
logMsg = hPutLogStr . handle
logLazyText :: Logger -> TL.Text -> IO ()
logLazyText logger msg = loggerLogFun logger $
map LB (toChunks $ TLE.encodeUtf8 msg) ++ [newLine]
logText :: Logger -> Text -> IO ()
logText logger = logBS logger . encodeUtf8
logBS :: Logger -> ByteString -> IO ()
logBS logger msg = loggerLogFun logger $ [LB msg, newLine]
logString :: Logger -> String -> IO ()
logString logger msg = loggerLogFun logger $ [LS msg, newLine]
formatLogText :: Logger -> Loc -> LogLevel -> Text -> IO [LogStr]
formatLogText logger loc level msg = formatLogMsg logger loc level (toLB msg)
toLB :: Text -> LogStr
toLB = LB . encodeUtf8
formatLogMsg :: Logger -> Loc -> LogLevel -> LogStr -> IO [LogStr]
formatLogMsg logger loc level msg = do
date <- liftIO $ getDate $ loggerDateRef logger
return
[ LB date
, LB $ pack" ["
, LS (drop 5 $ show level)
, LB $ pack "] "
, msg
, LB $ pack " @("
, LS (fileLocationToString loc)
, LB $ pack ") "
]
newLine :: LogStr
newLine = LB $ pack "\n"
-- | Execute a monadic action and log the duration
--
timed :: MonadIO m
=> Logger -- ^ Logger
-> Text -- ^ Message
-> m a -- ^ Action
-> m a -- ^ Timed and logged action
timed logger msg action = do
start <- liftIO getCurrentTime
!result <- action
stop <- liftIO getCurrentTime
let diff = fromEnum $ diffUTCTime stop start
ms = diff `div` 10 ^ (9 :: Int)
formatted = printf " [%4dms] %s" ms (unpack msg)
liftIO $ logString logger formatted
return result

View File

@ -1,6 +0,0 @@
-- | This module has moved to "Text.Shakespeare.I18N"
module Yesod.Message
( module Text.Shakespeare.I18N
) where
import Text.Shakespeare.I18N

Some files were not shown because too many files have changed in this diff Show More