Monotone-Parent: 4bda58ef38f5ccda5b874a0271bc6fd1168c8d2e

Monotone-Revision: 4931dae72f1ad88e9b719cf79ec472271ce13836

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2010-08-12T17:34:32
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2010-08-12 17:34:32 +00:00
parent 060d06bc60
commit 5c4964bc55
6 changed files with 74 additions and 12 deletions
+16
View File
@@ -1,5 +1,21 @@
2010-08-12 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* UI/WebServerResources/generic.js: (onAjaxRequestStateChange):
when using CAS authentication and when the return code is 0 and
when the request status is 4, chances are that the initial ajax
request failed due to the expiration of the CAS ticket entry in
memcached. In FF 3.5 and above, a bug prevents the initial cookie
from being given back to the reauthentication redirect from an
AJAX request. Therefore we open a window that will do this for us
and will close one the authentication has succeeded again.
* UI/MainUI/SOGoRootPage.m (-revoverAction): new fake action that
perform the CAS redirection and then trigger the respawn of the
initial request.
* UI/Common/UIxPageFrame.m (-usesCASAuthentication): new accessor
used for recovery of redirected requests.
* SoObjects/Contacts/SOGoFolder+CardDAV.m:
(_appendObject:withBaseURL:toREPORTResponse:): moved method here
from SOGOContact{GCS,Source}Folder since its implementation was
+9
View File
@@ -406,6 +406,15 @@
&& [user isSuperUser]);
}
- (BOOL) usesCASAuthentication
{
SOGoSystemDefaults *sd;
sd = [SOGoSystemDefaults sharedSystemDefaults];
return [[sd authenticationType] isEqualToString: @"cas"];
}
- (NSString *) userIdentification
{
/* The "identification" term is used in the human sense here. */
+5
View File
@@ -435,4 +435,9 @@
return response;
}
- (id) recoverAction
{
return [self jsCloseWithRefreshMethod: @"recoverRequest();"];
}
@end /* SOGoRootPage */
+6 -1
View File
@@ -106,10 +106,15 @@
};
};
methods = {
view = {
view = {
protectedBy = "<public>";
pageName = "SOGoRootPage";
};
recover = {
protectedBy = "View";
pageName = "SOGoRootPage";
actionName = "recover";
};
index = {
protectedBy = "<public>";
pageName = "SOGoRootPage";
+6
View File
@@ -133,6 +133,12 @@
<var:if condition="isSuperUser" const:negate="YES"
>var IsSuperUser = false;
</var:if>
<var:if condition="usesCASAuthentication"
>var usesCASAuthentication = true;
</var:if>
<var:if condition="usesCASAuthentication" const:negate="YES"
>var usesCASAuthentication = false;
</var:if>
<var:if condition="shortUserNameForDisplay" const:value="anonymous"
const:negate="YES"
>var UserFolderURL = '<var:string value="userFolderPath" const:escapeHTML="NO"/>';
+32 -11
View File
@@ -23,6 +23,7 @@ var logConsole;
var logWindow = null;
var queryParameters;
var recoveryRequest = null;
var menus = new Array();
var search = {};
@@ -245,15 +246,24 @@ function createHTTPClient() {
function onAjaxRequestStateChange(http) {
try {
if (http.readyState == 4
&& activeAjaxRequests > 0) {
if (!http.aborted)
http.callback(http);
activeAjaxRequests--;
checkAjaxRequestsState();
http.onreadystatechange = Prototype.emptyFunction;
http.callback = Prototype.emptyFunction;
http.callbackData = null;
if (http.readyState == 4) {
if (http.status == 0 && usesCASAuthentication) {
recoveryRequest = http;
var urlstr = ApplicationBaseURL;
if (!urlstr.endsWith('/'))
urlstr += '/';
urlstr += ("../../recover");
window.open(urlstr, "_blank");
}
else if (activeAjaxRequests > 0) {
if (!http.aborted)
http.callback(http);
activeAjaxRequests--;
checkAjaxRequestsState();
http.onreadystatechange = Prototype.emptyFunction;
http.callback = Prototype.emptyFunction;
http.callbackData = null;
}
}
}
catch(e) {
@@ -275,6 +285,16 @@ function onAjaxRequestStateChange(http) {
}
}
function recoverRequest() {
if (recoveryRequest) {
triggerAjaxRequest(recoveryRequest.url,
recoveryRequest.callback,
recoveryRequest.callbackData,
recoveryRequest.paramHeaders);
recoveryRequest = null;
}
}
/* taken from Lightning */
function getContrastingTextColor(bgColor) {
var calcColor = bgColor.substring(1);
@@ -298,9 +318,10 @@ function triggerAjaxRequest(url, callback, userdata, content, headers) {
http.open("POST", url, true);
http.url = url;
http.paramHeaders = headers;
http.callback = callback;
http.callbackData = userdata;
http.onreadystatechange = function() { onAjaxRequestStateChange(http);};
http.onreadystatechange = function() { onAjaxRequestStateChange(http); };
// = function() {
// // log ("state changed (" + http.readyState + "): " + url);
// };
@@ -1755,7 +1776,7 @@ function showAlertDialog(label) {
_showAlertDialog(label);
}
}
function _showAlertDialog(label) {
var dialog = null;
if (dialogs[label])