See ChangeLog.

Monotone-Parent: 9b2ef440fdc7d9495d4f165d7fafc6bd0b2d6068
Monotone-Revision: 9622fc005299a8ed3c143c177667be6f33df9523

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2011-10-25T20:58:18
maint-2.0.2
Francis Lachapelle 2011-10-25 20:58:18 +00:00
parent f287bc5835
commit d437ca0540
7 changed files with 88 additions and 3 deletions

View File

@ -1,3 +1,10 @@
2011-10-25 Francis Lachapelle <flachapelle@inverse.ca>
* UI/MainUI/SOGoRootPage.m (-cookieUsername)
(-cookieWithUsername:): getter/setter for the new SOGoLogin
cookie. This is used for the new "Remember username" checkbox that
appears on the login page.
2011-10-24 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* OpenChange/MAPIStoreAttachment.m

View File

@ -5,6 +5,7 @@
"Username:" = "Username:";
"Password:" = "Password:";
"Domain:" = "Domain:";
"Remember username" = "Remember username";
"Connect" = "Connect";

View File

@ -5,6 +5,7 @@
"Username:" = "Nom d'utilisateur :";
"Password:" = "Mot de passe :";
"Domain:" = "Domaine :";
"Remember username" = "Se souvenir de moi";
"Connect" = "Connexion";

View File

@ -28,6 +28,7 @@
@interface SOGoRootPage : UIxComponent
{
id item;
NSString *cookieLogin;
}
@end

View File

@ -58,6 +58,22 @@
@implementation SOGoRootPage
- (id) init
{
if ((self = [super init]))
{
cookieLogin = nil;
}
return self;
}
- (void) dealloc
{
[cookieLogin release];
[super dealloc];
}
/* accessors */
- (NSString *) connectURL
@ -65,6 +81,25 @@
return [NSString stringWithFormat: @"%@/connect", [self applicationPath]];
}
- (NSString *) cookieUsername
{
NSString *value;
if (cookieLogin == nil)
{
value = [[context request] cookieValueForKey: @"SOGoLogin"];
cookieLogin = [value isNotNull]? [value stringByDecodingBase64] : @"";
[cookieLogin retain];
}
return cookieLogin;
}
- (BOOL) rememberLogin
{
return ([[self cookieUsername] length]);
}
- (WOCookie *) _cookieWithUsername: (NSString *) username
andPassword: (NSString *) password
forAuthenticator: (SOGoWebAuthenticator *) auth
@ -105,6 +140,32 @@
return authCookie;
}
- (WOCookie *) _cookieWithUsername: (NSString *) username
{
WOCookie *loginCookie;
NSString *appName;
NSCalendarDate *date;
appName = [[context request] applicationName];
if (username)
{
loginCookie = [WOCookie cookieWithName: @"SOGoLogin"
value: [username stringByEncodingBase64]];
}
else
{
loginCookie = [WOCookie cookieWithName: @"SOGoLogin"
value: nil];
date = [NSCalendarDate calendarDate];
[date setTimeZone: [NSTimeZone timeZoneWithAbbreviation: @"GMT"]];
[loginCookie setExpires: [date yesterday]];
}
[loginCookie setPath: [NSString stringWithFormat: @"/%@/", appName]];
return loginCookie;
}
- (WOCookie *) _casLocationCookie: (BOOL) cookieReset
{
WOCookie *locationCookie;
@ -155,7 +216,7 @@
SOGoPasswordPolicyError err;
int expire, grace;
BOOL b;
BOOL rememberLogin, b;
err = PolicyNoError;
expire = grace = -1;
@ -166,6 +227,7 @@
username = [request formValueForKey: @"userName"];
password = [request formValueForKey: @"password"];
language = [request formValueForKey: @"language"];
rememberLogin = [[request formValueForKey: @"rememberLogin"] boolValue];
domain = [request formValueForKey: @"domain"];
if ((b = [auth checkLogin: username password: password domain: &domain
@ -220,6 +282,11 @@
response = [self _responseWithLDAPPolicyError: err];
}
if (rememberLogin)
[response addCookie: [self _cookieWithUsername: username]];
else
[response addCookie: [self _cookieWithUsername: nil]];
return response;
}

View File

@ -38,7 +38,7 @@
<td id="loginCell" width="230">
<label><var:string label:value="Username:"/><br/>
<input class="textField" id="userName" name="userName"
type="text" var:value="userName" /></label>
type="text" var:value="cookieUsername" /></label>
<label><var:string label:value="Password:"/><br/>
<input class="textField" id="password"
name="password" type="password" var:value="password" /></label>
@ -61,6 +61,7 @@
string="item"
/></label>
</var:if>
<label><input id="rememberLogin" type="checkbox" class="checkBox" var:checked="rememberLogin"/> <var:string label:value="Remember username"/></label>
<label>
<a href="#" class="button" id="submit" name="submit">
<span><var:string label:value="Connect" /></span></a>

View File

@ -29,7 +29,6 @@ function initLogin() {
submit.observe("click", onLoginClick);
var userName = $("userName");
userName.focus();
userName.observe("keydown", onFieldKeyDown);
var passw = $("password");
@ -40,6 +39,11 @@ function initLogin() {
var submitBtn = $("submit");
submitBtn.disabled = false;
if (userName.value.empty())
userName.focus();
else
passw.focus();
}
function onFieldKeyDown(event) {
@ -82,6 +86,9 @@ function onLoginClick(event) {
: ("&language=" + language.value));
if (domain)
parameters += "&domain=" + domain.value;
if ($("rememberLogin").checked)
parameters += "&rememberLogin=1";
/// 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
//document.cookie = "";\