Monotone-Parent: 47b9620ce14470cae0697918adc94344f3f07b0e

Monotone-Revision: b4d23e0ff0b98727a952a0a09a9cb7e312f3562a

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2008-08-26T17:42:03
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2008-08-26 17:42:03 +00:00
parent 0227fd120e
commit 5876989e1d
8 changed files with 148 additions and 154 deletions
+17 -26
View File
@@ -46,24 +46,8 @@
@implementation SOGoRootPage
- (void) dealloc
{
[userName release];
[super dealloc];
}
/* accessors */
- (void) setUserName: (NSString *) _value
{
ASSIGNCOPY (userName, _value);
}
- (NSString *) userName
{
return userName;
}
- (NSString *) connectURL
{
return [NSString stringWithFormat: @"%@connect", [self applicationPath]];
@@ -77,20 +61,27 @@
WOCookie *authCookie;
SOGoWebAuthenticator *auth;
NSString *cookieValue, *cookieString;
NSString *userName, *password;
auth = [[WOApplication application]
authenticatorInContext: context];
request = [context request];
response = [self responseWith204];
cookieString = [NSString stringWithFormat: @"%@:%@",
[request formValueForKey: @"userName"],
[request formValueForKey: @"password"]];
cookieValue = [NSString stringWithFormat: @"basic %@",
[cookieString stringByEncodingBase64]];
authCookie = [WOCookie cookieWithName: [auth cookieNameInContext: context]
value: cookieValue];
[authCookie setPath: @"/"];
[response addCookie: authCookie];
userName = [request formValueForKey: @"userName"];
password = [request formValueForKey: @"password"];
if ([auth checkLogin: userName password: password])
{
response = [self responseWith204];
cookieString = [NSString stringWithFormat: @"%@:%@",
userName, password];
cookieValue = [NSString stringWithFormat: @"basic %@",
[cookieString stringByEncodingBase64]];
authCookie = [WOCookie cookieWithName: [auth cookieNameInContext: context]
value: cookieValue];
[authCookie setPath: @"/"];
[response addCookie: authCookie];
}
else
response = [self responseWithStatus: 403];
return response;
}