From 9653d1c1182255fc3ef9d8f534f64327f17465d1 Mon Sep 17 00:00:00 2001 From: viogroza Date: Tue, 17 Dec 2024 16:24:49 +0200 Subject: [PATCH] FTP: Replace menu (25.2) [STUD-73198] 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 --- .../UiPath.FTP.Activities/NetCore/MenuActionBuilder.cs | 5 ++--- .../NetCore/ViewModels/WithFtpSessionViewModel.cs | 4 ++-- Activities/FTP/UiPath.FTP.Activities/WithFtpSession.cs | 8 ++++++-- Activities/FTP/UiPath.FTP/Properties/UiPath.FTP.resx | 4 ++-- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Activities/FTP/UiPath.FTP.Activities/NetCore/MenuActionBuilder.cs b/Activities/FTP/UiPath.FTP.Activities/NetCore/MenuActionBuilder.cs index 312530dd1..137c3c9bf 100644 --- a/Activities/FTP/UiPath.FTP.Activities/NetCore/MenuActionBuilder.cs +++ b/Activities/FTP/UiPath.FTP.Activities/NetCore/MenuActionBuilder.cs @@ -75,13 +75,14 @@ public MenuActionsBuilder AddMenuProperty(DesignProperty property, T value, s /// /// For each of the stored properties, adds menu actions that represent all the other stored properties. /// - 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; @@ -91,8 +92,6 @@ public void BuildAndInsertMenuActions() }; foreach (var propertyInfo in _properties.Where(pi => pi != targetPropertyInfo)) { - - propertyInfo.Property.AddMenuAction(menuAction); } } diff --git a/Activities/FTP/UiPath.FTP.Activities/NetCore/ViewModels/WithFtpSessionViewModel.cs b/Activities/FTP/UiPath.FTP.Activities/NetCore/ViewModels/WithFtpSessionViewModel.cs index f402bfbdb..1a5f6525d 100644 --- a/Activities/FTP/UiPath.FTP.Activities/NetCore/ViewModels/WithFtpSessionViewModel.cs +++ b/Activities/FTP/UiPath.FTP.Activities/NetCore/ViewModels/WithFtpSessionViewModel.cs @@ -135,12 +135,12 @@ protected override void InitializeModel() MenuActionsBuilder.WithValueProperty(PasswordInputModeSwitch) .AddMenuProperty(Password, PasswordInputMode.Password) .AddMenuProperty(SecurePassword, PasswordInputMode.SecurePassword) - .BuildAndInsertMenuActions(); + .BuildAndInsertMenuActions(true); MenuActionsBuilder.WithValueProperty(CertificatePasswordInputModeSwitch) .AddMenuProperty(ClientCertificatePassword, PasswordInputMode.Password) .AddMenuProperty(ClientCertificateSecurePassword, PasswordInputMode.SecurePassword) - .BuildAndInsertMenuActions(); + .BuildAndInsertMenuActions(true); } /// diff --git a/Activities/FTP/UiPath.FTP.Activities/WithFtpSession.cs b/Activities/FTP/UiPath.FTP.Activities/WithFtpSession.cs index 425188ca0..676cf59e6 100644 --- a/Activities/FTP/UiPath.FTP.Activities/WithFtpSession.cs +++ b/Activities/FTP/UiPath.FTP.Activities/WithFtpSession.cs @@ -173,13 +173,17 @@ protected override async Task> 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); diff --git a/Activities/FTP/UiPath.FTP/Properties/UiPath.FTP.resx b/Activities/FTP/UiPath.FTP/Properties/UiPath.FTP.resx index d1ec4de10..22a32d344 100644 --- a/Activities/FTP/UiPath.FTP/Properties/UiPath.FTP.resx +++ b/Activities/FTP/UiPath.FTP/Properties/UiPath.FTP.resx @@ -136,9 +136,9 @@ The destination directory already exists - Toggle to text input + Use string - Toggle to Secure input + Use secure string \ No newline at end of file