main #2
@ -159,10 +159,11 @@
|
||||
<div class="flex justify-between items-center">
|
||||
<span class="text-gray-600">服务器密码:</span>
|
||||
<div class="flex items-center space-x-2">
|
||||
<span class="font-mono text-gray-900" :class="{ 'text-transparent select-none': !showPassword }">
|
||||
{{ showPassword ? (decryptedPassword || '未设置') : '••••••••' }}
|
||||
<span class="font-mono text-gray-900">
|
||||
{{ showPassword ? decryptedPassword : ($jsiteServer.pg.password || '未设置') }}
|
||||
</span>
|
||||
<button
|
||||
v-if="$jsiteServer.pg.password"
|
||||
@click="togglePassword"
|
||||
class="text-gray-500 hover:text-gray-700 transition-colors"
|
||||
:title="showPassword ? '隐藏密码' : '显示密码'"
|
||||
@ -176,9 +177,12 @@
|
||||
<span class="text-gray-600">密钥对名称:</span>
|
||||
<span class="font-mono text-gray-900">{{ $jsiteServer.pg.key_pair_name || '未设置' }}</span>
|
||||
</div>
|
||||
<div class="flex justify-between">
|
||||
<span class="text-gray-600">私钥:</span>
|
||||
<span class="font-mono text-gray-900">{{ $jsiteServer.pg.private_key || '未设置' }}</span>
|
||||
<div class="flex flex-col">
|
||||
<span class="text-gray-600 mb-2">私钥:</span>
|
||||
<div v-if="$jsiteServer.pg.private_key" class="bg-gray-50 p-3 rounded border">
|
||||
<pre class="font-mono text-xs text-gray-900 whitespace-pre-wrap break-all">{{ $jsiteServer.pg.private_key }}</pre>
|
||||
</div>
|
||||
<span v-else class="font-mono text-gray-900">未设置</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -449,27 +453,25 @@ export default {
|
||||
},
|
||||
togglePassword() {
|
||||
if (this.showPassword) {
|
||||
// 隐藏密码
|
||||
this.showPassword = false;
|
||||
this.decryptedPassword = null;
|
||||
} else {
|
||||
// 显示密码
|
||||
const getPasswordRequest = createResource({
|
||||
url: '/api/action/jingrow.client.get_password',
|
||||
url: '/api/action/jcloud.api.aliyun_server_light.get_password',
|
||||
params: {
|
||||
pagetype: 'Jsite Server',
|
||||
name: this.$jsiteServer.pg.name,
|
||||
fieldname: 'password'
|
||||
},
|
||||
onSuccess: (response) => {
|
||||
if (response.message) {
|
||||
this.decryptedPassword = response.message;
|
||||
if (response && response !== '') {
|
||||
this.decryptedPassword = response;
|
||||
this.showPassword = true;
|
||||
} else {
|
||||
toast.warning('当前没有保存的密码');
|
||||
}
|
||||
},
|
||||
onError: () => {
|
||||
onError: (error) => {
|
||||
toast.error('获取密码失败');
|
||||
}
|
||||
});
|
||||
|
||||
@ -1012,4 +1012,9 @@ def reset_server_key_pair(instance_id):
|
||||
|
||||
except Exception as e:
|
||||
jingrow.log_error("重置密钥对失败", f"重置实例 {instance_id} 密钥对时发生错误: {str(e)}")
|
||||
return {"success": False, "message": str(e)}
|
||||
return {"success": False, "message": str(e)}
|
||||
|
||||
@jingrow.whitelist()
|
||||
def get_password(pagetype, name, fieldname):
|
||||
|
||||
return jingrow.get_pg(pagetype, name).get_password(fieldname)
|
||||
@ -72,7 +72,7 @@ jingrow.ui.form.on("Jsite Server", {
|
||||
if (password_field.$input.attr('type') === 'password') {
|
||||
// 使用jingrow.call获取解密后的密码
|
||||
jingrow.call({
|
||||
method: 'jingrow.client.get_password',
|
||||
method: 'jcloud.api.aliyun_server_light.get_password',
|
||||
args: {
|
||||
pagetype: 'Jsite Server',
|
||||
name: frm.pg.name,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user