summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-05-13 17:23:48 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-05-13 17:23:48 +0000
commit679e9011d97e5c79c308aad23ffc240f0ba69737 (patch)
tree36c108252c5e798574caeee3cd3c2ea7f523c700
parent09787420897868e203410efe4323106a47a40c15 (diff)
downloadbrdo-679e9011d97e5c79c308aad23ffc240f0ba69737.tar.gz
brdo-679e9011d97e5c79c308aad23ffc240f0ba69737.tar.bz2
#292565 follow-up by Jody Lynn: Remove ['destination'] hacks to get login redirection working again.
-rw-r--r--includes/common.inc11
-rw-r--r--includes/form.inc6
-rw-r--r--modules/user/user.test24
3 files changed, 25 insertions, 16 deletions
diff --git a/includes/common.inc b/includes/common.inc
index ea7b02a74..45c15cc8b 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -358,11 +358,6 @@ function drupal_not_found() {
watchdog('page not found', check_plain($_GET['q']), NULL, WATCHDOG_WARNING);
- // Keep old path for reference.
- if (!isset($_REQUEST['destination'])) {
- $_REQUEST['destination'] = $_GET['q'];
- }
-
$path = drupal_get_normal_path(variable_get('site_404', ''));
if ($path && $path != $_GET['q']) {
// Custom 404 handler. Set the active item in case there are tabs to
@@ -389,13 +384,9 @@ function drupal_not_found() {
*/
function drupal_access_denied() {
drupal_set_header('403 Forbidden');
+
watchdog('access denied', check_plain($_GET['q']), NULL, WATCHDOG_WARNING);
- // Keep old path for reference.
- if (!isset($_REQUEST['destination'])) {
- $_REQUEST['destination'] = $_GET['q'];
- }
-
$path = drupal_get_normal_path(variable_get('site_403', ''));
if ($path && $path != $_GET['q']) {
// Custom 403 handler. Set the active item in case there are tabs to
diff --git a/includes/form.inc b/includes/form.inc
index 10c344712..c5803b46e 100644
--- a/includes/form.inc
+++ b/includes/form.inc
@@ -691,12 +691,6 @@ function drupal_redirect_form($form, $redirect = NULL) {
}
if (!isset($goto) || ($goto !== FALSE)) {
if (isset($goto)) {
- // Remove any fake destination set by drupal_not_found() or
- // drupal_access_denied() so that we can properly redirect from those
- // pages.
- if (isset($_REQUEST['destination']) && $_REQUEST['destination'] == $_GET['q']) {
- unset($_REQUEST['destination']);
- }
if (is_array($goto)) {
call_user_func_array('drupal_goto', $goto);
}
diff --git a/modules/user/user.test b/modules/user/user.test
index 3822cc537..b9e0f5ba9 100644
--- a/modules/user/user.test
+++ b/modules/user/user.test
@@ -923,6 +923,30 @@ class UserBlocksUnitTests extends DrupalWebTestCase {
}
/**
+ * Test the user login block.
+ */
+ function testUserLoginBlock() {
+ // Create a user with some permission that anonymous users lack.
+ $user = $this->drupalCreateUser(array('administer permissions'));
+
+ // Log in using the block.
+ $edit = array();
+ $edit['name'] = $user->name;
+ $edit['pass'] = $user->pass_raw;
+ $this->drupalPost('admin/user/permissions', $edit, t('Log in'));
+ $this->assertText(t('Log out'), t('Logged in.'));
+
+ // Check that we are still on the same page.
+ $this->assertPattern('!<title.*?' . t('Permissions') . '.*?</title>!', t('Still on the same page after login for access denied page'));
+
+ // Now, log out and repeat with a non-403 page.
+ $this->clickLink(t('Log out'));
+ $this->drupalPost('filter/tips', $edit, t('Log in'));
+ $this->assertText(t('Log out'), t('Logged in.'));
+ $this->assertPattern('!<title.*?' . t('Compose tips') . '.*?</title>!', t('Still on the same page after login for allowed page'));
+ }
+
+ /**
* Test the Who's Online block.
*/
function testWhosOnlineBlock() {