mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
fallback to empty credentials settings in external apps #492
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using mRemoteNG.Connection;
|
||||
using mRemoteNG.Security.SymmetricEncryption;
|
||||
using mRemoteNG.App;
|
||||
|
||||
namespace mRemoteNG.Tools
|
||||
{
|
||||
@@ -169,12 +171,26 @@ namespace mRemoteNG.Tools
|
||||
break;
|
||||
case "username":
|
||||
replacement = _connectionInfo.Username;
|
||||
if (string.IsNullOrEmpty(replacement))
|
||||
if (Settings.Default.EmptyCredentials == "windows")
|
||||
replacement = Environment.UserName;
|
||||
else if (Settings.Default.EmptyCredentials == "custom")
|
||||
replacement = Settings.Default.DefaultUsername;
|
||||
break;
|
||||
case "password":
|
||||
replacement = _connectionInfo.Password;
|
||||
if (string.IsNullOrEmpty(replacement) && Settings.Default.EmptyCredentials == "custom")
|
||||
replacement = new LegacyRijndaelCryptographyProvider()
|
||||
.Decrypt(Convert.ToString(Settings.Default.DefaultPassword),
|
||||
Runtime.EncryptionKey);
|
||||
break;
|
||||
case "domain":
|
||||
replacement = _connectionInfo.Domain;
|
||||
if (string.IsNullOrEmpty(replacement))
|
||||
if (Settings.Default.EmptyCredentials == "windows")
|
||||
replacement = Environment.UserDomainName;
|
||||
else if (Settings.Default.EmptyCredentials == "custom")
|
||||
replacement = Settings.Default.DefaultDomain;
|
||||
break;
|
||||
case "description":
|
||||
replacement = _connectionInfo.Description;
|
||||
|
||||
Reference in New Issue
Block a user