diff options
author | James Moger <james.moger@gitblit.com> | 2012-11-29 18:45:55 -0500 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2012-11-29 18:45:55 -0500 |
commit | 18edd81951a034a2bda9459ff1ef2dcd686eb39b (patch) | |
tree | 61fad81ef97c53c47c5aa0aee31d4c51a22786a1 | |
parent | 8fef1f8128b35e7378b8af1d9d76a731a74851c5 (diff) | |
download | gitblit-18edd81951a034a2bda9459ff1ef2dcd686eb39b.tar.gz gitblit-18edd81951a034a2bda9459ff1ef2dcd686eb39b.zip |
Hide some user links based on authentication type
-rw-r--r-- | src/com/gitblit/wicket/pages/BasePage.java | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/com/gitblit/wicket/pages/BasePage.java b/src/com/gitblit/wicket/pages/BasePage.java index d04271db..5721adf7 100644 --- a/src/com/gitblit/wicket/pages/BasePage.java +++ b/src/com/gitblit/wicket/pages/BasePage.java @@ -422,14 +422,19 @@ public abstract class BasePage extends WebPage { public UserFragment(String id, String markupId, MarkupContainer markupProvider) {
super(id, markupId, markupProvider);
- if (GitBlitWebSession.get().isLoggedIn()) {
+ GitBlitWebSession session = GitBlitWebSession.get();
+ if (session.isLoggedIn()) {
+ UserModel user = session.getUser();
+ boolean editCredentials = GitBlit.self().supportsCredentialChanges();
+ boolean standardLogin = session.authenticationType.isStandard();
+
// username, logout, and change password
- add(new Label("username", GitBlitWebSession.get().getUser().getDisplayName() + ":"));
+ add(new Label("username", user.getDisplayName() + ":"));
add(new LinkPanel("loginLink", null, markupProvider.getString("gb.logout"),
- LogoutPage.class));
- boolean editCredentials = GitBlit.self().supportsCredentialChanges();
+ LogoutPage.class).setVisible(standardLogin));
+
// quick and dirty hack for showing a separator
- add(new Label("separator", "|").setVisible(editCredentials));
+ add(new Label("separator", "|").setVisible(standardLogin && editCredentials));
add(new BookmarkablePageLink<Void>("changePasswordLink",
ChangePasswordPage.class).setVisible(editCredentials));
} else {
|