diff --git a/UI/MainUI/SOGoRootPage.m b/UI/MainUI/SOGoRootPage.m index ec821a042..d7b356f77 100644 --- a/UI/MainUI/SOGoRootPage.m +++ b/UI/MainUI/SOGoRootPage.m @@ -167,7 +167,7 @@ // // // -- (id ) connectAction +- (WOResponse *) connectAction { WOResponse *response; WORequest *request; @@ -212,12 +212,6 @@ [self logWithFormat: @"successful login from '%@' for user '%@' - expire = %d grace = %d", remoteHost, username, expire, grace]; - json = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt: expire], @"expire", - [NSNumber numberWithInt: grace], @"grace", nil]; - - response = [self responseWithStatus: 200 - andJSONRepresentation: json]; - // We get the proper username for cookie creation. If we are using a multidomain // environment with SOGoEnableDomainBasedUID, we could have to append the domain // to the username. Also when SOGoEnableDomainBasedUID is enabled, we could be in @@ -228,6 +222,16 @@ username = [[SOGoUserManager sharedUserManager] getUIDForEmail: username]; } + loggedInUser = [SOGoUser userWithLogin: username]; + + json = [NSDictionary dictionaryWithObjectsAndKeys: + [loggedInUser cn], @"cn", + [NSNumber numberWithInt: expire], @"expire", + [NSNumber numberWithInt: grace], @"grace", nil]; + + response = [self responseWithStatus: 200 + andJSONRepresentation: json]; + authCookie = [auth cookieWithUsername: username andPassword: password inContext: context]; @@ -242,7 +246,6 @@ supportedLanguages = [[SOGoSystemDefaults sharedSystemDefaults] supportedLanguages]; - loggedInUser = [SOGoUser userWithLogin: username]; [context setActiveUser: loggedInUser]; if (language && [supportedLanguages containsObject: language]) {