Permalink
Browse files

Fixed a problem with AJAX requests that required authentication. The

requests were POSTs when they didn't need to be, thus breaking redirection,
but the onNotAuthenticated() was also not reconstituting the original URI
correctly - the query parameters were being left off.
  • Loading branch information...
1 parent 21a36b2 commit 3f5d1f0eb308c146c037395b24c522f2a93ffbbe @pledbrook pledbrook committed Oct 23, 2010
View
12 grails.org/grails-app/conf/org/grails/auth/JSecurityAuthFilters.groovy
@@ -15,19 +15,19 @@ class JSecurityAuthFilters {
* page.
*/
def onNotAuthenticated(subject, d) {
+ def targetUri = d.request.forwardURI
+ if (d.request.queryString) {
+ targetUri = "${targetUri}?${d.request.queryString}"
+ }
+
if (d.request.xhr) {
- d.render(template:"/user/loginForm", model:[originalURI:d.request.forwardURI,
+ d.render(template:"/user/loginForm", model:[originalURI:targetUri,
formData:d.params,
async:true,
update:d.params.update,
message:"auth.not.logged.in"])
} else {
// Redirect to login page.
- def targetUri = d.request.forwardURI
- if (d.request.queryString) {
- targetUri = "${targetUri}?${d.request.queryString}"
- }
-
d.redirect(
controller: 'user',
action: 'login',
View
2 grails.org/grails-app/views/content/_editActions.gsp
@@ -31,7 +31,7 @@
</g:remoteLink>
</li>
<li>
- <g:remoteLink class="actionIcon" action="infoWikiPage" id="${content?.title}" update="${updateElement}" params="[update: updateElement]" onLoaded="showCommentPost()">
+ <g:remoteLink class="actionIcon" action="infoWikiPage" id="${content?.title}" update="${updateElement}" params="[update: updateElement]" method="GET" onLoaded="showCommentPost()">
<img border="0" src="${createLinkTo(dir: 'images/', 'icon-info.png')}" width="15" height="15" alt="Icon Edit" class="inlineIcon" border="0"/>
<span>View Info</span>
</g:remoteLink>
View
4 grails.org/grails-app/views/content/_viewActions.gsp
@@ -7,14 +7,14 @@
</g:if>
<g:else>
<li>
- <g:remoteLink class="actionIcon" controller="content" action="editWikiPage" id="${content?.title}" params="[update: updateElement, editFormName:editFormName]" update="${updateElement}" onLoaded="hideCommentPost()">
+ <g:remoteLink class="actionIcon" controller="content" action="editWikiPage" id="${content?.title}" params="[update: updateElement, editFormName:editFormName]" update="${updateElement}" method="GET" onLoaded="hideCommentPost()">
<img border="0" src="${resource(dir: 'images/', 'icon-edit.png')}" width="15" height="15" alt="Icon Edit" class="inlineIcon" border="0"/>
<span>Edit</span>
</g:remoteLink>
</li>
</g:else>
<li>
- <g:remoteLink class="actionIcon" controller="content" action="infoWikiPage" id="${content?.title}" update="${updateElement}" params="[update: updateElement]">
+ <g:remoteLink class="actionIcon" controller="content" action="infoWikiPage" id="${content?.title}" update="${updateElement}" params="[update: updateElement]" method="GET">
<img border="0" src="${resource(dir: 'images/', 'icon-info.png')}" width="15" height="15" alt="Icon Edit" class="inlineIcon" border="0"/>
<span>View Info</span>
</g:remoteLink>

0 comments on commit 3f5d1f0

Please sign in to comment.