See ChangeLog
Monotone-Parent: c0fdc871e5cf2faadbed16ce1c4275647d0928b4 Monotone-Revision: 178cf4e5311729ac333305676b5ad2aa35a7ca71 Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2011-06-24T19:19:50 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
parent
abbffe7740
commit
f44212f0e6
47
ChangeLog
47
ChangeLog
|
@ -1,3 +1,50 @@
|
||||||
|
2011-06-24 Francis Lachapelle <flachapelle@inverse.ca>
|
||||||
|
|
||||||
|
* SoObjects/SOGo/SOGoSystemDefaults.m (-loginDomains): new method
|
||||||
|
that returns the content of the defaults key SOGoLoginDomains, which
|
||||||
|
is a list of domains that should be selectable from the Web login page.
|
||||||
|
(-visibleDomainsForDomain:): new method that returns a list of
|
||||||
|
domains visible from the specified domain and defined by the
|
||||||
|
defaults key SOGoDomainsVisibility, which is a list of lists of domains.
|
||||||
|
|
||||||
|
* SoObjects/SOGo/SQLSource.m
|
||||||
|
(-_lookupContactEntry:considerEmail:): when an IMAP login field is
|
||||||
|
defined, only consider the value from the table if it's not null.
|
||||||
|
|
||||||
|
* SoObjects/SOGo/SOGoSession.m
|
||||||
|
(+decodeValue:usingKey:login:domain:password:): now accepts the
|
||||||
|
form login@domain. The domain must be part of the SOGoLoginDomains.
|
||||||
|
|
||||||
|
* SoObjects/SOGo/SOGoUserManager.m
|
||||||
|
(-getImapLoginForUID:inDomain:): the method now accepts the
|
||||||
|
user's domain.
|
||||||
|
(_sourceCheckLogin:andPassword:domain:perr:expire:grace:): idem.
|
||||||
|
(checkLogin:password:domain:perr:expire:grace:): idem.
|
||||||
|
(_fillContactInfosForUser:withUIDorEmail:inDomain:): idem.
|
||||||
|
(-contactInfosForUserWithUIDorEmail:inDomain:): idem.
|
||||||
|
(-contactInfosForUserWithUIDorEmail:): now accepts the form login@domain.
|
||||||
|
|
||||||
|
* SoObjects/SOGo/SOGoWebAuthenticator.m (-checkCredentials:):
|
||||||
|
perform the authentication in a domain when specified in the
|
||||||
|
web session.
|
||||||
|
|
||||||
|
* SoObjects/Contacts/SOGoContactFolders.m (-appendSystemSources):
|
||||||
|
when using domains, append addressbooks from visible domains.
|
||||||
|
|
||||||
|
* SoObjects/SOGo/SOGoUser.m (-initWithLogin:roles:trust:): now
|
||||||
|
accepts the form login@domain.
|
||||||
|
(-loginInDomain): new method. When bound to a domain, it returns
|
||||||
|
the username part of the login.
|
||||||
|
|
||||||
|
* UI/MainUI/SOGoUserHomePage.m (-_usersForResults:inDomain:): was
|
||||||
|
_usersResponseForResults:. Now returns only an array
|
||||||
|
containing the matching users.
|
||||||
|
(-usersSearchAction): added the results from the visible domains,
|
||||||
|
if the defaults key SOGoDomainsVisibility is defined.
|
||||||
|
|
||||||
|
* UI/MainUI/SOGoRootPage.m (-connectAction): a domain from the
|
||||||
|
defaults key SOGoLoginDomains can now be received.
|
||||||
|
|
||||||
2011-06-23 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
2011-06-23 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
|
||||||
* OpenChange/MAPIStoreTypes.h: removed PRIx64 definitions, that
|
* OpenChange/MAPIStoreTypes.h: removed PRIx64 definitions, that
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#import <SOGo/SOGoUser.h>
|
#import <SOGo/SOGoUser.h>
|
||||||
#import <SOGo/SOGoUserDefaults.h>
|
#import <SOGo/SOGoUserDefaults.h>
|
||||||
#import <SOGo/SOGoUserManager.h>
|
#import <SOGo/SOGoUserManager.h>
|
||||||
|
#import <SOGo/SOGoSystemDefaults.h>
|
||||||
#import <SOGo/WORequest+SOGo.h>
|
#import <SOGo/WORequest+SOGo.h>
|
||||||
|
|
||||||
#import "SOGoContactGCSFolder.h"
|
#import "SOGoContactGCSFolder.h"
|
||||||
|
@ -62,7 +63,8 @@
|
||||||
- (NSException *) appendSystemSources
|
- (NSException *) appendSystemSources
|
||||||
{
|
{
|
||||||
SOGoUserManager *um;
|
SOGoUserManager *um;
|
||||||
NSEnumerator *sourceIDs;
|
SOGoSystemDefaults *sd;
|
||||||
|
NSEnumerator *sourceIDs, *domains;
|
||||||
NSString *currentSourceID, *srcDisplayName, *domain;
|
NSString *currentSourceID, *srcDisplayName, *domain;
|
||||||
SOGoContactSourceFolder *currentFolder;
|
SOGoContactSourceFolder *currentFolder;
|
||||||
SOGoUser *currentUser;
|
SOGoUser *currentUser;
|
||||||
|
@ -75,18 +77,24 @@
|
||||||
{
|
{
|
||||||
domain = [currentUser domain];
|
domain = [currentUser domain];
|
||||||
um = [SOGoUserManager sharedUserManager];
|
um = [SOGoUserManager sharedUserManager];
|
||||||
sourceIDs = [[um addressBookSourceIDsInDomain: domain]
|
sd = [SOGoSystemDefaults sharedSystemDefaults];
|
||||||
objectEnumerator];
|
domains = [[sd visibleDomainsForDomain: domain] objectEnumerator];
|
||||||
while ((currentSourceID = [sourceIDs nextObject]))
|
while (domain)
|
||||||
{
|
{
|
||||||
srcDisplayName
|
sourceIDs = [[um addressBookSourceIDsInDomain: domain]
|
||||||
= [um displayNameForSourceWithID: currentSourceID];
|
objectEnumerator];
|
||||||
currentFolder = [SOGoContactSourceFolder
|
while ((currentSourceID = [sourceIDs nextObject]))
|
||||||
folderWithName: currentSourceID
|
{
|
||||||
andDisplayName: srcDisplayName
|
srcDisplayName
|
||||||
inContainer: self];
|
= [um displayNameForSourceWithID: currentSourceID];
|
||||||
[currentFolder setSource: [um sourceWithID: currentSourceID]];
|
currentFolder = [SOGoContactSourceFolder
|
||||||
[subFolders setObject: currentFolder forKey: currentSourceID];
|
folderWithName: currentSourceID
|
||||||
|
andDisplayName: srcDisplayName
|
||||||
|
inContainer: self];
|
||||||
|
[currentFolder setSource: [um sourceWithID: currentSourceID]];
|
||||||
|
[subFolders setObject: currentFolder forKey: currentSourceID];
|
||||||
|
}
|
||||||
|
domain = [domains nextObject];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
* Copyright (C) 2010-2011 Inverse inc.
|
* Copyright (C) 2010-2011 Inverse inc.
|
||||||
*
|
*
|
||||||
* Author: Ludovic Marcotte <lmarcotte@inverse.ca>
|
* Author: Ludovic Marcotte <lmarcotte@inverse.ca>
|
||||||
|
* Francis Lachapelle <flachapelle@inverse.ca>
|
||||||
*
|
*
|
||||||
* This file is free software; you can redistribute it and/or modify
|
* This file is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -40,6 +41,7 @@
|
||||||
+ (void) decodeValue: (NSString *) theValue
|
+ (void) decodeValue: (NSString *) theValue
|
||||||
usingKey: (NSString *) theKey
|
usingKey: (NSString *) theKey
|
||||||
login: (NSString **) theLogin
|
login: (NSString **) theLogin
|
||||||
|
domain: (NSString **) theDomain
|
||||||
password: (NSString **) thePassword;
|
password: (NSString **) thePassword;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
* Copyright (C) 2010-2011 Inverse inc.
|
* Copyright (C) 2010-2011 Inverse inc.
|
||||||
*
|
*
|
||||||
* Author: Ludovic Marcotte <lmarcotte@inverse.ca>
|
* Author: Ludovic Marcotte <lmarcotte@inverse.ca>
|
||||||
|
* Francis Lachapelle <flachapelle@inverse.ca>
|
||||||
|
|
||||||
*
|
*
|
||||||
* This file is free software; you can redistribute it and/or modify
|
* This file is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -24,6 +26,7 @@
|
||||||
|
|
||||||
#include "SOGoCache.h"
|
#include "SOGoCache.h"
|
||||||
|
|
||||||
|
#import <Foundation/NSArray.h>
|
||||||
#import <Foundation/NSData.h>
|
#import <Foundation/NSData.h>
|
||||||
#import <Foundation/NSDictionary.h>
|
#import <Foundation/NSDictionary.h>
|
||||||
|
|
||||||
|
@ -38,6 +41,8 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#import "SOGoSystemDefaults.h"
|
||||||
|
|
||||||
@implementation SOGoSession
|
@implementation SOGoSession
|
||||||
|
|
||||||
+ (NSString *) valueForSessionKey: (NSString *) theSessionKey
|
+ (NSString *) valueForSessionKey: (NSString *) theSessionKey
|
||||||
|
@ -221,16 +226,24 @@
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/**
|
||||||
//
|
*
|
||||||
//
|
* @param theValue
|
||||||
|
* @param theKey
|
||||||
|
* @param theLogin
|
||||||
|
* @param theDomain
|
||||||
|
* @param thePassword
|
||||||
|
* @see [SOGoUser initWithLogin:roles:trust:]
|
||||||
|
*/
|
||||||
+ (void) decodeValue: (NSString *) theValue
|
+ (void) decodeValue: (NSString *) theValue
|
||||||
usingKey: (NSString *) theKey
|
usingKey: (NSString *) theKey
|
||||||
login: (NSString **) theLogin
|
login: (NSString **) theLogin
|
||||||
|
domain: (NSString **) theDomain
|
||||||
password: (NSString **) thePassword
|
password: (NSString **) thePassword
|
||||||
{
|
{
|
||||||
NSString *decodedValue;
|
NSString *decodedValue;
|
||||||
NSRange r;
|
NSRange r;
|
||||||
|
SOGoSystemDefaults *sd;
|
||||||
|
|
||||||
decodedValue = [SOGoSession valueFromSecuredValue: theValue
|
decodedValue = [SOGoSession valueFromSecuredValue: theValue
|
||||||
usingKey: theKey];
|
usingKey: theKey];
|
||||||
|
@ -238,6 +251,21 @@
|
||||||
r = [decodedValue rangeOfString: @":"];
|
r = [decodedValue rangeOfString: @":"];
|
||||||
*theLogin = [decodedValue substringToIndex: r.location];
|
*theLogin = [decodedValue substringToIndex: r.location];
|
||||||
*thePassword = [decodedValue substringFromIndex: r.location+1];
|
*thePassword = [decodedValue substringFromIndex: r.location+1];
|
||||||
|
|
||||||
|
r = [*theLogin rangeOfString: @"@" options: NSBackwardsSearch];
|
||||||
|
if (r.location != NSNotFound)
|
||||||
|
{
|
||||||
|
// The domain is probably appended to the username;
|
||||||
|
// make sure it is defined as a login domain in the configuration.
|
||||||
|
sd = [SOGoSystemDefaults sharedSystemDefaults];
|
||||||
|
*theDomain = [*theLogin substringFromIndex: (r.location + r.length)];
|
||||||
|
if ([[sd loginDomains] containsObject: *theDomain])
|
||||||
|
*theLogin = [*theLogin substringToIndex: r.location];
|
||||||
|
else
|
||||||
|
*theDomain = nil;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
*theDomain = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
/* SOGoSystemDefaults.h - this file is part of SOGo
|
/* SOGoSystemDefaults.h - this file is part of SOGo
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009-2010 Inverse inc.
|
* Copyright (C) 2009-2011 Inverse inc.
|
||||||
*
|
*
|
||||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
* Francis Lachapelle <flachapelle@inverse.ca>
|
||||||
*
|
*
|
||||||
* This file is free software; you can redistribute it and/or modify
|
* This file is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -26,10 +27,15 @@
|
||||||
#import <SOGo/SOGoDomainDefaults.h>
|
#import <SOGo/SOGoDomainDefaults.h>
|
||||||
|
|
||||||
@interface SOGoSystemDefaults : SOGoDomainDefaults
|
@interface SOGoSystemDefaults : SOGoDomainDefaults
|
||||||
|
{
|
||||||
|
NSArray *loginDomains;
|
||||||
|
}
|
||||||
|
|
||||||
+ (SOGoSystemDefaults *) sharedSystemDefaults;
|
+ (SOGoSystemDefaults *) sharedSystemDefaults;
|
||||||
|
|
||||||
- (NSArray *) domainIds;
|
- (NSArray *) domainIds;
|
||||||
|
- (NSArray *) loginDomains;
|
||||||
|
- (NSArray *) visibleDomainsForDomain: (NSString *) domain;
|
||||||
|
|
||||||
- (BOOL) crashOnSessionCreate;
|
- (BOOL) crashOnSessionCreate;
|
||||||
- (BOOL) debugRequests;
|
- (BOOL) debugRequests;
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
/* SOGoSystemDefaults.m - this file is part of SOGo
|
/* SOGoSystemDefaults.m - this file is part of SOGo
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009-2010 Inverse inc.
|
* Copyright (C) 2009-2011 Inverse inc.
|
||||||
*
|
*
|
||||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
* Francis Lachapelle <flachapelle@inverse.ca>
|
||||||
*
|
*
|
||||||
* This file is free software; you can redistribute it and/or modify
|
* This file is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -23,13 +24,15 @@
|
||||||
#import <dlfcn.h>
|
#import <dlfcn.h>
|
||||||
#import <unistd.h>
|
#import <unistd.h>
|
||||||
|
|
||||||
|
#import <Foundation/NSArray.h>
|
||||||
#import <Foundation/NSBundle.h>
|
#import <Foundation/NSBundle.h>
|
||||||
#import <Foundation/NSFileManager.h>
|
#import <Foundation/NSFileManager.h>
|
||||||
#import <Foundation/NSString.h>
|
#import <Foundation/NSFileManager.h>
|
||||||
#import <Foundation/NSUserDefaults.h>
|
#import <Foundation/NSUserDefaults.h>
|
||||||
|
|
||||||
#import <NGExtensions/NSObject+Logs.h>
|
#import <NGExtensions/NSObject+Logs.h>
|
||||||
|
|
||||||
|
#import "NSArray+Utilities.h"
|
||||||
#import "NSDictionary+Utilities.h"
|
#import "NSDictionary+Utilities.h"
|
||||||
#import "SOGoStartupLogger.h"
|
#import "SOGoStartupLogger.h"
|
||||||
|
|
||||||
|
@ -152,6 +155,22 @@ BootstrapNSUserDefaults ()
|
||||||
return sharedSystemDefaults;
|
return sharedSystemDefaults;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (id) init
|
||||||
|
{
|
||||||
|
if ((self = [super init]))
|
||||||
|
{
|
||||||
|
loginDomains = nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) dealloc
|
||||||
|
{
|
||||||
|
[loginDomains release];
|
||||||
|
[super dealloc];
|
||||||
|
}
|
||||||
|
|
||||||
- (BOOL) migrate
|
- (BOOL) migrate
|
||||||
{
|
{
|
||||||
static NSDictionary *migratedKeys = nil;
|
static NSDictionary *migratedKeys = nil;
|
||||||
|
@ -174,6 +193,61 @@ BootstrapNSUserDefaults ()
|
||||||
return [[self dictionaryForKey: @"domains"] allKeys];
|
return [[self dictionaryForKey: @"domains"] allKeys];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSArray *) loginDomains
|
||||||
|
{
|
||||||
|
NSMutableArray *filteredLoginDomains;
|
||||||
|
NSArray *domains;
|
||||||
|
NSEnumerator *objects;
|
||||||
|
id currentObject;
|
||||||
|
|
||||||
|
if (self->loginDomains == nil)
|
||||||
|
{
|
||||||
|
filteredLoginDomains = [NSMutableArray arrayWithArray: [self stringArrayForKey: @"SOGoLoginDomains"]];
|
||||||
|
domains = [self domainIds];
|
||||||
|
objects = [filteredLoginDomains objectEnumerator];
|
||||||
|
while ((currentObject = [objects nextObject]))
|
||||||
|
{
|
||||||
|
if (![domains containsObject: currentObject])
|
||||||
|
{
|
||||||
|
[filteredLoginDomains removeObject: currentObject];
|
||||||
|
[self warnWithFormat: @"SOGoLoginDomains contains an invalid domain : %@", currentObject];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ASSIGN (self->loginDomains, filteredLoginDomains);
|
||||||
|
}
|
||||||
|
|
||||||
|
return self->loginDomains;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSArray *) visibleDomainsForDomain: (NSString *) domain
|
||||||
|
{
|
||||||
|
NSMutableArray *domains;
|
||||||
|
NSArray *definedDomains, *visibleDomains, *currentGroup;
|
||||||
|
NSEnumerator *groups;
|
||||||
|
NSString *currentDomain;
|
||||||
|
|
||||||
|
definedDomains = [self domainIds];
|
||||||
|
visibleDomains = [self arrayForKey: @"SOGoDomainsVisibility"];
|
||||||
|
domains = [NSMutableArray array];
|
||||||
|
groups = [visibleDomains objectEnumerator];
|
||||||
|
while ((currentGroup = (NSArray *)[groups nextObject]))
|
||||||
|
{
|
||||||
|
if ([currentGroup containsObject: domain])
|
||||||
|
[domains addObjectsFromArray: currentGroup];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove lookup domain from list
|
||||||
|
groups = [domains objectEnumerator];
|
||||||
|
while ((currentDomain = [groups nextObject]))
|
||||||
|
{
|
||||||
|
if ([currentDomain isEqualToString: domain])
|
||||||
|
[domains removeObject: currentDomain];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [domains uniqueObjects];
|
||||||
|
}
|
||||||
|
|
||||||
/* System-level only */
|
/* System-level only */
|
||||||
|
|
||||||
- (BOOL) crashOnSessionCreate
|
- (BOOL) crashOnSessionCreate
|
||||||
|
|
|
@ -59,7 +59,7 @@
|
||||||
SOGoUserSettings *_settings;
|
SOGoUserSettings *_settings;
|
||||||
SOGoUserFolder *homeFolder;
|
SOGoUserFolder *homeFolder;
|
||||||
NSString *currentPassword;
|
NSString *currentPassword;
|
||||||
NSString *domainId;
|
NSString *loginInDomain;
|
||||||
NSString *language;
|
NSString *language;
|
||||||
NSArray *allEmails;
|
NSArray *allEmails;
|
||||||
NSMutableArray *mailAccounts;
|
NSMutableArray *mailAccounts;
|
||||||
|
@ -84,6 +84,8 @@
|
||||||
- (void) setCurrentPassword: (NSString *) newPassword;
|
- (void) setCurrentPassword: (NSString *) newPassword;
|
||||||
- (NSString *) currentPassword;
|
- (NSString *) currentPassword;
|
||||||
|
|
||||||
|
- (NSString *) loginInDomain;
|
||||||
|
|
||||||
/* properties */
|
/* properties */
|
||||||
- (NSString *) domain;
|
- (NSString *) domain;
|
||||||
|
|
||||||
|
|
|
@ -122,21 +122,49 @@
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a new instance for the login name, which can be appended by a
|
||||||
|
* domain name.
|
||||||
|
*
|
||||||
|
* @param newLogin a login name optionally follow by @domain
|
||||||
|
* @param newRoles
|
||||||
|
* @param b is set to YES if newLogin can be trust
|
||||||
|
* @see loginInDomain
|
||||||
|
* @see [SOGoSession decodeValue:usingKey:login:domain:password:]
|
||||||
|
*/
|
||||||
- (id) initWithLogin: (NSString *) newLogin
|
- (id) initWithLogin: (NSString *) newLogin
|
||||||
roles: (NSArray *) newRoles
|
roles: (NSArray *) newRoles
|
||||||
trust: (BOOL) b
|
trust: (BOOL) b
|
||||||
{
|
{
|
||||||
SOGoUserManager *um;
|
SOGoUserManager *um;
|
||||||
NSString *realUID;
|
SOGoSystemDefaults *sd;
|
||||||
|
NSString *realUID, *uid, *domain;
|
||||||
|
NSRange r;
|
||||||
|
|
||||||
_defaults = nil;
|
_defaults = nil;
|
||||||
_settings = nil;
|
_settings = nil;
|
||||||
|
|
||||||
|
uid = nil;
|
||||||
|
domain = nil;
|
||||||
|
|
||||||
if ([newLogin isEqualToString: @"anonymous"]
|
if ([newLogin isEqualToString: @"anonymous"]
|
||||||
|| [newLogin isEqualToString: @"freebusy"])
|
|| [newLogin isEqualToString: @"freebusy"])
|
||||||
realUID = newLogin;
|
realUID = newLogin;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
r = [newLogin rangeOfString: @"@" options: NSBackwardsSearch];
|
||||||
|
if (r.location != NSNotFound)
|
||||||
|
{
|
||||||
|
// The domain is probably appended to the username;
|
||||||
|
// make sure it is a defined domain in the configuration.
|
||||||
|
sd = [SOGoSystemDefaults sharedSystemDefaults];
|
||||||
|
domain = [newLogin substringFromIndex: (r.location + r.length)];
|
||||||
|
if ([[sd domainIds] containsObject: domain])
|
||||||
|
newLogin = [newLogin substringToIndex: r.location];
|
||||||
|
else
|
||||||
|
domain = nil;
|
||||||
|
}
|
||||||
|
|
||||||
newLogin = [newLogin stringByReplacingString: @"%40"
|
newLogin = [newLogin stringByReplacingString: @"%40"
|
||||||
withString: @"@"];
|
withString: @"@"];
|
||||||
if (b)
|
if (b)
|
||||||
|
@ -144,9 +172,19 @@
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
um = [SOGoUserManager sharedUserManager];
|
um = [SOGoUserManager sharedUserManager];
|
||||||
realUID = [[um contactInfosForUserWithUIDorEmail: newLogin]
|
realUID = [[um contactInfosForUserWithUIDorEmail: newLogin
|
||||||
|
inDomain: domain]
|
||||||
objectForKey: @"c_uid"];
|
objectForKey: @"c_uid"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (domain)
|
||||||
|
{
|
||||||
|
// When the user is associated to a domain, the [SOGoUser login]
|
||||||
|
// method returns the combination login@domain while
|
||||||
|
// [SOGoUser loginInDomain] only returns the login.
|
||||||
|
uid = [NSString stringWithString: realUID];
|
||||||
|
realUID = [NSString stringWithFormat: @"%@@%@", realUID, domain];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([realUID length])
|
if ([realUID length])
|
||||||
|
@ -156,6 +194,7 @@
|
||||||
allEmails = nil;
|
allEmails = nil;
|
||||||
currentPassword = nil;
|
currentPassword = nil;
|
||||||
cn = nil;
|
cn = nil;
|
||||||
|
ASSIGN (loginInDomain, (uid ? uid : realUID));
|
||||||
_defaults = nil;
|
_defaults = nil;
|
||||||
_domainDefaults = nil;
|
_domainDefaults = nil;
|
||||||
_settings = nil;
|
_settings = nil;
|
||||||
|
@ -180,6 +219,7 @@
|
||||||
[mailAccounts release];
|
[mailAccounts release];
|
||||||
[currentPassword release];
|
[currentPassword release];
|
||||||
[cn release];
|
[cn release];
|
||||||
|
[loginInDomain release];
|
||||||
[language release];
|
[language release];
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
@ -199,6 +239,11 @@
|
||||||
return currentPassword;
|
return currentPassword;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSString *) loginInDomain
|
||||||
|
{
|
||||||
|
return loginInDomain;
|
||||||
|
}
|
||||||
|
|
||||||
- (id) _fetchFieldForUser: (NSString *) field
|
- (id) _fetchFieldForUser: (NSString *) field
|
||||||
{
|
{
|
||||||
NSDictionary *contactInfos;
|
NSDictionary *contactInfos;
|
||||||
|
@ -518,7 +563,8 @@
|
||||||
|
|
||||||
// 1. login
|
// 1. login
|
||||||
imapLogin = [[SOGoUserManager sharedUserManager]
|
imapLogin = [[SOGoUserManager sharedUserManager]
|
||||||
getImapLoginForUID: login];
|
getImapLoginForUID: [self loginInDomain]
|
||||||
|
inDomain: [self domain]];
|
||||||
[mailAccount setObject: imapLogin forKey: @"userName"];
|
[mailAccount setObject: imapLogin forKey: @"userName"];
|
||||||
|
|
||||||
// 2. server
|
// 2. server
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
/* SOGoUserManager.h - this file is part of SOGo
|
/* SOGoUserManager.h - this file is part of SOGo
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2010 Inverse inc.
|
* Copyright (C) 2007-2011 Inverse inc.
|
||||||
*
|
*
|
||||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
* Francis Lachapelle <flachapelle@inverse.ca>
|
||||||
*
|
*
|
||||||
* This file is free software; you can redistribute it and/or modify
|
* This file is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -65,6 +66,8 @@
|
||||||
- (NSDictionary *) metadataForSourceID: (NSString *) sourceID;
|
- (NSDictionary *) metadataForSourceID: (NSString *) sourceID;
|
||||||
- (NSString *) displayNameForSourceWithID: (NSString *) sourceID;
|
- (NSString *) displayNameForSourceWithID: (NSString *) sourceID;
|
||||||
- (NSDictionary *) contactInfosForUserWithUIDorEmail: (NSString *) uid;
|
- (NSDictionary *) contactInfosForUserWithUIDorEmail: (NSString *) uid;
|
||||||
|
- (NSDictionary *) contactInfosForUserWithUIDorEmail: (NSString *) uid
|
||||||
|
inDomain: (NSString *) domain;
|
||||||
- (NSArray *) fetchContactsMatching: (NSString *) match
|
- (NSArray *) fetchContactsMatching: (NSString *) match
|
||||||
inDomain: (NSString *) domain;
|
inDomain: (NSString *) domain;
|
||||||
- (NSArray *) fetchUsersMatching: (NSString *) filter
|
- (NSArray *) fetchUsersMatching: (NSString *) filter
|
||||||
|
@ -73,17 +76,20 @@
|
||||||
- (NSString *) getCNForUID: (NSString *) uid;
|
- (NSString *) getCNForUID: (NSString *) uid;
|
||||||
- (NSString *) getEmailForUID: (NSString *) uid;
|
- (NSString *) getEmailForUID: (NSString *) uid;
|
||||||
- (NSString *) getFullEmailForUID: (NSString *) uid;
|
- (NSString *) getFullEmailForUID: (NSString *) uid;
|
||||||
- (NSString *) getImapLoginForUID: (NSString *) uid;
|
- (NSString *) getImapLoginForUID: (NSString *) uid
|
||||||
|
inDomain: (NSString *) domain;
|
||||||
- (NSString *) getUIDForEmail: (NSString *) email;
|
- (NSString *) getUIDForEmail: (NSString *) email;
|
||||||
- (NSString *) getLoginForDN: (NSString *) theDN;
|
- (NSString *) getLoginForDN: (NSString *) theDN;
|
||||||
|
|
||||||
- (BOOL) checkLogin: (NSString *) _login
|
- (BOOL) checkLogin: (NSString *) _login
|
||||||
password: (NSString *) _pwd
|
password: (NSString *) _pwd
|
||||||
|
domain: (NSString *) _domain
|
||||||
perr: (SOGoPasswordPolicyError *) _perr
|
perr: (SOGoPasswordPolicyError *) _perr
|
||||||
expire: (int *) _expire
|
expire: (int *) _expire
|
||||||
grace: (int *) _grace;
|
grace: (int *) _grace;
|
||||||
|
|
||||||
- (BOOL) changePasswordForLogin: (NSString *) login
|
- (BOOL) changePasswordForLogin: (NSString *) login
|
||||||
|
inDomain: (NSString *) domain
|
||||||
oldPassword: (NSString *) oldPassword
|
oldPassword: (NSString *) oldPassword
|
||||||
newPassword: (NSString *) newPassword
|
newPassword: (NSString *) newPassword
|
||||||
perr: (SOGoPasswordPolicyError *) perr;
|
perr: (SOGoPasswordPolicyError *) perr;
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
* Copyright (C) 2007-2011 Inverse inc.
|
* Copyright (C) 2007-2011 Inverse inc.
|
||||||
*
|
*
|
||||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
* Francis Lachapelle <flachapelle@inverse.ca>
|
||||||
*
|
*
|
||||||
* This file is free software; you can redistribute it and/or modify
|
* This file is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -27,6 +28,7 @@
|
||||||
#import <Foundation/NSString.h>
|
#import <Foundation/NSString.h>
|
||||||
#import <Foundation/NSTimer.h>
|
#import <Foundation/NSTimer.h>
|
||||||
#import <Foundation/NSValue.h>
|
#import <Foundation/NSValue.h>
|
||||||
|
#import <NGExtensions/NSNull+misc.h>
|
||||||
#import <NGExtensions/NSObject+Logs.h>
|
#import <NGExtensions/NSObject+Logs.h>
|
||||||
|
|
||||||
#import "NSArray+Utilities.h"
|
#import "NSArray+Utilities.h"
|
||||||
|
@ -335,14 +337,15 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString *) getImapLoginForUID: (NSString *) uid
|
- (NSString *) getImapLoginForUID: (NSString *) uid
|
||||||
|
inDomain: (NSString *) domain
|
||||||
{
|
{
|
||||||
NSDictionary *contactInfos;
|
NSDictionary *contactInfos;
|
||||||
NSString *domain, *login;
|
NSString *login;
|
||||||
SOGoDomainDefaults *dd;
|
SOGoDomainDefaults *dd;
|
||||||
|
|
||||||
contactInfos = [self contactInfosForUserWithUIDorEmail: uid];
|
contactInfos = [self contactInfosForUserWithUIDorEmail: uid
|
||||||
|
inDomain: domain];
|
||||||
login = [contactInfos objectForKey: @"c_imaplogin"];
|
login = [contactInfos objectForKey: @"c_imaplogin"];
|
||||||
domain = [contactInfos objectForKey: @"c_domain"];
|
|
||||||
if (login == nil)
|
if (login == nil)
|
||||||
{
|
{
|
||||||
if ([domain length])
|
if ([domain length])
|
||||||
|
@ -366,6 +369,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) _sourceChangePasswordForLogin: (NSString *) login
|
- (BOOL) _sourceChangePasswordForLogin: (NSString *) login
|
||||||
|
inDomain: (NSString *) domain
|
||||||
oldPassword: (NSString *) oldPassword
|
oldPassword: (NSString *) oldPassword
|
||||||
newPassword: (NSString *) newPassword
|
newPassword: (NSString *) newPassword
|
||||||
perr: (SOGoPasswordPolicyError *) perr
|
perr: (SOGoPasswordPolicyError *) perr
|
||||||
|
@ -377,14 +381,14 @@
|
||||||
|
|
||||||
didChange = NO;
|
didChange = NO;
|
||||||
|
|
||||||
authIDs = [[self authenticationSourceIDsInDomain: nil] objectEnumerator];
|
authIDs = [[self authenticationSourceIDsInDomain: domain] objectEnumerator];
|
||||||
while (!didChange && (currentID = [authIDs nextObject]))
|
while (!didChange && (currentID = [authIDs nextObject]))
|
||||||
{
|
{
|
||||||
sogoSource = [_sources objectForKey: currentID];
|
sogoSource = [_sources objectForKey: currentID];
|
||||||
didChange = [sogoSource changePasswordForLogin: login
|
didChange = [sogoSource changePasswordForLogin: login
|
||||||
oldPassword: oldPassword
|
oldPassword: oldPassword
|
||||||
newPassword: newPassword
|
newPassword: newPassword
|
||||||
perr: perr];
|
perr: perr];
|
||||||
}
|
}
|
||||||
|
|
||||||
return didChange;
|
return didChange;
|
||||||
|
@ -392,9 +396,10 @@
|
||||||
|
|
||||||
- (BOOL) _sourceCheckLogin: (NSString *) login
|
- (BOOL) _sourceCheckLogin: (NSString *) login
|
||||||
andPassword: (NSString *) password
|
andPassword: (NSString *) password
|
||||||
perr: (SOGoPasswordPolicyError *) perr
|
domain: (NSString *) domain
|
||||||
expire: (int *) expire
|
perr: (SOGoPasswordPolicyError *) perr
|
||||||
grace: (int *) grace
|
expire: (int *) expire
|
||||||
|
grace: (int *) grace
|
||||||
{
|
{
|
||||||
NSObject <SOGoSource> *sogoSource;
|
NSObject <SOGoSource> *sogoSource;
|
||||||
NSEnumerator *authIDs;
|
NSEnumerator *authIDs;
|
||||||
|
@ -403,7 +408,7 @@
|
||||||
|
|
||||||
checkOK = NO;
|
checkOK = NO;
|
||||||
|
|
||||||
authIDs = [[self authenticationSourceIDsInDomain: nil] objectEnumerator];
|
authIDs = [[self authenticationSourceIDsInDomain: domain] objectEnumerator];
|
||||||
while (!checkOK && (currentID = [authIDs nextObject]))
|
while (!checkOK && (currentID = [authIDs nextObject]))
|
||||||
{
|
{
|
||||||
sogoSource = [_sources objectForKey: currentID];
|
sogoSource = [_sources objectForKey: currentID];
|
||||||
|
@ -419,18 +424,23 @@
|
||||||
|
|
||||||
- (BOOL) checkLogin: (NSString *) _login
|
- (BOOL) checkLogin: (NSString *) _login
|
||||||
password: (NSString *) _pwd
|
password: (NSString *) _pwd
|
||||||
|
domain: (NSString *) _domain
|
||||||
perr: (SOGoPasswordPolicyError *) _perr
|
perr: (SOGoPasswordPolicyError *) _perr
|
||||||
expire: (int *) _expire
|
expire: (int *) _expire
|
||||||
grace: (int *) _grace
|
grace: (int *) _grace
|
||||||
{
|
{
|
||||||
NSString *dictPassword, *jsonUser;
|
NSString *dictPassword, *username, *jsonUser;
|
||||||
NSMutableDictionary *currentUser;
|
NSMutableDictionary *currentUser;
|
||||||
BOOL checkOK;
|
BOOL checkOK;
|
||||||
|
|
||||||
// We check for cached passwords. If the entry is cached, we
|
// We check for cached passwords. If the entry is cached, we
|
||||||
// check this immediately. If not, we'll go directly at the
|
// check this immediately. If not, we'll go directly at the
|
||||||
// authentication source and try to validate there, then cache it.
|
// authentication source and try to validate there, then cache it.
|
||||||
jsonUser = [[SOGoCache sharedCache] userAttributesForLogin: _login];
|
if (_domain)
|
||||||
|
username = [NSString stringWithFormat: @"%@@%@", _login, _domain];
|
||||||
|
else
|
||||||
|
username = _login;
|
||||||
|
jsonUser = [[SOGoCache sharedCache] userAttributesForLogin: username];
|
||||||
currentUser = [jsonUser objectFromJSONString];
|
currentUser = [jsonUser objectFromJSONString];
|
||||||
dictPassword = [currentUser objectForKey: @"password"];
|
dictPassword = [currentUser objectForKey: @"password"];
|
||||||
if (currentUser && dictPassword)
|
if (currentUser && dictPassword)
|
||||||
|
@ -439,10 +449,11 @@
|
||||||
//NSLog(@"Password cache hit for user %@", _login);
|
//NSLog(@"Password cache hit for user %@", _login);
|
||||||
}
|
}
|
||||||
else if ([self _sourceCheckLogin: _login
|
else if ([self _sourceCheckLogin: _login
|
||||||
andPassword: _pwd
|
andPassword: _pwd
|
||||||
perr: _perr
|
domain: _domain
|
||||||
expire: _expire
|
perr: _perr
|
||||||
grace: _grace])
|
expire: _expire
|
||||||
|
grace: _grace])
|
||||||
{
|
{
|
||||||
checkOK = YES;
|
checkOK = YES;
|
||||||
if (!currentUser)
|
if (!currentUser)
|
||||||
|
@ -458,7 +469,7 @@
|
||||||
[currentUser setObject: [_pwd asSHA1String] forKey: @"password"];
|
[currentUser setObject: [_pwd asSHA1String] forKey: @"password"];
|
||||||
[[SOGoCache sharedCache]
|
[[SOGoCache sharedCache]
|
||||||
setUserAttributes: [currentUser jsonRepresentation]
|
setUserAttributes: [currentUser jsonRepresentation]
|
||||||
forLogin: _login];
|
forLogin: username];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
checkOK = NO;
|
checkOK = NO;
|
||||||
|
@ -473,19 +484,20 @@
|
||||||
|
|
||||||
sources = [[_sources allValues] objectEnumerator];
|
sources = [[_sources allValues] objectEnumerator];
|
||||||
while ((currentSource = [sources nextObject]))
|
while ((currentSource = [sources nextObject]))
|
||||||
if ([currentSource conformsToProtocol: @protocol(SOGoDNSource)] &&
|
if ([currentSource conformsToProtocol: @protocol(SOGoDNSource)] &&
|
||||||
[currentSource bindAsCurrentUser] &&
|
[currentSource bindAsCurrentUser] &&
|
||||||
[currentSource lookupDNByLogin: _login])
|
[currentSource lookupDNByLogin: _login])
|
||||||
{
|
{
|
||||||
[currentSource setBindDN: [currentSource lookupDNByLogin: _login]];
|
[currentSource setBindDN: [currentSource lookupDNByLogin: _login]];
|
||||||
[currentSource setBindPassword: _pwd];
|
[currentSource setBindPassword: _pwd];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return checkOK;
|
return checkOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) changePasswordForLogin: (NSString *) login
|
- (BOOL) changePasswordForLogin: (NSString *) login
|
||||||
|
inDomain: (NSString *) domain
|
||||||
oldPassword: (NSString *) oldPassword
|
oldPassword: (NSString *) oldPassword
|
||||||
newPassword: (NSString *) newPassword
|
newPassword: (NSString *) newPassword
|
||||||
perr: (SOGoPasswordPolicyError *) perr
|
perr: (SOGoPasswordPolicyError *) perr
|
||||||
|
@ -499,9 +511,10 @@
|
||||||
dictPassword = [currentUser objectForKey: @"password"];
|
dictPassword = [currentUser objectForKey: @"password"];
|
||||||
|
|
||||||
if ([self _sourceChangePasswordForLogin: login
|
if ([self _sourceChangePasswordForLogin: login
|
||||||
oldPassword: oldPassword
|
inDomain: domain
|
||||||
newPassword: newPassword
|
oldPassword: oldPassword
|
||||||
perr: perr])
|
newPassword: newPassword
|
||||||
|
perr: perr])
|
||||||
{
|
{
|
||||||
didChange = YES;
|
didChange = YES;
|
||||||
|
|
||||||
|
@ -553,6 +566,7 @@
|
||||||
//
|
//
|
||||||
- (void) _fillContactInfosForUser: (NSMutableDictionary *) currentUser
|
- (void) _fillContactInfosForUser: (NSMutableDictionary *) currentUser
|
||||||
withUIDorEmail: (NSString *) uid
|
withUIDorEmail: (NSString *) uid
|
||||||
|
inDomain: (NSString *) domain
|
||||||
{
|
{
|
||||||
NSMutableArray *emails;
|
NSMutableArray *emails;
|
||||||
NSDictionary *userEntry;
|
NSDictionary *userEntry;
|
||||||
|
@ -574,7 +588,7 @@
|
||||||
[currentUser setObject: [NSNumber numberWithBool: YES]
|
[currentUser setObject: [NSNumber numberWithBool: YES]
|
||||||
forKey: @"MailAccess"];
|
forKey: @"MailAccess"];
|
||||||
|
|
||||||
sogoSources = [[self authenticationSourceIDsInDomain: nil]
|
sogoSources = [[self authenticationSourceIDsInDomain: domain]
|
||||||
objectEnumerator];
|
objectEnumerator];
|
||||||
while ((sourceID = [sogoSources nextObject]))
|
while ((sourceID = [sogoSources nextObject]))
|
||||||
{
|
{
|
||||||
|
@ -642,12 +656,17 @@
|
||||||
// associated with email addresses.
|
// associated with email addresses.
|
||||||
//
|
//
|
||||||
- (void) _retainUser: (NSDictionary *) newUser
|
- (void) _retainUser: (NSDictionary *) newUser
|
||||||
|
withLogin: (NSString *) login
|
||||||
{
|
{
|
||||||
NSEnumerator *emails;
|
NSEnumerator *emails;
|
||||||
NSString *key;
|
NSString *key;
|
||||||
|
|
||||||
|
[[SOGoCache sharedCache]
|
||||||
|
setUserAttributes: [newUser jsonRepresentation]
|
||||||
|
forLogin: login];
|
||||||
|
|
||||||
key = [newUser objectForKey: @"c_uid"];
|
key = [newUser objectForKey: @"c_uid"];
|
||||||
if (key)
|
if (key && ![key isEqualToString: login])
|
||||||
[[SOGoCache sharedCache]
|
[[SOGoCache sharedCache]
|
||||||
setUserAttributes: [newUser jsonRepresentation]
|
setUserAttributes: [newUser jsonRepresentation]
|
||||||
forLogin: key];
|
forLogin: key];
|
||||||
|
@ -680,10 +699,49 @@
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @see [SOGoUser initWithLogin:roles:trust:]
|
||||||
|
*/
|
||||||
- (NSDictionary *) contactInfosForUserWithUIDorEmail: (NSString *) uid
|
- (NSDictionary *) contactInfosForUserWithUIDorEmail: (NSString *) uid
|
||||||
|
{
|
||||||
|
NSRange r;
|
||||||
|
NSString *username, *domain;
|
||||||
|
NSDictionary *infos;
|
||||||
|
SOGoSystemDefaults *sd;
|
||||||
|
|
||||||
|
domain = nil;
|
||||||
|
infos = nil;
|
||||||
|
|
||||||
|
r = [uid rangeOfString: @"@" options: NSBackwardsSearch];
|
||||||
|
if (r.location != NSNotFound)
|
||||||
|
{
|
||||||
|
// The domain is probably appended to the username;
|
||||||
|
// make sure it is a defined domain in the configuration.
|
||||||
|
sd = [SOGoSystemDefaults sharedSystemDefaults];
|
||||||
|
domain = [uid substringFromIndex: (r.location + r.length)];
|
||||||
|
if ([[sd domainIds] containsObject: domain])
|
||||||
|
username = [uid substringToIndex: r.location];
|
||||||
|
else
|
||||||
|
domain = nil;
|
||||||
|
}
|
||||||
|
if (domain != nil)
|
||||||
|
infos = [self contactInfosForUserWithUIDorEmail: username
|
||||||
|
inDomain: domain];
|
||||||
|
if (infos == nil)
|
||||||
|
// If the user was not found using the domain or if no domain was detected,
|
||||||
|
// search using the original uid.
|
||||||
|
infos = [self contactInfosForUserWithUIDorEmail: uid
|
||||||
|
inDomain: nil];
|
||||||
|
|
||||||
|
return infos;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSDictionary *) contactInfosForUserWithUIDorEmail: (NSString *) uid
|
||||||
|
inDomain: (NSString *) domain
|
||||||
{
|
{
|
||||||
NSMutableDictionary *currentUser;
|
NSMutableDictionary *currentUser;
|
||||||
NSString *aUID, *jsonUser;
|
NSString *aUID, *cacheUid, *jsonUser;
|
||||||
BOOL newUser;
|
BOOL newUser;
|
||||||
|
|
||||||
if ([uid isEqualToString: @"anonymous"])
|
if ([uid isEqualToString: @"anonymous"])
|
||||||
|
@ -692,7 +750,11 @@
|
||||||
{
|
{
|
||||||
// Remove the "@" prefix used to identified groups in the ACL tables.
|
// Remove the "@" prefix used to identified groups in the ACL tables.
|
||||||
aUID = [uid hasPrefix: @"@"] ? [uid substringFromIndex: 1] : uid;
|
aUID = [uid hasPrefix: @"@"] ? [uid substringFromIndex: 1] : uid;
|
||||||
jsonUser = [[SOGoCache sharedCache] userAttributesForLogin: aUID];
|
if (domain)
|
||||||
|
cacheUid = [NSString stringWithFormat: @"%@@%@", aUID, domain];
|
||||||
|
else
|
||||||
|
cacheUid = aUID;
|
||||||
|
jsonUser = [[SOGoCache sharedCache] userAttributesForLogin: cacheUid];
|
||||||
currentUser = [jsonUser objectFromJSONString];
|
currentUser = [jsonUser objectFromJSONString];
|
||||||
if (!([currentUser objectForKey: @"emails"]
|
if (!([currentUser objectForKey: @"emails"]
|
||||||
&& [currentUser objectForKey: @"cn"]))
|
&& [currentUser objectForKey: @"cn"]))
|
||||||
|
@ -711,11 +773,13 @@
|
||||||
else
|
else
|
||||||
newUser = NO;
|
newUser = NO;
|
||||||
[self _fillContactInfosForUser: currentUser
|
[self _fillContactInfosForUser: currentUser
|
||||||
withUIDorEmail: aUID];
|
withUIDorEmail: aUID
|
||||||
|
inDomain: domain];
|
||||||
if (newUser)
|
if (newUser)
|
||||||
{
|
{
|
||||||
if ([[currentUser objectForKey: @"c_uid"] length] > 0)
|
if ([[currentUser objectForKey: @"c_uid"] length] > 0)
|
||||||
[self _retainUser: currentUser];
|
[self _retainUser: currentUser
|
||||||
|
withLogin: cacheUid];
|
||||||
else
|
else
|
||||||
currentUser = nil;
|
currentUser = nil;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
/* SOGoWebAuthenticator.h - this file is part of SOGo
|
/* SOGoWebAuthenticator.h - this file is part of SOGo
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2010 Inverse inc.
|
* Copyright (C) 2007-2011 Inverse inc.
|
||||||
*
|
*
|
||||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
* Ludovic Marcotte <lmarcotte@inverse.ca>
|
* Ludovic Marcotte <lmarcotte@inverse.ca>
|
||||||
|
* Francis Lachapelle <flachapelle@inverse.ca>
|
||||||
*
|
*
|
||||||
* This file is free software; you can redistribute it and/or modify
|
* This file is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -39,6 +40,7 @@
|
||||||
|
|
||||||
- (BOOL) checkLogin: (NSString *) _login
|
- (BOOL) checkLogin: (NSString *) _login
|
||||||
password: (NSString *) _pwd
|
password: (NSString *) _pwd
|
||||||
|
domain: (NSString *) _domain
|
||||||
perr: (SOGoPasswordPolicyError *) _perr
|
perr: (SOGoPasswordPolicyError *) _perr
|
||||||
expire: (int *) _expire
|
expire: (int *) _expire
|
||||||
grace: (int *) _grace;
|
grace: (int *) _grace;
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
* Copyright (C) 2007-2011 Inverse inc.
|
* Copyright (C) 2007-2011 Inverse inc.
|
||||||
*
|
*
|
||||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
* Francis Lachapelle <flachapelle@inverse.ca>
|
||||||
*
|
*
|
||||||
* This file is free software; you can redistribute it and/or modify
|
* This file is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -64,7 +65,7 @@
|
||||||
- (BOOL) checkLogin: (NSString *) _login
|
- (BOOL) checkLogin: (NSString *) _login
|
||||||
password: (NSString *) _pwd
|
password: (NSString *) _pwd
|
||||||
{
|
{
|
||||||
NSString *username, *password, *value;
|
NSString *username, *domain, *password, *value;
|
||||||
SOGoPasswordPolicyError perr;
|
SOGoPasswordPolicyError perr;
|
||||||
int expire, grace;
|
int expire, grace;
|
||||||
|
|
||||||
|
@ -83,19 +84,22 @@
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
[SOGoSession decodeValue: value
|
[SOGoSession decodeValue: value
|
||||||
usingKey: _login
|
usingKey: _login
|
||||||
login: &username
|
login: &username
|
||||||
password: &password];
|
domain: &domain
|
||||||
|
password: &password];
|
||||||
|
|
||||||
return [self checkLogin: username
|
return [self checkLogin: username
|
||||||
password: password
|
password: password
|
||||||
perr: &perr
|
domain: domain
|
||||||
expire: &expire
|
perr: &perr
|
||||||
grace: &grace];
|
expire: &expire
|
||||||
|
grace: &grace];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) checkLogin: (NSString *) _login
|
- (BOOL) checkLogin: (NSString *) _login
|
||||||
password: (NSString *) _pwd
|
password: (NSString *) _pwd
|
||||||
|
domain: (NSString *) _domain
|
||||||
perr: (SOGoPasswordPolicyError *) _perr
|
perr: (SOGoPasswordPolicyError *) _perr
|
||||||
expire: (int *) _expire
|
expire: (int *) _expire
|
||||||
grace: (int *) _grace
|
grace: (int *) _grace
|
||||||
|
@ -116,10 +120,11 @@
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
rc = [[SOGoUserManager sharedUserManager] checkLogin: _login
|
rc = [[SOGoUserManager sharedUserManager] checkLogin: _login
|
||||||
password: _pwd
|
password: _pwd
|
||||||
perr: _perr
|
domain: _domain
|
||||||
expire: _expire
|
perr: _perr
|
||||||
grace: _grace];
|
expire: _expire
|
||||||
|
grace: _grace];
|
||||||
|
|
||||||
//[self logWithFormat: @"Checked login with ppolicy enabled: %d %d %d", *_perr, *_expire, *_grace];
|
//[self logWithFormat: @"Checked login with ppolicy enabled: %d %d %d", *_perr, *_expire, *_grace];
|
||||||
|
|
||||||
|
@ -159,12 +164,13 @@
|
||||||
creds = [self parseCredentials: auth];
|
creds = [self parseCredentials: auth];
|
||||||
if ([creds count] > 1)
|
if ([creds count] > 1)
|
||||||
{
|
{
|
||||||
NSString *login;
|
NSString *login, *domain;
|
||||||
|
|
||||||
[SOGoSession decodeValue: [SOGoSession valueForSessionKey: [creds objectAtIndex: 1]]
|
[SOGoSession decodeValue: [SOGoSession valueForSessionKey: [creds objectAtIndex: 1]]
|
||||||
usingKey: [creds objectAtIndex: 0]
|
usingKey: [creds objectAtIndex: 0]
|
||||||
login: &login
|
login: &login
|
||||||
password: &password];
|
domain: &domain
|
||||||
|
password: &password];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
password = nil;
|
password = nil;
|
||||||
|
@ -178,7 +184,7 @@
|
||||||
//
|
//
|
||||||
- (NSString *) checkCredentials: (NSString *)_creds
|
- (NSString *) checkCredentials: (NSString *)_creds
|
||||||
{
|
{
|
||||||
NSString *login, *pwd, *userKey, *sessionKey;
|
NSString *login, *domain, *pwd, *userKey, *sessionKey;
|
||||||
NSArray *creds;
|
NSArray *creds;
|
||||||
|
|
||||||
SOGoPasswordPolicyError perr;
|
SOGoPasswordPolicyError perr;
|
||||||
|
@ -194,17 +200,22 @@
|
||||||
sessionKey = [creds objectAtIndex:1];
|
sessionKey = [creds objectAtIndex:1];
|
||||||
|
|
||||||
[SOGoSession decodeValue: [SOGoSession valueForSessionKey: sessionKey]
|
[SOGoSession decodeValue: [SOGoSession valueForSessionKey: sessionKey]
|
||||||
usingKey: userKey
|
usingKey: userKey
|
||||||
login: &login
|
login: &login
|
||||||
password: &pwd];
|
domain: &domain
|
||||||
|
password: &pwd];
|
||||||
|
|
||||||
if (![self checkLogin: login
|
if (![self checkLogin: login
|
||||||
password: pwd
|
password: pwd
|
||||||
perr: &perr
|
domain: domain
|
||||||
expire: &expire
|
perr: &perr
|
||||||
grace: &grace])
|
expire: &expire
|
||||||
|
grace: &grace])
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
|
if (domain)
|
||||||
|
login = [NSString stringWithFormat: @"%@@%@", login, domain];
|
||||||
|
|
||||||
return login;
|
return login;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#import <Foundation/NSValue.h>
|
#import <Foundation/NSValue.h>
|
||||||
#import <Foundation/NSURL.h>
|
#import <Foundation/NSURL.h>
|
||||||
|
|
||||||
|
#import <NGExtensions/NSNull+misc.h>
|
||||||
#import <NGExtensions/NSObject+Logs.h>
|
#import <NGExtensions/NSObject+Logs.h>
|
||||||
|
|
||||||
#import <GDLContentStore/GCSChannelManager.h>
|
#import <GDLContentStore/GCSChannelManager.h>
|
||||||
|
@ -464,7 +465,7 @@
|
||||||
// We check if we should use a different login for IMAP
|
// We check if we should use a different login for IMAP
|
||||||
if (_imapLoginField)
|
if (_imapLoginField)
|
||||||
{
|
{
|
||||||
if ([response objectForKey: _imapLoginField])
|
if ([[response objectForKey: _imapLoginField] isNotNull])
|
||||||
[response setObject: [response objectForKey: _imapLoginField] forKey: @"c_imaplogin"];
|
[response setObject: [response objectForKey: _imapLoginField] forKey: @"c_imaplogin"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
"Username:" = "Username:";
|
"Username:" = "Username:";
|
||||||
"Password:" = "Password:";
|
"Password:" = "Password:";
|
||||||
|
"Domain:" = "Domain:";
|
||||||
|
|
||||||
"Connect" = "Connect";
|
"Connect" = "Connect";
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
"Username:" = "Nom d'utilisateur :";
|
"Username:" = "Nom d'utilisateur :";
|
||||||
"Password:" = "Mot de passe :";
|
"Password:" = "Mot de passe :";
|
||||||
|
"Domain:" = "Domaine :";
|
||||||
|
|
||||||
"Connect" = "Connexion";
|
"Connect" = "Connexion";
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
|
|
||||||
Copyright (C) 2006-2010 Inverse inc.
|
Copyright (C) 2006-2011 Inverse inc.
|
||||||
Copyright (C) 2004-2005 SKYRIX Software AG
|
Copyright (C) 2004-2005 SKYRIX Software AG
|
||||||
|
|
||||||
This file is part of SOGo.
|
This file is part of SOGo.
|
||||||
|
@ -149,7 +149,7 @@
|
||||||
SOGoAppointmentFolders *calendars;
|
SOGoAppointmentFolders *calendars;
|
||||||
SOGoUserDefaults *ud;
|
SOGoUserDefaults *ud;
|
||||||
SOGoUser *loggedInUser;
|
SOGoUser *loggedInUser;
|
||||||
NSString *username, *password, *language;
|
NSString *username, *password, *language, *domain;
|
||||||
NSArray *supportedLanguages;
|
NSArray *supportedLanguages;
|
||||||
|
|
||||||
SOGoPasswordPolicyError err;
|
SOGoPasswordPolicyError err;
|
||||||
|
@ -165,8 +165,9 @@
|
||||||
username = [request formValueForKey: @"userName"];
|
username = [request formValueForKey: @"userName"];
|
||||||
password = [request formValueForKey: @"password"];
|
password = [request formValueForKey: @"password"];
|
||||||
language = [request formValueForKey: @"language"];
|
language = [request formValueForKey: @"language"];
|
||||||
|
domain = [request formValueForKey: @"domain"];
|
||||||
|
|
||||||
if ((b = [auth checkLogin: username password: password
|
if ((b = [auth checkLogin: username password: password domain: domain
|
||||||
perr: &err expire: &expire grace: &grace])
|
perr: &err expire: &expire grace: &grace])
|
||||||
&& (err == PolicyNoError)
|
&& (err == PolicyNoError)
|
||||||
// no password policy
|
// no password policy
|
||||||
|
@ -178,16 +179,18 @@
|
||||||
|
|
||||||
[self logWithFormat: @"successful login for user '%@' - expire = %d grace = %d", username, expire, grace];
|
[self logWithFormat: @"successful login for user '%@' - expire = %d grace = %d", username, expire, grace];
|
||||||
|
|
||||||
|
|
||||||
json = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt: expire], @"expire",
|
json = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt: expire], @"expire",
|
||||||
[NSNumber numberWithInt: grace], @"grace", nil];
|
[NSNumber numberWithInt: grace], @"grace", nil];
|
||||||
|
|
||||||
response = [self responseWithStatus: 200
|
response = [self responseWithStatus: 200
|
||||||
andJSONRepresentation: json];
|
andJSONRepresentation: json];
|
||||||
|
|
||||||
|
if ([domain isNotNull])
|
||||||
|
username = [NSString stringWithFormat: @"%@@%@", username, domain];
|
||||||
|
|
||||||
authCookie = [self _cookieWithUsername: username
|
authCookie = [self _cookieWithUsername: username
|
||||||
andPassword: password
|
andPassword: password
|
||||||
forAuthenticator: auth];
|
forAuthenticator: auth];
|
||||||
[response addCookie: authCookie];
|
[response addCookie: authCookie];
|
||||||
|
|
||||||
supportedLanguages = [[SOGoSystemDefaults sharedSystemDefaults]
|
supportedLanguages = [[SOGoSystemDefaults sharedSystemDefaults]
|
||||||
|
@ -376,6 +379,16 @@
|
||||||
return ([[self loginSuffix] length]);
|
return ([[self loginSuffix] length]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSArray *) loginDomains
|
||||||
|
{
|
||||||
|
return [[SOGoSystemDefaults sharedSystemDefaults] loginDomains];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL) hasLoginDomains
|
||||||
|
{
|
||||||
|
return ([[self loginDomains] count] > 0);
|
||||||
|
}
|
||||||
|
|
||||||
- (void) setItem: (id) _item
|
- (void) setItem: (id) _item
|
||||||
{
|
{
|
||||||
ASSIGN (item, _item);
|
ASSIGN (item, _item);
|
||||||
|
@ -414,7 +427,7 @@
|
||||||
|
|
||||||
- (WOResponse *) changePasswordAction
|
- (WOResponse *) changePasswordAction
|
||||||
{
|
{
|
||||||
NSString *username, *password, *newPassword, *value;
|
NSString *username, *domain, *password, *newPassword, *value;
|
||||||
SOGoUserManager *um;
|
SOGoUserManager *um;
|
||||||
SOGoPasswordPolicyError error;
|
SOGoPasswordPolicyError error;
|
||||||
WOResponse *response;
|
WOResponse *response;
|
||||||
|
@ -434,9 +447,10 @@
|
||||||
creds = [auth parseCredentials: value];
|
creds = [auth parseCredentials: value];
|
||||||
|
|
||||||
[SOGoSession decodeValue: [SOGoSession valueForSessionKey: [creds objectAtIndex: 1]]
|
[SOGoSession decodeValue: [SOGoSession valueForSessionKey: [creds objectAtIndex: 1]]
|
||||||
usingKey: [creds objectAtIndex: 0]
|
usingKey: [creds objectAtIndex: 0]
|
||||||
login: &username
|
login: &username
|
||||||
password: &password];
|
domain: &domain
|
||||||
|
password: &password];
|
||||||
|
|
||||||
newPassword = [message objectForKey: @"newPassword"];
|
newPassword = [message objectForKey: @"newPassword"];
|
||||||
|
|
||||||
|
@ -444,13 +458,17 @@
|
||||||
|
|
||||||
// This will also update the cached password in memcached.
|
// This will also update the cached password in memcached.
|
||||||
if ([um changePasswordForLogin: username
|
if ([um changePasswordForLogin: username
|
||||||
oldPassword: password
|
inDomain: domain
|
||||||
newPassword: newPassword
|
oldPassword: password
|
||||||
perr: &error])
|
newPassword: newPassword
|
||||||
|
perr: &error])
|
||||||
{
|
{
|
||||||
// We delete the previous session
|
// We delete the previous session
|
||||||
[SOGoSession deleteValueForSessionKey: [creds objectAtIndex: 1]];
|
[SOGoSession deleteValueForSessionKey: [creds objectAtIndex: 1]];
|
||||||
|
|
||||||
|
if ([domain isNotNull])
|
||||||
|
username = [NSString stringWithFormat: @"%@@%@", username, domain];
|
||||||
|
|
||||||
response = [self responseWith204];
|
response = [self responseWith204];
|
||||||
authCookie = [self _cookieWithUsername: username
|
authCookie = [self _cookieWithUsername: username
|
||||||
andPassword: newPassword
|
andPassword: newPassword
|
||||||
|
|
|
@ -317,7 +317,8 @@
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (WOResponse *) _usersResponseForResults: (NSArray *) users
|
- (NSMutableArray *) _usersForResults: (NSArray *) users
|
||||||
|
inDomain: (NSString *) domain
|
||||||
{
|
{
|
||||||
NSString *uid;
|
NSString *uid;
|
||||||
NSDictionary *contact;
|
NSDictionary *contact;
|
||||||
|
@ -325,8 +326,10 @@
|
||||||
NSMutableArray *jsonResponse, *jsonLine;
|
NSMutableArray *jsonResponse, *jsonLine;
|
||||||
NSArray *allUsers;
|
NSArray *allUsers;
|
||||||
int count, max;
|
int count, max;
|
||||||
|
BOOL activeUserIsInDomain;
|
||||||
|
|
||||||
login = [[context activeUser] login];
|
login = [[context activeUser] login];
|
||||||
|
activeUserIsInDomain = (domain == nil || [[[context activeUser] domain] isEqualToString: domain]);
|
||||||
|
|
||||||
// We sort our array - this is pretty useful for the Web
|
// We sort our array - this is pretty useful for the Web
|
||||||
// interface of SOGo.
|
// interface of SOGo.
|
||||||
|
@ -341,9 +344,11 @@
|
||||||
uid = [contact objectForKey: @"c_uid"];
|
uid = [contact objectForKey: @"c_uid"];
|
||||||
|
|
||||||
// We do NOT return the current authenticated user
|
// We do NOT return the current authenticated user
|
||||||
if (![uid isEqualToString: login])
|
if (!activeUserIsInDomain || ![uid isEqualToString: login])
|
||||||
{
|
{
|
||||||
jsonLine = [NSMutableArray arrayWithCapacity: 4];
|
jsonLine = [NSMutableArray arrayWithCapacity: 4];
|
||||||
|
if (domain)
|
||||||
|
uid = [NSString stringWithFormat: @"%@@%@", uid, domain];
|
||||||
[jsonLine addObject: uid];
|
[jsonLine addObject: uid];
|
||||||
[jsonLine addObject: [contact objectForKey: @"cn"]];
|
[jsonLine addObject: [contact objectForKey: @"cn"]];
|
||||||
[jsonLine addObject: [contact objectForKey: @"c_email"]];
|
[jsonLine addObject: [contact objectForKey: @"c_email"]];
|
||||||
|
@ -354,24 +359,41 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return [self responseWithStatus: 200
|
return jsonResponse;
|
||||||
andJSONRepresentation: jsonResponse];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id <WOActionResults>) usersSearchAction
|
- (id <WOActionResults>) usersSearchAction
|
||||||
{
|
{
|
||||||
|
NSMutableArray *users;
|
||||||
|
NSArray *currentUsers;
|
||||||
NSString *contact, *domain;
|
NSString *contact, *domain;
|
||||||
|
NSEnumerator *visibleDomains;
|
||||||
id <WOActionResults> result;
|
id <WOActionResults> result;
|
||||||
SOGoUserManager *um;
|
SOGoUserManager *um;
|
||||||
|
SOGoSystemDefaults *sd;
|
||||||
|
|
||||||
um = [SOGoUserManager sharedUserManager];
|
um = [SOGoUserManager sharedUserManager];
|
||||||
contact = [self queryParameterForKey: @"search"];
|
contact = [self queryParameterForKey: @"search"];
|
||||||
if ([contact length])
|
if ([contact length])
|
||||||
{
|
{
|
||||||
domain = [[context activeUser] domain];
|
domain = [[context activeUser] domain];
|
||||||
result
|
users = [self _usersForResults: [um fetchUsersMatching: contact
|
||||||
= [self _usersResponseForResults: [um fetchUsersMatching: contact
|
inDomain: domain]
|
||||||
inDomain: domain]];
|
inDomain: domain];
|
||||||
|
if (domain)
|
||||||
|
{
|
||||||
|
// Add results from visible domains
|
||||||
|
sd = [SOGoSystemDefaults sharedSystemDefaults];
|
||||||
|
visibleDomains = [[sd visibleDomainsForDomain: domain] objectEnumerator];
|
||||||
|
while ((domain = [visibleDomains nextObject]))
|
||||||
|
{
|
||||||
|
currentUsers = [self _usersForResults: [um fetchUsersMatching: contact
|
||||||
|
inDomain: domain]
|
||||||
|
inDomain: domain];
|
||||||
|
[users addObjectsFromArray: currentUsers];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result = [self responseWithStatus: 200 andJSONRepresentation: users];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
result = [NSException exceptionWithHTTPStatus: 400
|
result = [NSException exceptionWithHTTPStatus: 400
|
||||||
|
|
|
@ -51,6 +51,16 @@
|
||||||
string="languageText"
|
string="languageText"
|
||||||
label:noSelectionString="choose"
|
label:noSelectionString="choose"
|
||||||
/></label>
|
/></label>
|
||||||
|
<var:if condition="hasLoginDomains">
|
||||||
|
<label><var:string label:value="Domain:"/><br/>
|
||||||
|
<var:popup const:id="domain" const:name="domain"
|
||||||
|
list="loginDomains"
|
||||||
|
item="item"
|
||||||
|
var:selection="item"
|
||||||
|
var:value="item"
|
||||||
|
string="item"
|
||||||
|
/></label>
|
||||||
|
</var:if>
|
||||||
<label>
|
<label>
|
||||||
<a href="#" class="button" id="submit" name="submit">
|
<a href="#" class="button" id="submit" name="submit">
|
||||||
<span><var:string label:value="Connect" /></span></a>
|
<span><var:string label:value="Connect" /></span></a>
|
||||||
|
|
|
@ -46,7 +46,7 @@ function onFieldKeyDown(event) {
|
||||||
if (event.keyCode == Event.KEY_RETURN) {
|
if (event.keyCode == Event.KEY_RETURN) {
|
||||||
if ($("password").value.length > 0
|
if ($("password").value.length > 0
|
||||||
&& $("userName").value.length > 0)
|
&& $("userName").value.length > 0)
|
||||||
return onLoginClick (event);
|
return onLoginClick(event);
|
||||||
else
|
else
|
||||||
Event.stop(event);
|
Event.stop(event);
|
||||||
} else if (IsCharacterKey(event.keyCode)
|
} else if (IsCharacterKey(event.keyCode)
|
||||||
|
@ -60,6 +60,7 @@ function onLoginClick(event) {
|
||||||
var userName = userNameField.value;
|
var userName = userNameField.value;
|
||||||
var password = $("password").value;
|
var password = $("password").value;
|
||||||
var language = $("language");
|
var language = $("language");
|
||||||
|
var domain = $("domain");
|
||||||
|
|
||||||
if (userName.length > 0 && password.length > 0) {
|
if (userName.length > 0 && password.length > 0) {
|
||||||
this.disabled = true;
|
this.disabled = true;
|
||||||
|
@ -77,6 +78,8 @@ function onLoginClick(event) {
|
||||||
parameters += ((language.value == "WONoSelectionString")
|
parameters += ((language.value == "WONoSelectionString")
|
||||||
? ""
|
? ""
|
||||||
: ("&language=" + language.value));
|
: ("&language=" + language.value));
|
||||||
|
if (domain)
|
||||||
|
parameters += "&domain=" + domain.value;
|
||||||
/// Discarded as it seems to create a cookie for nothing. To discard
|
/// Discarded as it seems to create a cookie for nothing. To discard
|
||||||
// a cookie in JS, have a look here: http://www.quirksmode.org/js/cookies.html
|
// a cookie in JS, have a look here: http://www.quirksmode.org/js/cookies.html
|
||||||
//document.cookie = "";\
|
//document.cookie = "";\
|
||||||
|
@ -138,7 +141,10 @@ function onLoginCallback(http) {
|
||||||
function redirectToUserPage() {
|
function redirectToUserPage() {
|
||||||
// Redirect to proper page
|
// Redirect to proper page
|
||||||
var userName = $("userName").value;
|
var userName = $("userName").value;
|
||||||
if (typeof(loginSuffix) != "undefined"
|
var domain = $("domain");
|
||||||
|
if (domain)
|
||||||
|
userName += '@' + domain.value;
|
||||||
|
else if (typeof(loginSuffix) != "undefined"
|
||||||
&& loginSuffix.length > 0
|
&& loginSuffix.length > 0
|
||||||
&& !userName.endsWith(loginSuffix))
|
&& !userName.endsWith(loginSuffix))
|
||||||
userName += loginSuffix;
|
userName += loginSuffix;
|
||||||
|
|
Loading…
Reference in a new issue