From 41c6a1af0b7540c53a9de2e76c67b33ff56e907e Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Mon, 4 Jun 2012 22:34:15 +0000 Subject: - Fix loss of password on certain connection editing actions (type changes, localhost/127.0.0.1 auto-type changes) --- Source/SPConnectionController.m | 11 +++++++++++ Source/SPConnectionHandler.m | 1 + 2 files changed, 12 insertions(+) diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m index 337fed11..8aa6ef54 100644 --- a/Source/SPConnectionController.m +++ b/Source/SPConnectionController.m @@ -1065,9 +1065,11 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, if (returnCode == NSAlertAlternateReturn) { [self setType:SPSocketConnection]; [self setHost:@""]; + [self _updateFavoritePasswordsFromField:standardSQLHostField]; } else { [self setHost:@"127.0.0.1"]; + [self _updateFavoritePasswordsFromField:standardSQLHostField]; } } @@ -1222,6 +1224,15 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, (([favorite objectForKey:SPFavoriteHostKey]) ? [favorite valueForKeyPath:SPFavoriteHostKey] : @"")) ]]; } + + // Trigger a password change + if (previousType == SPSocketConnection) { + [self _updateFavoritePasswordsFromField:socketPasswordField]; + } else if (previousType == SPSSHTunnelConnection) { + [self _updateFavoritePasswordsFromField:sshPasswordField]; + } else { + [self _updateFavoritePasswordsFromField:standardPasswordField]; + } } /** diff --git a/Source/SPConnectionHandler.m b/Source/SPConnectionHandler.m index cc2e1d84..ca488872 100644 --- a/Source/SPConnectionHandler.m +++ b/Source/SPConnectionHandler.m @@ -452,6 +452,7 @@ static NSString *SPLocalhostAddress = @"127.0.0.1"; // Change connection details [self setPort:tunnelPort]; [self setHost:SPLocalhostAddress]; + [self _updateFavoritePasswordsFromField:standardSQLHostField]; // Change to standard TCP/IP connection view [self resizeTabViewToConnectionType:SPTCPIPConnection animating:YES]; -- cgit v1.2.3