Skip to content

Commit

Permalink
Merge pull request #1620 from jezen/master
Browse files Browse the repository at this point in the history
Move JavaScript form submission to script block
  • Loading branch information
snoyberg committed Aug 20, 2019
2 parents d8ebb95 + d385ada commit 56e8557
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions yesod-core/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# ChangeLog for yesod-core

## 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)
Expand Down
4 changes: 3 additions & 1 deletion yesod-core/src/Yesod/Core/Handler.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1069,13 +1069,15 @@ $doctype 5
<html>
<head>
<title>Redirecting...
<body onload="document.getElementById('form').submit()">
<body>
<form id="form" method="post" action=#{urlText}>
$maybe token <- reqToken req
<input type=hidden name=#{defaultCsrfParamName} value=#{token}>
<noscript>
<p>Javascript has been disabled; please click on the button below to be redirected.
<input type="submit" value="Continue">
<script>
window.onload = function() { document.getElementById('form').submit(); };
|] >>= sendResponse

-- | Wraps the 'Content' generated by 'hamletToContent' in a 'RepHtml'.
Expand Down
2 changes: 1 addition & 1 deletion yesod-core/yesod-core.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: yesod-core
version: 1.6.14
version: 1.6.15
license: MIT
license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com>
Expand Down

0 comments on commit 56e8557

Please sign in to comment.