From 3391161a12f8fc93ac07271146aaf3b789e6ed21 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Wed, 21 Nov 2007 16:42:58 +0000 Subject: [PATCH] Monotone-Parent: 555ffbaeafab3a0a23649acb1714e47a78d35d81 Monotone-Revision: c7c2186348790bb64c08730ba255f908ac68cfa9 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-11-21T16:42:58 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 6 ++++++ UI/MainUI/SOGoRootPage.m | 6 ++++-- UI/WebServerResources/SOGoRootPage.js | 13 +++++++------ UI/WebServerResources/generic.js | 8 ++++++-- 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 288c513a0..ece5746e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-11-21 Wolfgang Sourdeau + + * UI/MainUI/SOGoRootPage.m ([SOGoRootPage -connectAction]): the + user infos are now posted as "application/x-www-form-urlencoded". + So we have to have like a form has been posted. + 2007-11-21 Francis Lachapelle * UI/Scheduler/UIxComponentEditor.m ([UIxComponentEditor diff --git a/UI/MainUI/SOGoRootPage.m b/UI/MainUI/SOGoRootPage.m index 8b82c4101..5b6b6364e 100644 --- a/UI/MainUI/SOGoRootPage.m +++ b/UI/MainUI/SOGoRootPage.m @@ -63,16 +63,18 @@ - (id ) connectAction { WOResponse *response; + WORequest *request; WOCookie *authCookie; SOGoWebAuthenticator *auth; NSString *cookieValue, *cookieString; auth = [[WOApplication application] authenticatorInContext: context]; + request = [context request]; response = [self responseWith204]; cookieString = [NSString stringWithFormat: @"%@:%@", - [self queryParameterForKey: @"userName"], - [self queryParameterForKey: @"password"]]; + [request formValueForKey: @"userName"], + [request formValueForKey: @"password"]]; cookieValue = [NSString stringWithFormat: @"basic %@", [cookieString stringByEncodingBase64]]; authCookie = [WOCookie cookieWithName: [auth cookieNameInContext: context] diff --git a/UI/WebServerResources/SOGoRootPage.js b/UI/WebServerResources/SOGoRootPage.js index cad1169e0..7201ce050 100644 --- a/UI/WebServerResources/SOGoRootPage.js +++ b/UI/WebServerResources/SOGoRootPage.js @@ -20,11 +20,13 @@ function onLoginClick(event) { var password = $("password").value; if (userName.length > 0) { - var url = ($("connectForm").getAttribute("action") - + "?userName=" + userName - + "&password=" + password); + var url = $("connectForm").getAttribute("action"); + var parameters = ("userName=" + userName + "&password=" + password); document.cookie = ""; - triggerAjaxRequest(url, onLoginCallback); + triggerAjaxRequest(url, onLoginCallback, null, parameters, + { "Content-type": "application/x-www-form-urlencoded", + "Content-length": parameters.length, + "Connection": "close" }); } preventDefault(event); @@ -32,9 +34,8 @@ function onLoginClick(event) { function onLoginCallback(http) { if (http.readyState == 4) { - if (isHttpStatus204(http.status)) { + if (isHttpStatus204(http.status)) window.location.href = ApplicationBaseURL + $("userName").value; - } } } diff --git a/UI/WebServerResources/generic.js b/UI/WebServerResources/generic.js index 649de6713..4db0fb493 100644 --- a/UI/WebServerResources/generic.js +++ b/UI/WebServerResources/generic.js @@ -290,7 +290,7 @@ function appendDifferentiator(url) { return url_nocache; } -function triggerAjaxRequest(url, callback, userdata) { +function triggerAjaxRequest(url, callback, userdata, content, headers) { var http = createHTTPClient(); activeAjaxRequests += 1; @@ -323,7 +323,11 @@ function triggerAjaxRequest(url, callback, userdata) { log(backtrace()); } }; - http.send(null); + if (headers) { + for (var i in headers) + http.setRequestHeader(i, headers[i]); + } + http.send(content); } else { log("triggerAjaxRequest: error creating HTTP Client!");