diff options
author | Abhi Beckert <me@abhibeckert.com> | 2017-01-04 15:03:22 +1000 |
---|---|---|
committer | Abhi Beckert <me@abhibeckert.com> | 2017-01-04 15:03:22 +1000 |
commit | 357468e4c570a48dac02b946532c976a7dd88e0c (patch) | |
tree | 8eae287de6710f373d5e986563f05dd8814972f1 /Source/SPUserManager.m | |
parent | 7b01b5b98b9ea1076488115b97fb64ece702c688 (diff) | |
parent | 578c5959aea1f94cc176a2f27a5c3640a5f3b9c6 (diff) | |
download | sequelpro-357468e4c570a48dac02b946532c976a7dd88e0c.tar.gz sequelpro-357468e4c570a48dac02b946532c976a7dd88e0c.tar.bz2 sequelpro-357468e4c570a48dac02b946532c976a7dd88e0c.zip |
Merge remote-tracking branch 'sequelpro/master'
Diffstat (limited to 'Source/SPUserManager.m')
-rw-r--r-- | Source/SPUserManager.m | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/Source/SPUserManager.m b/Source/SPUserManager.m index 3fe37ae7..8280242f 100644 --- a/Source/SPUserManager.m +++ b/Source/SPUserManager.m @@ -1078,10 +1078,21 @@ static NSString * const SPTableViewNameColumnID = @"NameColumn"; NSString *idString; if(requiresPost576PasswordHandling) { - //copy the hash from the parent. if the parent password changes at the same time, updateUser: will take care of it afterwards - NSString *plugin = [[[user parent] valueForKey:@"plugin"] tickQuotedString]; - NSString *hash = [[[user parent] valueForKey:@"authentication_string"] tickQuotedString]; - idString = [NSString stringWithFormat:@"IDENTIFIED WITH %@ AS %@",plugin,hash]; + // there are three situations to cover here: + // 1) host added, parent user unchanged + // 2) host added, parent user password changed + // 3) host added, parent user is new + if([[user parent] valueForKey:@"originaluser"]) { + // 1 & 2: If the parent user already exists we always use the old password hash. if the parent password changes at the same time, updateUser: will take care of it afterwards + NSString *plugin = [[[user parent] valueForKey:@"plugin"] tickQuotedString]; + NSString *hash = [[[user parent] valueForKey:@"authentication_string"] tickQuotedString]; + idString = [NSString stringWithFormat:@"IDENTIFIED WITH %@ AS %@",plugin,hash]; + } + else { + // 3: If the user is new, we take the plaintext password value from the UI + NSString *password = [[[user parent] valueForKey:@"password"] tickQuotedString]; + idString = [NSString stringWithFormat:@"IDENTIFIED BY %@",password]; + } } else { BOOL passwordIsHash; |