summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--public/js/index.js8
-rw-r--r--templates/repo/settings/deploy_keys.tmpl4
2 files changed, 6 insertions, 6 deletions
diff --git a/public/js/index.js b/public/js/index.js
index 2e0e26f55c..f443e52436 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -1491,10 +1491,10 @@ $(function () {
// Parse SSH Key
$("#ssh-key-content").on('change paste keyup',function(){
- var value = $(this).val();
- var arrays = value.split(" ");
- if (arrays.length === 3 && arrays[2] !== "") {
- $("#ssh-key-title").val(arrays[2]);
+ var arrays = $(this).val().split(" ");
+ var $title = $("#ssh-key-title")
+ if ($title.val() === "" && arrays.length === 3 && arrays[2] !== "") {
+ $title.val(arrays[2]);
}
});
});
diff --git a/templates/repo/settings/deploy_keys.tmpl b/templates/repo/settings/deploy_keys.tmpl
index 1f6b26a6da..6f419c894a 100644
--- a/templates/repo/settings/deploy_keys.tmpl
+++ b/templates/repo/settings/deploy_keys.tmpl
@@ -57,11 +57,11 @@
</div>
<div class="field {{if .Err_Title}}error{{end}}">
<label for="title">{{.i18n.Tr "repo.settings.title"}}</label>
- <input id="title" name="title" value="{{.title}}" autofocus required>
+ <input id="ssh-key-title" name="title" value="{{.title}}" autofocus required>
</div>
<div class="field {{if .Err_Content}}error{{end}}">
<label for="content">{{.i18n.Tr "repo.settings.deploy_key_content"}}</label>
- <textarea id="content" name="content" required>{{.content}}</textarea>
+ <textarea id="ssh-key-content" name="content" required>{{.content}}</textarea>
</div>
<button class="ui green button">
{{.i18n.Tr "repo.settings.add_deploy_key"}}