diff options
author | jkornobis <jkornobis@linagora.com> | 2012-10-30 15:08:49 +0100 |
---|---|---|
committer | jeremie kornobis <jkornobis@linagora.com> | 2012-11-12 15:29:07 +0100 |
commit | 7fac4dc87b2507227666db9b74d83090f38d62e7 (patch) | |
tree | fabc960915441a78d2ada8c823b086d8ce01ac71 | |
parent | f2bc8599f850131bb4118ebd5dd7118717d50c24 (diff) |
Grancefully handle SSO redirections on Ajax requests
On some SSO systems, when the SSO session is expired,
the system intercept HTTP requests and send a 302 "Found" HTTP code to the login page.
This patch handle this case in Roundcube Ajax requests, to redirect to the SSO login page.
Note that request.status don't have the 302 code (at least on Firefox), so we have to check the response headers for a Location field and redirect manually.
-rw-r--r-- | program/js/app.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/program/js/app.js b/program/js/app.js index 1aa008295..c748d497a 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -6271,6 +6271,11 @@ function rcube_webmail() else if (request.status == 0 && status != 'abort') this.display_message(this.get_label('servererror') + ' (No connection)', 'error'); + // redirect to url specified in location header if not empty + var location_url = request.getResponseHeader("Location"); + if (location_url) + this.redirect(location_url); + // re-send keep-alive requests after 30 seconds if (action == 'keep-alive') setTimeout(function(){ ref.keep_alive(); }, 30000); |