]> source.dussan.org Git - gitblit.git/commitdiff
Updated login and search forms to use the SessionlessForm
authorJames Moger <james.moger@gitblit.com>
Fri, 23 Mar 2012 20:31:22 +0000 (16:31 -0400)
committerJames Moger <james.moger@gitblit.com>
Fri, 23 Mar 2012 20:31:22 +0000 (16:31 -0400)
src/com/gitblit/wicket/pages/LuceneSearchPage.java
src/com/gitblit/wicket/pages/RepositoryPage.java
src/com/gitblit/wicket/pages/RootPage.java

index c9e70661e3b5c65031d309334f02e6973d99c906..997ef213837fa3c58f22064672964e1600b3ab0a 100644 (file)
@@ -23,7 +23,6 @@ import org.apache.wicket.Component;
 import org.apache.wicket.PageParameters;\r
 import org.apache.wicket.markup.html.basic.Label;\r
 import org.apache.wicket.markup.html.form.ListMultipleChoice;\r
-import org.apache.wicket.markup.html.form.StatelessForm;\r
 import org.apache.wicket.markup.html.form.TextField;\r
 import org.apache.wicket.markup.html.panel.Fragment;\r
 import org.apache.wicket.markup.repeater.Item;\r
@@ -41,6 +40,7 @@ import com.gitblit.models.UserModel;
 import com.gitblit.utils.ArrayUtils;\r
 import com.gitblit.utils.StringUtils;\r
 import com.gitblit.wicket.GitBlitWebSession;\r
+import com.gitblit.wicket.SessionlessForm;\r
 import com.gitblit.wicket.StringChoiceRenderer;\r
 import com.gitblit.wicket.WicketUtils;\r
 import com.gitblit.wicket.panels.LinkPanel;\r
@@ -121,7 +121,7 @@ public class LuceneSearchPage extends RootPage {
                // search form\r
                final Model<String> queryModel = new Model<String>(query);\r
                final Model<ArrayList<String>> repositoriesModel = new Model<ArrayList<String>>(searchRepositories);\r
-               StatelessForm<Void> form = new StatelessForm<Void>("searchForm") {\r
+               SessionlessForm<Void> form = new SessionlessForm<Void>("searchForm", getClass()) {\r
                        \r
                        private static final long serialVersionUID = 1L;\r
 \r
index cd3c8a2e86c11d6a2125a23d82d3665968cfb6dd..132b1f7fe0085a5d4421ed01d87639515c6880ed 100644 (file)
@@ -27,7 +27,6 @@ import org.apache.wicket.Component;
 import org.apache.wicket.PageParameters;\r
 import org.apache.wicket.markup.html.basic.Label;\r
 import org.apache.wicket.markup.html.form.DropDownChoice;\r
-import org.apache.wicket.markup.html.form.StatelessForm;\r
 import org.apache.wicket.markup.html.form.TextField;\r
 import org.apache.wicket.markup.html.link.ExternalLink;\r
 import org.apache.wicket.markup.html.panel.Fragment;\r
@@ -51,6 +50,7 @@ import com.gitblit.utils.TicgitUtils;
 import com.gitblit.wicket.GitBlitWebSession;\r
 import com.gitblit.wicket.PageRegistration;\r
 import com.gitblit.wicket.PageRegistration.OtherPageLink;\r
+import com.gitblit.wicket.SessionlessForm;\r
 import com.gitblit.wicket.WicketUtils;\r
 import com.gitblit.wicket.panels.LinkPanel;\r
 import com.gitblit.wicket.panels.NavigationPanel;\r
@@ -314,7 +314,7 @@ public abstract class RepositoryPage extends BasePage {
                return WicketUtils.newObjectParameter(repositoryName, commitId);\r
        }\r
 \r
-       private static class SearchForm extends StatelessForm<Void> implements Serializable {\r
+       private class SearchForm extends SessionlessForm<Void> implements Serializable {\r
                private static final long serialVersionUID = 1L;\r
 \r
                private final String repositoryName;\r
@@ -325,7 +325,7 @@ public abstract class RepositoryPage extends BasePage {
                                Constants.SearchType.COMMIT);\r
 \r
                public SearchForm(String id, String repositoryName) {\r
-                       super(id);\r
+                       super(id, RepositoryPage.this.getClass(), RepositoryPage.this.getPageParameters());\r
                        this.repositoryName = repositoryName;\r
                        DropDownChoice<Constants.SearchType> searchType = new DropDownChoice<Constants.SearchType>(\r
                                        "searchType", Arrays.asList(Constants.SearchType.values()));\r
index bf811f945902a024d899cfcac0c7740c8eb77822..57678dfb628d3fbeb81cca46d60b59a8b5ceca57 100644 (file)
@@ -32,7 +32,6 @@ import java.util.regex.Pattern;
 \r
 import org.apache.wicket.PageParameters;\r
 import org.apache.wicket.markup.html.form.PasswordTextField;\r
-import org.apache.wicket.markup.html.form.StatelessForm;\r
 import org.apache.wicket.markup.html.form.TextField;\r
 import org.apache.wicket.model.IModel;\r
 import org.apache.wicket.model.Model;\r
@@ -48,6 +47,7 @@ import com.gitblit.utils.StringUtils;
 import com.gitblit.wicket.GitBlitWebSession;\r
 import com.gitblit.wicket.PageRegistration;\r
 import com.gitblit.wicket.PageRegistration.DropDownMenuItem;\r
+import com.gitblit.wicket.SessionlessForm;\r
 import com.gitblit.wicket.WicketUtils;\r
 import com.gitblit.wicket.panels.NavigationPanel;\r
 \r
@@ -117,7 +117,7 @@ public abstract class RootPage extends BasePage {
                add(navPanel);\r
 \r
                // login form\r
-               StatelessForm<Void> loginForm = new StatelessForm<Void>("loginForm") {\r
+               SessionlessForm<Void> loginForm = new SessionlessForm<Void>("loginForm", getClass(), getPageParameters()) {\r
 \r
                        private static final long serialVersionUID = 1L;\r
 \r
@@ -208,8 +208,16 @@ public abstract class RootPage extends BasePage {
                        }\r
 \r
                        if (!continueToOriginalDestination()) {\r
-                               // Redirect to home page\r
-                               setResponsePage(getApplication().getHomePage());\r
+                               PageParameters params = getPageParameters();\r
+                               if (params == null) {\r
+                                       // redirect to this page\r
+                                       setResponsePage(getClass());\r
+                               } else {\r
+                                       // Strip username and password and redirect to this page\r
+                                       params.remove("username");\r
+                                       params.remove("password");\r
+                                       setResponsePage(getClass(), params);\r
+                               }\r
                        }\r
                }\r
        }\r