Skip to content

Commit 097b1c4

Browse files
committed
Abandon efforts to add generate button to UI
1 parent c9ebaf6 commit 097b1c4

File tree

1 file changed

+1
-27
lines changed
  • src/main/resources/io/jenkins/plugins/gitlabserverconfig/servers/GitLabServer

1 file changed

+1
-27
lines changed

src/main/resources/io/jenkins/plugins/gitlabserverconfig/servers/GitLabServer/config.groovy

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,13 @@
11
package io.jenkins.plugins.gitlabserverconfig.servers.GitLabServer
22

3-
import hudson.Util
4-
import hudson.util.Secret
53
import io.jenkins.plugins.gitlabserverconfig.servers.GitLabServer
64
import lib.CredentialsTagLib
75
import lib.FormTagLib
8-
import java.security.SecureRandom
96
import org.apache.commons.lang.RandomStringUtils;
107

11-
byte[] random = new byte[16]; // 16x8=128bit worth of randomness, since we use md5 digest as the API token
12-
SecureRandom RANDOM = new SecureRandom();
13-
RANDOM.nextBytes(random);
14-
Secret token = Secret.decrypt(Util.toHexString(random));
15-
168
def f = namespace(FormTagLib)
179
def c = namespace(CredentialsTagLib)
1810

19-
String secretTextId = RandomStringUtils.randomNumeric(4)
20-
String genButtonId = RandomStringUtils.randomNumeric(4)
21-
2211
f.entry(title: _("Display Name"), field: "name", "description": "A unique name for the server") {
2312
f.textbox(default: String.format("gitlab-%s", RandomStringUtils.randomNumeric(GitLabServer.SHORT_NAME_LENGTH)))
2413
}
@@ -40,22 +29,7 @@ f.entry(title: _("System Hook"), field: "manageSystemHooks", "description": "Do
4029
}
4130

4231
f.entry(title: _("Secret Token"), field: "secretToken", "description": "The secret token used while setting up hook url in the GitLab server") {
43-
f.password(id: secretTextId)
44-
}
45-
46-
f.entry(field: "genButton") {
47-
raw("""
48-
<button id="${genButtonId}">
49-
Generate Secret Token
50-
</button>
51-
<script>
52-
document.getElementById("${genButtonId}").addEventListener('click', function(e) {
53-
e.preventDefault();
54-
console.log("${token}")
55-
document.getElementById("${secretTextId}").value = ${token};
56-
});
57-
</script>
58-
""")
32+
f.password()
5933
}
6034

6135
f.entry(title: _("Root URL for hooks"), field: "hooksRootUrl", "description": "Jenkins root URL to use in hooks URL (if different from the public Jenkins root URL)") {

0 commit comments

Comments
 (0)