SSH认证添加私钥时可以从私钥文件中直接拖入

This commit is contained in:
GoEdgeLab
2023-03-19 17:49:07 +08:00
parent 237e88fe23
commit 16ba100d60
5 changed files with 32 additions and 6 deletions

View File

@@ -0,0 +1,26 @@
Vue.component("file-textarea", {
props: ["value"],
data: function () {
let value = this.value
if (typeof value != "string") {
value = ""
}
return {
realValue: value
}
},
mounted: function () {
},
methods: {
drop: function (e) {
let that = this
e.dataTransfer.items[0].getAsFile().text().then(function (data) {
that.setValue(data)
})
},
setValue: function (value) {
this.realValue = value
}
},
template: `<textarea @drop.prevent="drop" ref="textarea" v-model="realValue"></textarea>`
})

View File

@@ -49,8 +49,8 @@
<tr> <tr>
<td>RSA私钥 *</td> <td>RSA私钥 *</td>
<td> <td>
<textarea name="privateKey" spellcheck="false"></textarea> <file-textarea name="privateKey" spellcheck="false" placeholder="填入RSA私钥内容或者拖动私钥文件到当前框中"></file-textarea>
<p class="comment">用来生成登录SSH公钥的私钥</p> <p class="comment">用来生成登录SSH公钥的私钥</p>
</td> </td>
</tr> </tr>
<tr> <tr>

View File

@@ -47,7 +47,7 @@
<tr> <tr>
<td>RSA私钥 *</td> <td>RSA私钥 *</td>
<td> <td>
<textarea name="privateKey" spellcheck="false"></textarea> <file-textarea name="privateKey" spellcheck="false" placeholder="填入RSA私钥内容或者拖动私钥文件到当前框中"></file-textarea>
<p class="comment">用来生成登录SSH公钥的私钥</p> <p class="comment">用来生成登录SSH公钥的私钥</p>
</td> </td>
</tr> </tr>

View File

@@ -50,7 +50,7 @@
<tr> <tr>
<td>RSA私钥 *</td> <td>RSA私钥 *</td>
<td> <td>
<textarea name="privateKey" v-model="grant.privateKey" spellcheck="false"></textarea> <file-textarea name="privateKey" v-model="grant.privateKey" spellcheck="false" placeholder="填入RSA私钥内容或者拖动私钥文件到当前框中"></file-textarea>
<p class="comment">用来生成登录SSH公钥的私钥</p> <p class="comment">用来生成登录SSH公钥的私钥</p>
</td> </td>
</tr> </tr>

View File

@@ -49,8 +49,8 @@
<tr> <tr>
<td>RSA私钥 *</td> <td>RSA私钥 *</td>
<td> <td>
<textarea name="privateKey" v-model="grant.privateKey" spellcheck="false"></textarea> <file-textarea name="privateKey" v-model="grant.privateKey" spellcheck="false" placeholder="填入RSA私钥内容或者拖动私钥文件到当前框中"></file-textarea>
<p class="comment">用来生成登录SSH公钥的私钥</p> <p class="comment">用来生成登录SSH公钥的私钥</p>
</td> </td>
</tr> </tr>
<tr> <tr>