]> source.dussan.org Git - gitblit.git/commitdiff
Now only shows the "my tickets" button in the navbar if you are connected.
authorHybris95 <hybris_95@hotmail.com>
Tue, 22 Apr 2014 10:23:03 +0000 (12:23 +0200)
committerJames Moger <james.moger@gitblit.com>
Thu, 1 May 2014 20:14:14 +0000 (16:14 -0400)
Redirects to the main page if you try going on "/mytickets" when not connected (or if you disconnect while being on "/mytickets").

src/main/java/com/gitblit/wicket/pages/MyTicketsPage.java
src/main/java/com/gitblit/wicket/pages/RootPage.java

index 2c57a051f0de103beccf38ab5abcee31661b1f9e..9be3b125ffb128b1eb25d3560475d027d94ed8d6 100644 (file)
@@ -34,12 +34,14 @@ public class MyTicketsPage extends RootPage {
        
        public MyTicketsPage(PageParameters params)
        {
-               super();
+               super(params);
                setupPage("", getString("gb.mytickets"));
                
                UserModel currentUser = GitBlitWebSession.get().getUser();
                if (currentUser == null) {
-                       currentUser = UserModel.ANONYMOUS;
+                       setRedirect(true);
+                       setResponsePage(getApplication().getHomePage());
+                       return;
                }
                String username = currentUser.getName();
                
index ec413b1927ca9e1a7b028ddc119a321372a094de..a4d2353d0e815c5806e79c275a4d9ae3c31260ae 100644 (file)
@@ -134,6 +134,8 @@ public abstract class RootPage extends BasePage {
                boolean authenticateView = app().settings().getBoolean(Keys.web.authenticateViewPages, false);\r
                boolean authenticateAdmin = app().settings().getBoolean(Keys.web.authenticateAdminPages, true);\r
                boolean allowAdmin = app().settings().getBoolean(Keys.web.allowAdministration, true);\r
+               boolean allowLucene = app().settings().getBoolean(Keys.web.allowLuceneIndexing, true);\r
+               boolean isLoggedIn = GitBlitWebSession.get().isLoggedIn();\r
 \r
                if (authenticateAdmin) {\r
                        showAdmin = allowAdmin && GitBlitWebSession.get().canAdmin();\r
@@ -151,7 +153,7 @@ public abstract class RootPage extends BasePage {
                }\r
 \r
                if (authenticateView || authenticateAdmin) {\r
-                       if (GitBlitWebSession.get().isLoggedIn()) {\r
+                       if (isLoggedIn) {\r
                                UserMenu userFragment = new UserMenu("userPanel", "userMenuFragment", RootPage.this);\r
                                add(userFragment);\r
                        } else {\r
@@ -167,14 +169,17 @@ public abstract class RootPage extends BasePage {
 \r
                // navigation links\r
                List<PageRegistration> pages = new ArrayList<PageRegistration>();\r
-               if (!authenticateView || (authenticateView && GitBlitWebSession.get().isLoggedIn())) {\r
-                       pages.add(new PageRegistration(GitBlitWebSession.get().isLoggedIn() ? "gb.myDashboard" : "gb.dashboard", MyDashboardPage.class,\r
+               if (!authenticateView || (authenticateView && isLoggedIn)) {\r
+                       pages.add(new PageRegistration(isLoggedIn ? "gb.myDashboard" : "gb.dashboard", MyDashboardPage.class,\r
                                        getRootPageParameters()));\r
                        pages.add(new PageRegistration("gb.repositories", RepositoriesPage.class,\r
                                        getRootPageParameters()));\r
                        pages.add(new PageRegistration("gb.activity", ActivityPage.class, getRootPageParameters()));\r
-                       pages.add(new PageRegistration("gb.mytickets", MyTicketsPage.class, getRootPageParameters()));\r
-                       if (app().settings().getBoolean(Keys.web.allowLuceneIndexing, true)) {\r
+                       if(isLoggedIn)\r
+                       {\r
+                               pages.add(new PageRegistration("gb.mytickets", MyTicketsPage.class, getRootPageParameters()));\r
+                       }\r
+                       if (allowLucene) {\r
                                pages.add(new PageRegistration("gb.search", LuceneSearchPage.class));\r
                        }\r
                        if (showAdmin) {\r
@@ -184,7 +189,7 @@ public abstract class RootPage extends BasePage {
                                pages.add(new PageRegistration("gb.federation", FederationPage.class));\r
                        }\r
 \r
-                       if (!authenticateView || (authenticateView && GitBlitWebSession.get().isLoggedIn())) {\r
+                       if (!authenticateView || (authenticateView && isLoggedIn)) {\r
                                addDropDownMenus(pages);\r
                        }\r
                }\r