Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Renamed AuthComponent::redirect() to AuthComponent::redirectUrl(). #1091

Merged
merged 1 commit into from

3 participants

ADmad Mark Story Mark S.
ADmad
Collaborator

Closes #3268

Mark Story
Owner

I like this :+1:

Mark S.
Collaborator

Never really got the chance to do it myself. Nice work. :+1:

ADmad ADmad merged commit 04ec9dd into from
ADmad ADmad deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
13 lib/Cake/Controller/Component/AuthComponent.php
View
@@ -623,6 +623,17 @@ protected function _getUser() {
}
/**
+ * Backwards compatible alias for AuthComponent::redirectUrl()
+ *
+ * @param string|array $url Optional URL to write as the login redirect URL.
+ * @return string Redirect URL
+ * @deprecated 2.3 Use AuthComponent::redirectUrl() instead
+ */
+ public function redirect($url = null) {
+ return $this->redirectUrl($url);
+ }
+
+/**
* If no parameter is passed, gets the authentication redirect URL. Pass a url in to
* set the destination a user should be redirected to upon logging in. Will fallback to
* AuthComponent::$loginRedirect if there is no stored redirect value.
@@ -630,7 +641,7 @@ protected function _getUser() {
* @param string|array $url Optional URL to write as the login redirect URL.
* @return string Redirect URL
*/
- public function redirect($url = null) {
+ public function redirectUrl($url = null) {
if (!is_null($url)) {
$redir = $url;
$this->Session->write('Auth.redirect', $redir);
10 lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php
View
@@ -758,7 +758,7 @@ public function testLoginRedirect() {
);
$this->Auth->startup($this->Controller);
$expected = Router::normalize($this->Auth->loginRedirect);
- $this->assertEquals($expected, $this->Auth->redirect());
+ $this->assertEquals($expected, $this->Auth->redirectUrl());
$this->Auth->Session->delete('Auth');
@@ -797,7 +797,7 @@ public function testLoginRedirect() {
$this->Auth->loginRedirect = false;
$this->Auth->startup($this->Controller);
$expected = Router::normalize('/admin');
- $this->assertEquals($expected, $this->Auth->redirect());
+ $this->assertEquals($expected, $this->Auth->redirectUrl());
// Ticket #4750
// Named Parameters
@@ -1263,7 +1263,7 @@ public function testFlashSettings() {
*/
public function testRedirectSet() {
$value = array('controller' => 'users', 'action' => 'home');
- $result = $this->Auth->redirect($value);
+ $result = $this->Auth->redirectUrl($value);
$this->assertEquals('/users/home', $result);
$this->assertEquals($value, $this->Auth->Session->read('Auth.redirect'));
}
@@ -1277,7 +1277,7 @@ public function testRedirectSessionRead() {
$this->Auth->loginAction = array('controller' => 'users', 'action' => 'login');
$this->Auth->Session->write('Auth.redirect', '/users/home');
- $result = $this->Auth->redirect();
+ $result = $this->Auth->redirectUrl();
$this->assertEquals('/users/home', $result);
$this->assertFalse($this->Auth->Session->check('Auth.redirect'));
}
@@ -1293,7 +1293,7 @@ public function testRedirectSessionReadEqualToLoginAction() {
$this->Auth->loginRedirect = array('controller' => 'users', 'action' => 'home');
$this->Auth->Session->write('Auth.redirect', array('controller' => 'users', 'action' => 'login'));
- $result = $this->Auth->redirect();
+ $result = $this->Auth->redirectUrl();
$this->assertEquals('/users/home', $result);
$this->assertFalse($this->Auth->Session->check('Auth.redirect'));
}
Something went wrong with that request. Please try again.