summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/gitblit/wicket/pages
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2014-06-05 08:38:35 -0400
committerJames Moger <james.moger@gitblit.com>2014-06-05 08:38:35 -0400
commit05f229883c4e15e044c5c103acf69265cfb8806e (patch)
treebe1261dd88c8a8b29b2f31ce5b5e591b9eedd182 /src/main/java/com/gitblit/wicket/pages
parentc9921bd3b0b7bf90b6e5e2a52141c3fdf0f31f89 (diff)
downloadgitblit-05f229883c4e15e044c5c103acf69265cfb8806e.tar.gz
gitblit-05f229883c4e15e044c5c103acf69265cfb8806e.zip
Add a basic SSH public key management UI
Diffstat (limited to 'src/main/java/com/gitblit/wicket/pages')
-rw-r--r--src/main/java/com/gitblit/wicket/pages/UserPage.html14
-rw-r--r--src/main/java/com/gitblit/wicket/pages/UserPage.java22
2 files changed, 36 insertions, 0 deletions
diff --git a/src/main/java/com/gitblit/wicket/pages/UserPage.html b/src/main/java/com/gitblit/wicket/pages/UserPage.html
index 09267873..d71cb2b5 100644
--- a/src/main/java/com/gitblit/wicket/pages/UserPage.html
+++ b/src/main/java/com/gitblit/wicket/pages/UserPage.html
@@ -20,6 +20,7 @@
<ul class="nav nav-tabs">
<li class="active"><a href="#repositories" data-toggle="tab"><wicket:message key="gb.repositories"></wicket:message></a></li>
<div wicket:id="preferencesLink"></div>
+ <div wicket:id="sshKeysLink"></div>
</ul>
<!-- tab content -->
@@ -37,6 +38,9 @@
<!-- preferences tab -->
<div wicket:id="preferencesTab"></div>
+ <!-- ssh keys tab -->
+ <div wicket:id="sshKeysTab"></div>
+
</div>
</div>
</div>
@@ -47,6 +51,10 @@
<li><a href="#preferences" data-toggle="tab"><wicket:message key="gb.preferences"></wicket:message></a></li>
</wicket:fragment>
+<wicket:fragment wicket:id="sshKeysLinkFragment">
+ <li><a href="#ssh" data-toggle="tab"><wicket:message key="gb.sshKeys"></wicket:message></a></li>
+</wicket:fragment>
+
<wicket:fragment wicket:id="preferencesTabFragment">
<div class="tab-pane" id="preferences">
<h4><wicket:message key="gb.accountPreferences"></wicket:message></h4>
@@ -63,6 +71,12 @@
</div>
</wicket:fragment>
+<wicket:fragment wicket:id="sshKeysTabFragment">
+ <div class="tab-pane" id="ssh">
+ <div wicket:id="sshKeysPanel"></div>
+ </div>
+</wicket:fragment>
+
</wicket:extend>
</body>
</html> \ No newline at end of file
diff --git a/src/main/java/com/gitblit/wicket/pages/UserPage.java b/src/main/java/com/gitblit/wicket/pages/UserPage.java
index baad4a06..4a955c7c 100644
--- a/src/main/java/com/gitblit/wicket/pages/UserPage.java
+++ b/src/main/java/com/gitblit/wicket/pages/UserPage.java
@@ -50,6 +50,7 @@ import com.gitblit.wicket.GitblitRedirectException;
import com.gitblit.wicket.WicketUtils;
import com.gitblit.wicket.panels.ChoiceOption;
import com.gitblit.wicket.panels.ProjectRepositoryPanel;
+import com.gitblit.wicket.panels.SshKeysPanel;
import com.gitblit.wicket.panels.TextOption;
import com.gitblit.wicket.panels.UserTitlePanel;
@@ -100,10 +101,22 @@ public class UserPage extends RootPage {
if (isMyProfile) {
addPreferences(user);
+
+ if (app().gitblit().isServingSSH()) {
+ // show the SSH key management tab
+ addSshKeys(user);
+ } else {
+ // SSH daemon is disabled, hide keys tab
+ add(new Label("sshKeysLink").setVisible(false));
+ add(new Label("sshKeysTab").setVisible(false));
+ }
} else {
// visiting user
add(new Label("preferencesLink").setVisible(false));
add(new Label("preferencesTab").setVisible(false));
+
+ add(new Label("sshKeysLink").setVisible(false));
+ add(new Label("sshKeysTab").setVisible(false));
}
List<RepositoryModel> repositories = getRepositories(params);
@@ -251,6 +264,15 @@ public class UserPage extends RootPage {
add(fragment.setRenderBodyOnly(true));
}
+ private void addSshKeys(final UserModel user) {
+ Fragment keysTab = new Fragment("sshKeysTab", "sshKeysTabFragment", this);
+ keysTab.add(new SshKeysPanel("sshKeysPanel", user, getClass(), getPageParameters()));
+
+ // add the SSH keys tab
+ add(new Fragment("sshKeysLink", "sshKeysLinkFragment", this).setRenderBodyOnly(true));
+ add(keysTab.setRenderBodyOnly(true));
+ }
+
private class Language implements Serializable {
private static final long serialVersionUID = 1L;