(fix) make sure to handle nil vs. NSNull values correctly
parent
4b4846b0a3
commit
0655e9d76e
|
@ -610,6 +610,9 @@ static Class NSNullK;
|
|||
jsonUser = [[SOGoCache sharedCache] userAttributesForLogin: username];
|
||||
currentUser = [jsonUser objectFromJSONString];
|
||||
|
||||
if ([currentUser isKindOfClass: NSNullK])
|
||||
currentUser = nil;
|
||||
|
||||
//
|
||||
// If we are using multidomain and the UIDFieldName is not part of the email address
|
||||
// we must bind without the domain part since internally, SOGo will use
|
||||
|
@ -623,7 +626,7 @@ static Class NSNullK;
|
|||
// and authenticates with "foo", using bindFields = (uid, mail) and SOGoEnableDomainBasedUID = YES;
|
||||
// Otherwise, -_sourceCheckLogin:... would have failed because SOGo would try to bind using: foo@example.com
|
||||
//
|
||||
if ([[currentUser objectForKey: @"DomainLessLogin"] boolValue])
|
||||
if (currentUser && [[currentUser objectForKey: @"DomainLessLogin"] boolValue])
|
||||
{
|
||||
NSRange r;
|
||||
|
||||
|
@ -631,7 +634,7 @@ static Class NSNullK;
|
|||
_login = [_login substringToIndex: r.location];
|
||||
}
|
||||
|
||||
dictPassword = [currentUser objectForKey: @"password"];
|
||||
dictPassword = (currentUser ? [currentUser objectForKey: @"password"] : nil);
|
||||
if (useCache && currentUser && dictPassword)
|
||||
{
|
||||
checkOK = ([dictPassword isEqualToString: [_pwd asSHA1String]]);
|
||||
|
@ -723,6 +726,9 @@ static Class NSNullK;
|
|||
jsonUser = [[SOGoCache sharedCache] userAttributesForLogin: login];
|
||||
currentUser = [jsonUser objectFromJSONString];
|
||||
|
||||
if ([currentUser isKindOfClass: NSNullK])
|
||||
currentUser = nil;
|
||||
|
||||
if ([self _sourceChangePasswordForLogin: login
|
||||
inDomain: domain
|
||||
oldPassword: oldPassword
|
||||
|
|
Loading…
Reference in New Issue