Good day! I have a question for you: how can I properly redirect the auth.class.php class in its functions? I did it by analogy with standard functions (Login in a class), it uses the following code to redirect:

$this->_sendRedirect('login'); 

Which in this function is described later as follows:

 if ($action == 'login' && $this->config['loginResourceId']) { if (in_array($this->config['loginResourceId'], $error_pages)) { $this->config['loginResourceId'] = $this->config['page_id']; } $url = $this->modx->makeUrl($this->config['loginResourceId'], '', '', 'full'); } elseif ($action == 'logout' && $this->config['logoutResourceId']) { if (in_array($this->config['logoutResourceId'], $error_pages)) { $this->config['logoutResourceId'] = $this->config['page_id']; } $url = $this->modx->makeUrl($this->config['logoutResourceId'], '', '', 'full'); } 

In my function formRepair, I also try to send a redirect, but the problem is that when I do this before Return returns, the form hangs. If after return, then the redirect simply does not work:

 return $this->success("Смс отправлена на ваш телефон!"); $this->_sendRedirect('login'); 

So how to get your function to work with the redirect? What is the secret here?

Although in the same procedure, the Login redirect comes before the value of the function is returned:

 $this->_sendRedirect('login'); return true; 

    1 answer 1

    http://rtfm.modx.com/revolution/2.x/developing-in-modx/other-development-resources/class-reference/modx/modx.seractirect

    And where did you find _sendRedirect($url); in the Login class _sendRedirect($url); ? You have something old.
    $this->modx->sendRedirect used in controllers.

    • I threw you information from RTFM, use sendRedirect or sendForward. Even wrote how to use: $this->modx->sendRedirect or $modx->sendRedirect . - binliz
    • @binliz, I tried to use this function already, the result is the same ... which is described above. I wrote that I used it. Nothing changes radically. - IntegralAL
    • Then you need more information. Does it hang like? 101-102 gives an error or cyclic redirect or some of the 5xx? - binliz