Add _token parameter to redirectToPost #1151

This commit is contained in:
Michael Snoyman 2016-01-24 14:37:44 +02:00
parent be9d0a281d
commit cf5a390cad
3 changed files with 8 additions and 1 deletions

View File

@ -1,3 +1,7 @@
## 1.4.19
* Auth logout not working with defaultCsrfMiddleware [#1151](https://github.com/yesodweb/yesod/issues/1151)
## 1.4.18.2 ## 1.4.18.2
* Allow subsites within hierarchical routes [#1144](https://github.com/yesodweb/yesod/pull/1144) * Allow subsites within hierarchical routes [#1144](https://github.com/yesodweb/yesod/pull/1144)

View File

@ -890,6 +890,7 @@ redirectToPost :: (MonadHandler m, RedirectUrl (HandlerSite m) url)
-> m a -> m a
redirectToPost url = do redirectToPost url = do
urlText <- toTextUrl url urlText <- toTextUrl url
req <- getRequest
withUrlRenderer [hamlet| withUrlRenderer [hamlet|
$newline never $newline never
$doctype 5 $doctype 5
@ -899,6 +900,8 @@ $doctype 5
<title>Redirecting... <title>Redirecting...
<body onload="document.getElementById('form').submit()"> <body onload="document.getElementById('form').submit()">
<form id="form" method="post" action=#{urlText}> <form id="form" method="post" action=#{urlText}>
$maybe token <- reqToken req
<input type=hidden name=#{defaultCsrfParamName} value=#{token}>
<noscript> <noscript>
<p>Javascript has been disabled; please click on the button below to be redirected. <p>Javascript has been disabled; please click on the button below to be redirected.
<input type="submit" value="Continue"> <input type="submit" value="Continue">

View File

@ -1,5 +1,5 @@
name: yesod-core name: yesod-core
version: 1.4.18.2 version: 1.4.19
license: MIT license: MIT
license-file: LICENSE license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com> author: Michael Snoyman <michael@snoyman.com>