Skip to content

Commit

Permalink
When the admin controller redirects to the reauthenticate controller,…
Browse files Browse the repository at this point in the history
… the value of request::is_ajax() from the original request is lost. This patch stores its value in the session so the reauthenticate controller knows whether its in a dialog/panel or not.
  • Loading branch information
Tim Almdal authored and bharat committed Jul 31, 2010
1 parent 0cca2fd commit 29f29d2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion modules/gallery/controllers/admin.php
Expand Up @@ -86,7 +86,8 @@ private static function _prompt_for_reauth($controller_name, $args) {
// Avoid anti-phishing protection by passing the url as session variable.
Session::instance()->set("continue_url", url::abs_current(true));
}

// Save the is_ajax value as we lose it, if set, when we redirect
Session::instance()->set("is_ajax_request", request::is_ajax());
url::redirect("reauthenticate");
}
}
Expand Down
9 changes: 7 additions & 2 deletions modules/gallery/controllers/reauthenticate.php
Expand Up @@ -22,8 +22,13 @@ public function index($share_translations_form=null) {
if (!identity::active_user()->admin) {
access::forbidden();
}
if (request::is_ajax()) {
json::reply(array("form" => (string) self::_form()));
// On redirects from the admin controller, the ajax request indicator is lost,
// so we store it in the session.
$is_ajax = Session::instance()->get_once("is_ajax_request", request::is_ajax());
if ($is_ajax) {
$v = new View("reauthenticate.html");
$v->form = self::_form();
json::reply(array("form" => (string) $v));
} else {
self::_show_form(self::_form());
}
Expand Down

0 comments on commit 29f29d2

Please sign in to comment.