Skip to content

Commit

Permalink
Fix #15915.
Browse files Browse the repository at this point in the history
  • Loading branch information
AliveDevil authored and dkocher committed May 7, 2024
1 parent a2e1792 commit 04c6107
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
import ch.cyberduck.core.diagnostics.ReachabilityDiagnosticsFactory;
import ch.cyberduck.core.diagnostics.ReachabilityFactory;
import ch.cyberduck.core.exception.HostParserException;
import ch.cyberduck.core.exception.LocalAccessDeniedException;
import ch.cyberduck.core.local.BrowserLauncherFactory;
import ch.cyberduck.core.preferences.Preferences;
import ch.cyberduck.core.preferences.PreferencesFactory;
Expand Down Expand Up @@ -454,18 +453,10 @@ public void change(final Host bookmark) {
if(StringUtils.isBlank(bookmark.getCredentials().getUsername())) {
return;
}
try {
final String password = keychain.getPassword(bookmark.getProtocol().getScheme(),
bookmark.getPort(),
bookmark.getHostname(),
bookmark.getCredentials().getUsername());
if(StringUtils.isNotBlank(password)) {
// Make sure password fetched from keychain and set in field is set in model
bookmark.getCredentials().setPassword(password);
}
}
catch(LocalAccessDeniedException e) {
// Ignore
final String password = keychain.findLoginPassword(bookmark);
if(StringUtils.isNotBlank(password)) {
// Make sure password fetched from keychain and set in field is set in model
bookmark.getCredentials().setPassword(password);
}
}
updateField(passwordField, bookmark.getCredentials().getPassword());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ protected BookmarkController(Host host, LoginInputValidator validator, LoginOpti
InitTimezones();
InitTransferModes();
Update();
ReadPasswordFromKeychain();

View.ChangedProtocolEvent += View_ChangedProtocolEvent;
View.ChangedProtocolEvent += ReadPasswordFromKeychain;
Expand Down Expand Up @@ -160,10 +161,7 @@ public void ReadPasswordFromKeychain()
{
return;
}
string password = _keychain.getPassword(_host.getProtocol().getScheme(),
_host.getPort(),
_host.getHostname(),
_host.getCredentials().getUsername());
string password = _keychain.findLoginPassword(_host);
if (!string.IsNullOrWhiteSpace(password))
{
View.Password = password;
Expand Down

0 comments on commit 04c6107

Please sign in to comment.