Skip to content

Commit

Permalink
FTP: Replace menu (25.2) [STUD-73198]
Browse files Browse the repository at this point in the history
Make the toggle between string and secure string
At runtime use the actual mode instead of using password and if not set fallback to secure password
  • Loading branch information
viogroza committed Dec 17, 2024
1 parent 514fd2b commit 9653d1c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,14 @@ public MenuActionsBuilder<T> AddMenuProperty(DesignProperty property, T value, s
/// <summary>
/// For each of the stored properties, adds <see cref="MenuAction">menu actions</see> that represent all the other stored properties.
/// </summary>
public void BuildAndInsertMenuActions()
public void BuildAndInsertMenuActions(bool isMain)
{
foreach (var targetPropertyInfo in _properties)
{
var menuAction = new MenuAction
{
DisplayName = targetPropertyInfo.DisplayName,
IsMain = isMain,
Handler = _ =>
{
_valueProperty.Value = targetPropertyInfo.Value;
Expand All @@ -91,8 +92,6 @@ public void BuildAndInsertMenuActions()
};
foreach (var propertyInfo in _properties.Where(pi => pi != targetPropertyInfo))
{


propertyInfo.Property.AddMenuAction(menuAction);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,12 @@ protected override void InitializeModel()
MenuActionsBuilder<PasswordInputMode>.WithValueProperty(PasswordInputModeSwitch)
.AddMenuProperty(Password, PasswordInputMode.Password)
.AddMenuProperty(SecurePassword, PasswordInputMode.SecurePassword)
.BuildAndInsertMenuActions();
.BuildAndInsertMenuActions(true);

MenuActionsBuilder<PasswordInputMode>.WithValueProperty(CertificatePasswordInputModeSwitch)
.AddMenuProperty(ClientCertificatePassword, PasswordInputMode.Password)
.AddMenuProperty(ClientCertificateSecurePassword, PasswordInputMode.SecurePassword)
.BuildAndInsertMenuActions();
.BuildAndInsertMenuActions(true);
}

/// <inheritdoc/>
Expand Down
8 changes: 6 additions & 2 deletions Activities/FTP/UiPath.FTP.Activities/WithFtpSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,17 @@ protected override async Task<Action<NativeActivityContext>> ExecuteAsync(Native
ftpConfiguration.Port = Port.Expression == null ? null : (int?)Port.Get(context);
ftpConfiguration.UseAnonymousLogin = UseAnonymousLogin;
ftpConfiguration.SslProtocols = SslProtocols;
ftpConfiguration.Password = passwordValue;
ftpConfiguration.ProxyType = ProxyType;

if (ftpConfiguration.Password == null)
if (PasswordInputModeSwitch == PasswordInputMode.Password)
{
ftpConfiguration.Password = passwordValue;
}
else
{
ftpConfiguration.Password = new NetworkCredential("", securePasswordValue).Password;
}

if(ftpConfiguration.ProxyType != FtpProxyType.None)
{
ftpConfiguration.ProxyServer = ProxyServer.Get(context);
Expand Down
4 changes: 2 additions & 2 deletions Activities/FTP/UiPath.FTP/Properties/UiPath.FTP.resx
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@
<value>The destination directory already exists</value>
</data>
<data name="Password" xml:space="preserve">
<value>Toggle to text input</value>
<value>Use string</value>
</data>
<data name="SecurePassword" xml:space="preserve">
<value>Toggle to Secure input</value>
<value>Use secure string</value>
</data>
</root>

0 comments on commit 9653d1c

Please sign in to comment.