Merge pull request #94 from Zentyal/jgarcia/reset-password

Fix change password with multidomains
pull/65/merge^2
Jesús García Sáez 2015-02-26 10:48:58 +01:00
commit 85d9440ccd
1 changed files with 11 additions and 8 deletions

View File

@ -595,10 +595,11 @@ static Class NSNullK;
newPassword: (NSString *) newPassword
perr: (SOGoPasswordPolicyError *) perr
{
NSString *jsonUser;
NSString *jsonUser, *userLogin;
NSMutableDictionary *currentUser;
BOOL didChange;
SOGoSystemDefaults *sd;
jsonUser = [[SOGoCache sharedCache] userAttributesForLogin: login];
currentUser = [jsonUser objectFromJSONString];
@ -611,9 +612,7 @@ static Class NSNullK;
didChange = YES;
if (!currentUser)
{
currentUser = [NSMutableDictionary dictionary];
}
currentUser = [NSMutableDictionary dictionary];
// It's important to cache the password here as we might have cached the
// user's entry in -contactInfosForUserWithUIDorEmail: and if we don't
@ -621,9 +620,13 @@ static Class NSNullK;
// cached for the user unless its entry expires from memcached's
// internal cache.
[currentUser setObject: [newPassword asSHA1String] forKey: @"password"];
[[SOGoCache sharedCache]
setUserAttributes: [currentUser jsonRepresentation]
forLogin: login];
sd = [SOGoSystemDefaults sharedSystemDefaults];
if ([sd enableDomainBasedUID])
userLogin = [NSString stringWithFormat: @"%@@%@", login, domain];
else
userLogin = login;
[[SOGoCache sharedCache] setUserAttributes: [currentUser jsonRepresentation]
forLogin: userLogin];
}
else
didChange = NO;