ADmad/cakephp-social-auth

Redirect after login

hkosmidi opened this issue · 1 comments

I have a page to save an order which user must be logged in. So I do:

if (!$this->Authentication->getIdentity()) {
            $this->Flash->error('Error');
            $this->request->getSession()->write('SocialAuth.redirectUrl', '/baskets/save');
            return $this->redirect('/users/login');
        }

But it seems function _setRedirectUrl deletes it, when it is called before login. Why is that? How can I specify where to redirect to?

ADmad commented
$this->redirect('/users/login?redirect=/baskets/save');