Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Rename originalURI parameter to targetUri for consistency with Shiro …

…plugin.
  • Loading branch information...
commit 5057c826fea90407c6dccf04cf71de8cf1cb3685 1 parent d697503
@pledbrook pledbrook authored
View
4 grails-app/conf/org/grails/auth/JSecurityAuthFilters.groovy
@@ -21,7 +21,7 @@ class JSecurityAuthFilters {
}
if (d.request.xhr) {
- d.render(template:"/user/loginForm", model:[originalURI:targetUri,
+ d.render(template:"/user/loginForm", model:[targetUri:targetUri,
formData:d.params,
async:true,
update:d.params._ul,
@@ -34,7 +34,7 @@ class JSecurityAuthFilters {
d.redirect(
controller: 'user',
action: 'login',
- params:[originalURI: targetUri])
+ params:[targetUri: targetUri])
}
}
View
14 grails-app/controllers/org/grails/auth/UserController.groovy
@@ -101,7 +101,7 @@ class UserController {
}
def register(){
- def renderParams = [ model:[originalURI:params.originalURI, async:request.xhr] ]
+ def renderParams = [ model:[targetUri:params.targetUri, async:request.xhr] ]
if(request.xhr)
renderParams.template = "registerForm"
@@ -142,9 +142,9 @@ class UserController {
def authToken = new UsernamePasswordToken(user.login, params.password)
SecurityUtils.subject.login(authToken)
- if(params.originalURI) {
+ if(params.targetUri) {
- redirect(url:params.originalURI, params:params)
+ redirect(url:params.targetUri, params:params)
}
else {
redirect(uri:"/")
@@ -223,7 +223,7 @@ class UserController {
// If a controller redirected to this page, redirect back
// to it. Otherwise redirect to the root URI.
- def targetUri = params.originalURI ?: "/"
+ def targetUri = params.targetUri ?: "/"
// Handle requests saved by Shiro filters.
def savedRequest = WebUtils.getSavedRequest(request)
@@ -241,18 +241,18 @@ class UserController {
log.info "Authentication failure for user '${params.username}'."
if(request.xhr) {
params.remove 'password'
- render(template:"loginForm", model:[originalURI:params.remove('originalURI'),
+ render(template:"loginForm", model:[targetUri:params.remove('targetUri'),
update: params._ul,
async:true,
message:"auth.invalid.login"])
} else {
flash.message = "Invalid username and/or password"
- redirect(action: 'login', params: [ username: params.username, originalURI:params.originalURI ])
+ redirect(action: 'login', params: [ username: params.username, targetUri:params.targetUri ])
}
}
} else {
- render(view:"login", model: [originalURI:params.originalURI])
+ render(view:"login", model: [targetUri:params.targetUri])
}
}
View
2  grails-app/views/comments/_comments.gsp
@@ -109,7 +109,7 @@ comments = comments ? transform(comments, 5) : []
</g:if>
<g:else>
Login to leave a comment:
- <g:render template='../user/loginForm' var='originalURI' bean="${request.forwardURI}"/>
+ <g:render template='../user/loginForm' var='targetUri' bean="${request.forwardURI}"/>
</g:else>
</g:if>
<g:else>
View
2  grails-app/views/plugin/_tags.gsp
@@ -16,7 +16,7 @@
YAHOO.util.Event.onDOMReady(function() {
// on show, put the dialog in the right place
YAHOO.util.Event.on("remove_${tag?.encodeAsJavaScript()}_tag_from_${plugin.id}", 'click', function() {
- window.location = "${createLink(controller:'user', action:'login', params:[originalURI:request.forwardURI])}";
+ window.location = "${createLink(controller:'user', action:'login', params:[targetUri:request.forwardURI])}";
});
});
</script>
View
8 grails-app/views/plugin/showPlugin.gsp
@@ -32,7 +32,7 @@
</shiro:isLoggedIn>
<shiro:isNotLoggedIn>
<div id="ratingDisplay">
- <rateable:ratings bean="${plugin}" active="false" href="${createLink(controller:'user', action:'login', params:[originalURI:request.forwardURI])}"/>
+ <rateable:ratings bean="${plugin}" active="false" href="${createLink(controller:'user', action:'login', params:[targetUri:request.forwardURI])}"/>
</div>
</shiro:isNotLoggedIn>
</div>
@@ -154,13 +154,13 @@
YAHOO.util.Event.onDOMReady(function() {
// on show, put the dialog in the right place
YAHOO.util.Event.on('addTagTrigger', 'click', function() {
- window.location = "${createLink(controller:'user', action:'login', params:[originalURI:request.forwardURI])}";
+ window.location = "${createLink(controller:'user', action:'login', params:[targetUri:request.forwardURI])}";
});
- // also hang up rating click if not logged in, redirect to login page with originalURI of this page
+ // also hang up rating click if not logged in, redirect to login page with targetUri of this page
// for redirect
YAHOO.util.Event.on('ratingdiv', 'click', function(e) {
YAHOO.util.Event.stopEvent(e);
- window.location = "${createLink(controller:'user', action:'login', params:[originalURI:request.forwardURI])}";
+ window.location = "${createLink(controller:'user', action:'login', params:[targetUri:request.forwardURI])}";
});
});
</script>
View
4 grails-app/views/user/_loginForm.gsp
@@ -17,7 +17,7 @@
</p>
</div>
- <g:hiddenField name="originalURI" value="${originalURI ?: formData?.originalURI}" />
+ <g:hiddenField name="targetUri" value="${targetUri ?: formData?.targetUri}" />
<g:each in="${formData}" var="d">
<g:if test="${!(d.value instanceof Map) && !(d.key in paramExclusions)}">
<g:hiddenField name="${d.key}" value="${d.value}" />
@@ -47,7 +47,7 @@
<div>
<g:set var="registerLink">
- <g:if test="${true == async}"><g:remoteLink update="${updateElement}" controller="user" action="register" params="[originalURI: originalURI]" method="GET">click here</g:remoteLink></g:if>
+ <g:if test="${true == async}"><g:remoteLink update="${updateElement}" controller="user" action="register" params="[targetUri: targetUri]" method="GET">click here</g:remoteLink></g:if>
<g:else><g:link controller="user" action="register">click here</g:link></g:else>
</g:set>
If you do not have an account ${registerLink} to register. Or have you <g:link controller="user" action="passwordReminder">forgotten your password?</g:link>
View
2  grails-app/views/user/_profileBox.gsp
@@ -2,5 +2,5 @@
<div id="statusbox">Welcome <strong><shiro:principal type="${String}"/></strong><br/><g:link controller="user" action="profile">Profile</g:link> | <g:link controller="user" action="logout">Logout</g:link></div>
</shiro:isLoggedIn>
<shiro:isNotLoggedIn>
- <div id="statusbox"><a href="/login?originalURI=${request.forwardURI.encodeAsURL()}">Sign in</a> to edit and +1 items.</div>
+ <div id="statusbox"><a href="/login?targetUri=${request.forwardURI.encodeAsURL()}">Sign in</a> to edit and +1 items.</div>
</shiro:isNotLoggedIn>
View
2  grails-app/views/user/_registerForm.gsp
@@ -27,7 +27,7 @@
</div>
- <g:hiddenField name="originalURI" value="${originalURI}" />
+ <g:hiddenField name="targetUri" value="${targetUri}" />
<div class="formButtons" style="margin-top:100px;">
<g:submitButton name="Submit" value="Register" />
View
30 test/unit/org/grails/auth/UserControllerTests.groovy
@@ -35,20 +35,20 @@ import javax.servlet.http.HttpServletRequest
class UserControllerTests {
void testRegisterGET() {
- params.originalURI = "/foo/bar"
+ params.targetUri = "/foo/bar"
params.more = "stuff"
controller.register()
assert view == "/user/register"
- assert model.originalURI == "/foo/bar"
+ assert model.targetUri == "/foo/bar"
assert model.formData == params
}
void testRegisterUserExists() {
def user = new User(login: "fred").save(validate: false)
- params.originalURI = "/foo/bar"
+ params.targetUri = "/foo/bar"
params.login = user.login
request.method = "POST"
@@ -56,13 +56,13 @@ class UserControllerTests {
assert view == "/user/register"
assert model.message == "auth.user.already.exists"
- assert model.originalURI == "/foo/bar"
+ assert model.targetUri == "/foo/bar"
assert model.formData == params
}
void testRegisterWithNonMatchingPasswords() {
- params.originalURI = "/foo/bar"
+ params.targetUri = "/foo/bar"
params.login = "fred"
params.password = "one"
params.password2 = "two"
@@ -71,7 +71,7 @@ class UserControllerTests {
controller.register()
assert view == "/user/register"
- assert model.originalURI == "/foo/bar"
+ assert model.targetUri == "/foo/bar"
assert model.formData == params
}
@@ -80,7 +80,7 @@ class UserControllerTests {
new Role(name: Role.EDITOR).save(validate: false)
new Role(name: Role.OBSERVER).save(validate: false)
- params.originalURI = "/foo/bar"
+ params.targetUri = "/foo/bar"
params.login = "fred"
params.password = "one"
params.password2 = "one"
@@ -92,7 +92,7 @@ class UserControllerTests {
assert view == "/user/register"
assert model.user
- assert model.originalURI == "/foo/bar"
+ assert model.targetUri == "/foo/bar"
assert model.formData == params
}
@@ -100,7 +100,7 @@ class UserControllerTests {
def secUtil = mockFor(SecurityUtils)
secUtil.demand.static.getSubject {-> [login: {authToken -> true}] }
- params.originalURI = "/foo/bar"
+ params.targetUri = "/foo/bar"
params.login = "dilbert"
params.password = "one"
params.password2 = "one"
@@ -114,7 +114,7 @@ class UserControllerTests {
controller.register()
- assert response.redirectedUrl == params.originalURI
+ assert response.redirectedUrl == params.targetUri
secUtil.verify()
}
@@ -157,9 +157,9 @@ class UserControllerTests {
def webUtil = mockFor(WebUtils)
webUtil.demand.static.getSavedRequest { HttpServletRequest request -> return null }
- views['/user/_loginForm.gsp'] = 'login form ${message} ${originalURI} ${async}'
+ views['/user/_loginForm.gsp'] = 'login form ${message} ${targetUri} ${async}'
- params.originalURI = "/foo/bar"
+ params.targetUri = "/foo/bar"
params.username = "fred"
params.password = "letmein"
@@ -183,7 +183,7 @@ class UserControllerTests {
def webUtil = mockFor(WebUtils)
webUtil.demand.static.getSavedRequest { HttpServletRequest request -> return null }
- params.originalURI = "/foo/bar"
+ params.targetUri = "/foo/bar"
params.username = "fred"
params.password = "letmein"
@@ -193,7 +193,7 @@ class UserControllerTests {
def redirectUri = new URI(response.redirectedUrl)
assert redirectUri.path == "/user/login"
- assert redirectUri.query == "username=fred&originalURI=${params.originalURI}"
+ assert redirectUri.query == "username=fred&targetUri=${params.targetUri}"
secUtil.verify()
webUtil.verify()
@@ -206,7 +206,7 @@ class UserControllerTests {
def webUtil = mockFor(WebUtils)
webUtil.demand.static.getSavedRequest { HttpServletRequest request -> return null }
- params.originalURI = "/foo/bar?queryString"
+ params.targetUri = "/foo/bar?queryString"
params.username ="fred"
params.password = "letmein"
request.method = "POST"
Please sign in to comment.
Something went wrong with that request. Please try again.