Fix DEPRECATED createLinkTo warning message (credits Sam)

Project: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/commit/e30d9d9d
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/tree/e30d9d9d
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/diff/e30d9d9d

Branch: refs/heads/0.4.0
Commit: e30d9d9d3f6a76e30638472e3e578a7b9a9b448b
Parents: 280dae0
Author: Cosmin Dumitrache <[email protected]>
Authored: Thu May 31 17:53:21 2012 +0100
Committer: Cosmin Dumitrache <[email protected]>
Committed: Thu May 31 17:53:21 2012 +0100

----------------------------------------------------------------------
 .../brooklyn/web/console/LoginController.groovy | 24 ++++++++------------
 .../web-console/grails-app/views/login/auth.gsp |  2 +-
 2 files changed, 10 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/e30d9d9d/usage/web-console/grails-app/controllers/brooklyn/web/console/LoginController.groovy
----------------------------------------------------------------------
diff --git 
a/usage/web-console/grails-app/controllers/brooklyn/web/console/LoginController.groovy
 
b/usage/web-console/grails-app/controllers/brooklyn/web/console/LoginController.groovy
index a6170a4..3e013d1 100644
--- 
a/usage/web-console/grails-app/controllers/brooklyn/web/console/LoginController.groovy
+++ 
b/usage/web-console/grails-app/controllers/brooklyn/web/console/LoginController.groovy
@@ -8,26 +8,25 @@ import brooklyn.web.console.security.WebConsoleSecurity
 
 class LoginController {
 
-    private String getRedirectTarget(boolean includePrefix) {
-        String result = "/dashboard/"; 
-        if (includePrefix) result = createLinkTo(dir:result)
-        return result;
+    private void loadDashboard() {
+        redirect controller: "dashboard"
     }
-    
+
     /**
      * Default action; redirects to 'defaultTargetUrl' if logged in, 
/login/auth otherwise.
      */
     def index = {
         if (WebConsoleSecurity.getInstance().isAuthenticated(session) || 
tryAuthenticate()) {
-            redirect uri: getRedirectTarget(false);
+            loadDashboard()
         } else {
-            redirect action: auth, params: params
+            redirect action: auth
         }
     }
 
     private boolean tryAuthenticate() {
         if (params.j_username) {
-            return WebConsoleSecurity.getInstance().authenticate(session, 
params.j_username, params.j_password)
+            def success = 
WebConsoleSecurity.getInstance().authenticate(session, params.j_username, 
params.j_password)
+            flash.message = "Bad login"
         }
         return false;
     }
@@ -36,16 +35,11 @@ class LoginController {
      */
     def auth = {
         if (WebConsoleSecurity.getInstance().isAuthenticated(session)) {
-            redirect uri: getRedirectTarget(false)
-            return
+            loadDashboard()
         }
 
-        String view = 'auth'
-        String postUrl = createLinkTo(dir:"login")
         //TODO support following to the originally requested URL
-        String postAfterUrl = getRedirectTarget(true)
-        render view: view, model: [postUrl: postUrl,
-                                   rememberMeParameter: true]
+        render view: "auth", model: [rememberMeParameter: true]
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/e30d9d9d/usage/web-console/grails-app/views/login/auth.gsp
----------------------------------------------------------------------
diff --git a/usage/web-console/grails-app/views/login/auth.gsp 
b/usage/web-console/grails-app/views/login/auth.gsp
index 5690413..a8a5d2e 100644
--- a/usage/web-console/grails-app/views/login/auth.gsp
+++ b/usage/web-console/grails-app/views/login/auth.gsp
@@ -49,7 +49,7 @@
                        <div class='login_message'>${flash.message}</div>
                        </g:if>
                        <div class='fheader'>Please Login</div>
-                       <form action='${postUrl}' method='POST' id='loginForm' 
class='cssform' autocomplete='off'>
+                       <form action='<g:createLink controller="login"/>' 
method='POST' id='loginForm' class='cssform' autocomplete='off'>
                                <p>
                                        <label for='username'>Login ID</label>
                                        <input type='text' class='text_' 
name='j_username' id='username' />

Reply via email to