public function redirectUrl($url = null)
    {
        $redirectUrl = $this->getController()->getRequest()->getQuery(static::QUERY_STRING_REDIRECT);
        if ($redirectUrl && (substr($redirectUrl, 0, 1) !== '/' || substr($redirectUrl, 0, 2) === '//')) {
            $redirectUrl = null;
        }

        if ($url !== null) {
            $redirectUrl = $url;
        } elseif ($redirectUrl) {
            if (Router::normalize($redirectUrl) === Router::normalize($this->_config['loginAction'])) {
                $redirectUrl = $this->_config['loginRedirect'];
            }
        } elseif ($this->_config['loginRedirect']) {
            $redirectUrl = $this->_config['loginRedirect'];
        } else {
            $redirectUrl = '/';
        }
        if (is_array($redirectUrl)) {
            return Router::url($redirectUrl + ['_base' => false]);
        }

        return $redirectUrl;
    }
public function redirectUrl($url = null)
    {
        $redirectUrl = $this->getController()->getRequest()->getQuery(static::QUERY_STRING_REDIRECT);
        if ($redirectUrl && (substr($redirectUrl, 0, 1) !== '/' || substr($redirectUrl, 0, 2) === '//')) {
            $redirectUrl = null;
        }

        if ($url !== null) {
            $redirectUrl = $url;
        } elseif ($redirectUrl) {
            if (Router::normalize($redirectUrl) === Router::normalize($this->_config['loginAction'])) {
                $redirectUrl = $this->_config['loginRedirect'];
            }
        } elseif ($this->_config['loginRedirect']) {
            $redirectUrl = $this->_config['loginRedirect'];
        } else {
            $redirectUrl = '/';
        }
        if (is_array($redirectUrl)) {
            return Router::url($redirectUrl + ['_base' => false]);
        }

        return $redirectUrl;
    }
public function redirectUrl ( $ url = null ) { $ redirectUrl = $ this -> getController ( ) -> getRequest ( ) -> getQuery ( static :: QUERY_STRING_REDIRECT ) ; if ( $ redirectUrl && ( substr ( $ redirectUrl , 0 , 1 ) !== '/' || substr ( $ redirectUrl , 0 , 2 ) === '//' ) ) { $ redirectUrl = null ; } if ( $ url !== null ) { $ redirectUrl = $ url ; } elseif ( $ redirectUrl ) { if ( Router :: normalize ( $ redirectUrl ) === Router :: normalize ( $ this -> _config [ 'loginAction' ] ) ) { $ redirectUrl = $ this -> _config [ 'loginRedirect' ] ; } } elseif ( $ this -> _config [ 'loginRedirect' ] ) { $ redirectUrl = $ this -> _config [ 'loginRedirect' ] ; } else { $ redirectUrl = '/' ; } if ( is_array ( $ redirectUrl ) ) { return Router :: url ( $ redirectUrl + [ '_base' => false ] ) ; } return $ redirectUrl ; }
Get the URL a user should be redirected to upon login.

Pass a URL in to set the destination a user should be redirected to upon
logging in.

If no parameter is passed, gets the authentication redirect URL. The URL
returned is as per following rules:

- Returns the normalized redirect URL from storage if it is
present and for the same domain the current app is running on.
- If there is no URL returned from storage and there is a config
`loginRedirect`, the `loginRedirect` value is returned.
- If there is no session and no `loginRedirect`, / is returned.

@param string|array|null $url Optional URL to write as the login redirect URL.
@return string Redirect URL
Get the URL a user should be redirected to upon login .