summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorMartin Spielmann <martin.spielmann@pingunaut.com>2017-05-22 00:29:08 +0200
committerFlorian Zschocke <f.zschocke+git@gmail.com>2022-11-01 17:33:24 +0100
commit0e344ae98ebccc734d7142682bee0d488ea65c9d (patch)
tree6bb72a3e73d5a9d58e50255512c528b6c573dac8 /src/main
parent646231e54a2ee1edc97a5aa813f82638dfdef0b7 (diff)
downloadgitblit-0e344ae98ebccc734d7142682bee0d488ea65c9d.tar.gz
gitblit-0e344ae98ebccc734d7142682bee0d488ea65c9d.zip
Add feedback to SSH Key Form. #1226
if key is empty of can not be parsed, form did provide any feedback to user before
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/gitblit/wicket/GitBlitWebApp.properties2
-rw-r--r--src/main/java/com/gitblit/wicket/GitBlitWebApp_de.properties2
-rw-r--r--src/main/java/com/gitblit/wicket/pages/BasePage.java2
-rw-r--r--src/main/java/com/gitblit/wicket/panels/SshKeysPanel.java4
4 files changed, 9 insertions, 1 deletions
diff --git a/src/main/java/com/gitblit/wicket/GitBlitWebApp.properties b/src/main/java/com/gitblit/wicket/GitBlitWebApp.properties
index 9c643d92..221878e1 100644
--- a/src/main/java/com/gitblit/wicket/GitBlitWebApp.properties
+++ b/src/main/java/com/gitblit/wicket/GitBlitWebApp.properties
@@ -738,6 +738,8 @@ gb.emailAddressDescription = The primary email address for receiving notificatio
gb.sshKeys = SSH Keys
gb.sshKeysDescription = SSH public key authentication is a secure alternative to password authentication
gb.addSshKey = Add SSH Key
+gb.addSshKeyErrorEmpty = SSH public key empty. Please provide a valid SSH public key
+gb.addSshKeyErrorFormat = Not a valid SSH public key format. Please provide a valid SSH public key
gb.key = Key
gb.sshKeyComment = Comment
gb.sshKeyCommentDescription = Enter an optional comment. If blank, the comment will be extracted from the key data.
diff --git a/src/main/java/com/gitblit/wicket/GitBlitWebApp_de.properties b/src/main/java/com/gitblit/wicket/GitBlitWebApp_de.properties
index 677144eb..48b1a31c 100644
--- a/src/main/java/com/gitblit/wicket/GitBlitWebApp_de.properties
+++ b/src/main/java/com/gitblit/wicket/GitBlitWebApp_de.properties
@@ -735,6 +735,8 @@ gb.emailAddressDescription = Die prim\u00e4re Emailadresse f\u00fcr den Empfang
gb.sshKeys = SSH Keys
gb.sshKeysDescription = SSH Public Key Authentifizierung ist eine sichere Alternative zur Authentifizierung mit Passwort
gb.addSshKey = SSH Key hinzuf\u00fcgen
+gb.addSshKeyErrorEmpty = SSH Public Key leer. Bitte geben Sie einen g\u00fltigen SSH Public Key an
+gb.addSshKeyErrorFormat = SSH Public Key Format ungültig. Bitte geben Sie einen g\u00fltigen SSH Public Key an
gb.key = Key
gb.sshKeyComment = Kommentar
gb.sshKeyCommentDescription = Geben Sie optional einen Kommentar ein. Falls Sie dies nicht tun, wird der Kommentar aus dem Key extrahiert.
diff --git a/src/main/java/com/gitblit/wicket/pages/BasePage.java b/src/main/java/com/gitblit/wicket/pages/BasePage.java
index 0d99f5e5..bb97ee8c 100644
--- a/src/main/java/com/gitblit/wicket/pages/BasePage.java
+++ b/src/main/java/com/gitblit/wicket/pages/BasePage.java
@@ -251,7 +251,7 @@ public abstract class BasePage extends SessionPage {
add(rootLink);
// Feedback panel for info, warning, and non-fatal error messages
- add(new FeedbackPanel("feedback"));
+ add(new FeedbackPanel("feedback").setOutputMarkupId(true));
add(new Label("gbVersion", "v" + Constants.getVersion()));
if (app().settings().getBoolean(Keys.web.aggressiveHeapManagement, false)) {
diff --git a/src/main/java/com/gitblit/wicket/panels/SshKeysPanel.java b/src/main/java/com/gitblit/wicket/panels/SshKeysPanel.java
index 4ab2483a..9bcb2127 100644
--- a/src/main/java/com/gitblit/wicket/panels/SshKeysPanel.java
+++ b/src/main/java/com/gitblit/wicket/panels/SshKeysPanel.java
@@ -134,6 +134,8 @@ public class SshKeysPanel extends BasePanel {
String data = keyData.getObject();
if (StringUtils.isEmpty(data)) {
// do not submit empty key
+ error(getString("gb.addSshKeyErrorEmpty"));
+ target.addComponent(getPage().get("feedback"));
return;
}
@@ -142,6 +144,8 @@ public class SshKeysPanel extends BasePanel {
key.getPublicKey();
} catch (Exception e) {
// failed to parse the key
+ error(getString("gb.addSshKeyErrorFormat"));
+ target.addComponent(getPage().get("feedback"));
return;
}