mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-21 03:15:25 +00:00
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:
+17
-26
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user