Skip to content

Commit

Permalink
Make redirect url key configurable.
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed May 31, 2015
1 parent 84c599a commit df007fc
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/Auth/Storage/SessionStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,16 @@ class SessionStorage implements StorageInterface
/**
* Default configuration for this class.
*
* Keys:
*
* - `key` - Session key used to store user record.
* - `redirect` - Session key used to store redirect URL.
*
* @var array
*/
protected $_defaultConfig = [
'key' => 'Auth.User'
'key' => 'Auth.User',
'redirect' => 'Auth.redirect'
];

/**
Expand Down Expand Up @@ -117,14 +123,14 @@ public function delete()
public function redirectUrl($url = null)
{
if ($url === null) {
return $this->_session->read('Auth.redirect');
return $this->_session->read($this->_config['redirect']);
}

if ($url === false) {
$this->_session->delete('Auth.redirect');
$this->_session->delete($this->_config['redirect']);
return;
}

$this->_session->write('Auth.redirect', $url);
$this->_session->write($this->_config['redirect'], $url);
}
}

0 comments on commit df007fc

Please sign in to comment.