(fix) avoid double-appending domain in cache (fixes #3614)
parent
117af61609
commit
2774878fa2
|
@ -398,7 +398,7 @@ static Class NSNullK;
|
|||
{
|
||||
NSDictionary *info;
|
||||
SOGoSystemDefaults *sd;
|
||||
NSString *uid, *domain;
|
||||
NSString *uid, *domain, *suffix;
|
||||
|
||||
info = [self contactInfosForUserWithUIDorEmail: email];
|
||||
uid = [info objectForKey: @"c_uid"];
|
||||
|
@ -408,7 +408,11 @@ static Class NSNullK;
|
|||
&& ![[info objectForKey: @"DomainLessLogin"] boolValue])
|
||||
{
|
||||
domain = [info objectForKey: @"c_domain"];
|
||||
uid = [NSString stringWithFormat: @"%@@%@", uid, domain];
|
||||
suffix = [NSString stringWithFormat: @"@%@", domain];
|
||||
|
||||
// Don't add @domain suffix if it's already there
|
||||
if (![uid hasSuffix: suffix])
|
||||
uid = [NSString stringWithFormat: @"%@%@", uid, suffix];
|
||||
}
|
||||
|
||||
return uid;
|
||||
|
@ -1039,8 +1043,15 @@ static Class NSNullK;
|
|||
// multi-domain environments authenticating only with the UIDFieldName
|
||||
if ([sd enableDomainBasedUID] && !domain)
|
||||
{
|
||||
cacheUid = [NSString stringWithFormat: @"%@@%@", cacheUid, [currentUser objectForKey: @"c_domain"]];
|
||||
[currentUser setObject: [NSNumber numberWithBool: YES] forKey: @"DomainLessLogin"];
|
||||
NSString *suffix;
|
||||
|
||||
suffix = [NSString stringWithFormat: @"@%@", [currentUser objectForKey: @"c_domain"]];
|
||||
|
||||
if (![cacheUid hasSuffix: suffix])
|
||||
{
|
||||
cacheUid = [NSString stringWithFormat: @"%@%@", cacheUid, suffix];
|
||||
[currentUser setObject: [NSNumber numberWithBool: YES] forKey: @"DomainLessLogin"];
|
||||
}
|
||||
}
|
||||
|
||||
[self _retainUser: currentUser withLogin: cacheUid];
|
||||
|
|
|
@ -224,7 +224,7 @@
|
|||
// has all the logic for this, so lets use it.
|
||||
if ([domain isNotNull])
|
||||
{
|
||||
username = [[SOGoUserManager sharedUserManager] getUIDForEmail: username];
|
||||
username = [[SOGoUserManager sharedUserManager] getUIDForEmail: username];
|
||||
}
|
||||
|
||||
authCookie = [auth cookieWithUsername: username
|
||||
|
|
Loading…
Reference in New Issue