mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-09 15:40:18 +00:00
MeshCentral can now remember RDP credentials.
This commit is contained in:
parent
e373cec943
commit
d4ecae73d9
8 changed files with 2351 additions and 2185 deletions
|
@ -1876,6 +1876,7 @@
|
|||
node.gpsloc = message.event.node.gpsloc;
|
||||
node.tags = message.event.node.tags;
|
||||
node.ssh = message.event.node.ssh;
|
||||
node.rdp = message.event.node.rdp;
|
||||
node.userloc = message.event.node.userloc;
|
||||
node.rdpport = message.event.node.rdpport;
|
||||
node.rfbport = message.event.node.rfbport;
|
||||
|
@ -3430,13 +3431,17 @@
|
|||
x += addDeviceAttribute("Tags", '<span style=color:black>' + groupingTags + '</span>');
|
||||
}
|
||||
|
||||
// SSH Credentials
|
||||
if (node.ssh != null) {
|
||||
// SSH & RDP Credentials
|
||||
if ((node.ssh != null) || (node.rdp != null)) {
|
||||
var y = [];
|
||||
if ((meshrights & 4) != 0) {
|
||||
x += addDeviceAttribute("Credentials", '<span onclick=showClearSshDialog(3) style=cursor:pointer>' + "SSH" + ' <img class=hoverButton src="images/link5.png" width=10 height=10 /></span>');
|
||||
if (node.ssh != null) { y.push('<span onclick=showClearSshDialog(3) style=cursor:pointer>' + "SSH" + ' <img class=hoverButton src="images/link5.png" width=10 height=10 /></span>'); }
|
||||
if (node.rdp != null) { y.push('<span onclick=showClearRdpDialog(3) style=cursor:pointer>' + "RDP" + ' <img class=hoverButton src="images/link5.png" width=10 height=10 /></span>'); }
|
||||
} else {
|
||||
x += addDeviceAttribute("Credentials", "SSH");
|
||||
if (node.ssh != null) { y.push("SSH"); }
|
||||
if (node.rdp != null) { y.push("RDP"); }
|
||||
}
|
||||
x += addDeviceAttribute("Credentials", y.join(', '));
|
||||
}
|
||||
|
||||
x += '</table><br />';
|
||||
|
@ -3842,6 +3847,8 @@
|
|||
|
||||
function showClearSshDialog() { setDialogMode(2, "Edit Device", 3, showClearSshDialogEx, "Clear SSH credentials?"); }
|
||||
function showClearSshDialogEx(button, mode) { meshserver.send({ action: 'changedevice', nodeid: currentNode._id, ssh: 0 }); }
|
||||
function showClearRdpDialog() { setDialogMode(2, "Edit Device", 3, showClearRdpDialogEx, "Clear RDP credentials?"); }
|
||||
function showClearRdpDialogEx(button, mode) { meshserver.send({ action: 'changedevice', nodeid: currentNode._id, rdp: 0 }); }
|
||||
|
||||
var showEditNodeValueDialog_modes = ["Device Name", "Hostname", "Description", "Tags"];
|
||||
var showEditNodeValueDialog_modes2 = ['name', 'host', 'desc', 'tags'];
|
||||
|
|
|
@ -3000,6 +3000,7 @@
|
|||
node.gpsloc = message.event.node.gpsloc;
|
||||
node.tags = message.event.node.tags;
|
||||
node.ssh = message.event.node.ssh;
|
||||
node.rdp = message.event.node.rdp;
|
||||
node.userloc = message.event.node.userloc;
|
||||
node.rdpport = message.event.node.rdpport;
|
||||
node.rfbport = message.event.node.rfbport;
|
||||
|
@ -6506,13 +6507,17 @@
|
|||
x += addDeviceAttribute("Tags", groupingTags);
|
||||
}
|
||||
|
||||
// SSH Credentials
|
||||
if (node.ssh != null) {
|
||||
// SSH & RDP Credentials
|
||||
if ((node.ssh != null) || (node.rdp != null)) {
|
||||
var y = [];
|
||||
if ((meshrights & 4) != 0) {
|
||||
x += addDeviceAttribute("Credentials", '<span onclick=showClearSshDialog(3) style=cursor:pointer>' + "SSH" + ' <img class=hoverButton src="images/link5.png" width=10 height=10 /></span>');
|
||||
if (node.ssh != null) { y.push('<span onclick=showClearSshDialog(3) style=cursor:pointer>' + "SSH" + ' <img class=hoverButton src="images/link5.png" width=10 height=10 /></span>'); }
|
||||
if (node.rdp != null) { y.push('<span onclick=showClearRdpDialog(3) style=cursor:pointer>' + "RDP" + ' <img class=hoverButton src="images/link5.png" width=10 height=10 /></span>'); }
|
||||
} else {
|
||||
x += addDeviceAttribute("Credentials", "SSH");
|
||||
if (node.ssh != null) { y.push("SSH"); }
|
||||
if (node.rdp != null) { y.push("RDP"); }
|
||||
}
|
||||
x += addDeviceAttribute("Credentials", y.join(', '));
|
||||
}
|
||||
|
||||
x += '</table><br />';
|
||||
|
@ -7558,6 +7563,8 @@
|
|||
|
||||
function showClearSshDialog() { setDialogMode(2, "Edit Device", 3, showClearSshDialogEx, "Clear SSH credentials?"); }
|
||||
function showClearSshDialogEx(button, mode) { meshserver.send({ action: 'changedevice', nodeid: currentNode._id, ssh: 0 }); }
|
||||
function showClearRdpDialog() { setDialogMode(2, "Edit Device", 3, showClearRdpDialogEx, "Clear RDP credentials?"); }
|
||||
function showClearRdpDialogEx(button, mode) { meshserver.send({ action: 'changedevice', nodeid: currentNode._id, rdp: 0 }); }
|
||||
|
||||
var showEditNodeValueDialog_modes = ["Device Name", "Hostname", "Description", "Tags"];
|
||||
var showEditNodeValueDialog_modes2 = ['name', 'host', 'desc', 'tags'];
|
||||
|
|
|
@ -44,6 +44,10 @@
|
|||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.formDropdown {
|
||||
font-size: 17px;
|
||||
}
|
||||
|
||||
.formLabel { }
|
||||
|
||||
.formControl {
|
||||
|
@ -76,6 +80,7 @@
|
|||
var urlargs = parseUriArgs();
|
||||
if (urlargs.key && (isAlphaNumeric(urlargs.key) == false)) { delete urlargs.key; }
|
||||
var cookie = '{{{cookie}}}';
|
||||
var serverCredentials = (decodeURIComponent('{{{serverCredentials}}}') == 'true');
|
||||
var name = decodeURIComponent('{{{name}}}');
|
||||
if (name != '') { document.title = name + ' - ' + document.title; }
|
||||
|
||||
|
@ -90,6 +95,15 @@
|
|||
QE('inputPassword', false);
|
||||
QE('connectButton', false);
|
||||
}
|
||||
|
||||
if (serverCredentials == true) {
|
||||
QV('dropdowndomain', true);
|
||||
Q('d3coreMode').value = 1;
|
||||
} else {
|
||||
QV('dropdowndomain', false);
|
||||
Q('d3coreMode').value = 2;
|
||||
}
|
||||
dropDownChange();
|
||||
}
|
||||
|
||||
function connect(domain, username, password) {
|
||||
|
@ -97,11 +111,13 @@
|
|||
var domain = Q('inputDomain').value;
|
||||
var username = Q('inputUsername').value;
|
||||
var password = Q('inputPassword').value;
|
||||
var savepass = Q('inputSaveCredentials').checked;
|
||||
var options = { savepass: savepass, useServerCreds: (Q('d3coreMode').value == 1) };
|
||||
QV('myCanvas', true);
|
||||
QV('main', false);
|
||||
canvas.width = window.innerWidth;
|
||||
canvas.height = window.innerHeight;
|
||||
client.connect(cookie, domain, username, password, function (err) { QV('myCanvas', false); QV('main', true); });
|
||||
client.connect(cookie, domain, username, password, options, function (err) { QV('myCanvas', false); QV('main', true); });
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -137,6 +153,16 @@
|
|||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
function dropDownChange() {
|
||||
var newCreds = (Q('d3coreMode').value == 2);
|
||||
QV('rowdomain', newCreds);
|
||||
QV('rowusername', newCreds);
|
||||
QV('rowpassword', newCreds);
|
||||
QV('rowremember', newCreds);
|
||||
if (newCreds) Q('inputUsername').focus();
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body onload='load()' style="position:absolute;top:0px;right:0;left:0;bottom:0px">
|
||||
|
@ -147,18 +173,27 @@
|
|||
<tr>
|
||||
<td colspan="2"><hr style="color:gray;border:1px solid;" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr id="dropdowndomain" style="display:none">
|
||||
<td colspan="2">
|
||||
<select id=d3coreMode style=width:100%;margin-bottom:5px class="formDropdown" onchange="dropDownChange()"><option value=1>Use server credentals</option><option value=2>Use new credentals</option></select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="rowdomain" style="display:none">
|
||||
<td><label for="inputDomain" class="formLabel">Domain</label></td>
|
||||
<td style="text-align:right"><input type="text" id="inputDomain" class="formControl" placeholder="Domain"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr id="rowusername" style="display:none">
|
||||
<td><label for="inputUsername" class="formLabel">Username</label></td>
|
||||
<td style="text-align:right"><input type="text" id="inputUsername" class="formControl" placeholder="Username"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr id="rowpassword" style="display:none">
|
||||
<td><label for="inputPassword" class="formLabel">Password</label></td>
|
||||
<td style="text-align:right"><input type="password" id="inputPassword" class="formControl" placeholder="Password"></td>
|
||||
</tr>
|
||||
<tr id="rowremember" style="display:none">
|
||||
<td></td>
|
||||
<td><label><input type="checkbox" id="inputSaveCredentials" style="margin-left:8px;margin-right:5px">Remember credentials</label></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><button class="connectButton" onclick="return connect()">Connect</button></td>
|
||||
</tr>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue