function login_process()
 {
     $form = $this->load->form('login', $_POST);
     if (!$form->validate()) {
         Session::setFlash('next', $form->next->getValue());
         $this->helper->redirect->flash(UrlHelper::referer(), $form->getId(), $form->getFlashParams());
     }
     $values = $form->getValue();
     if ($form->next->getValue()) {
         #Parameters 'auth' => 'login' are passed as a flash to the next page
         $this->view->setRedirect($form->next->getValue(), 'auth', 'login');
     } else {
         $this->view->setRedirect('/');
     }
     $user_id = $this->db->Auth->getUserId($values['username'], $values['password']);
     if (!$user_id && $this->config['old_password']) {
         $user_id = $this->db->Auth->getUserIdFromOldPassword($values['username'], $form->password->getRawValue());
     }
     if (!$user_id) {
         $form->username->setErrorCode('invalid');
         $this->helper->redirect->flash(UrlHelper::referer(), $form->getId(), $form->getFlashParams());
     }
     if (!$this->db->Auth->isEnabled($user_id)) {
         $this->helper->redirect->flash(UrlHelper::referer(), $form->getId(), $form->getFlashParams());
     }
     if (!$this->db->Auth->isActivated($user_id)) {
         $this->helper->redirect->to('/auth/unconfirmed');
     }
     $this->plugin->Auth->login($user_id, $form->remember->isChecked(), $values['module']);
 }
 protected function addRedirectLines()
 {
     if ($this->config['show_redirect']) {
         $lines = $this->session->getFlash('console');
         if ($lines) {
             $this->addLine('-- FROM PREVIOUS PAGE --', 'redirect', UrlHelper::referer(true), false);
             $this->lines = array_merge($this->lines, $lines);
         }
     }
 }
 function __construct($context)
 {
     $referer = UrlHelper::referer();
     $this->next = $referer ? $referer : $context->getModule();
     parent::__construct($context);
 }
示例#4
0
 final function validateOrRedirect($url = null)
 {
     if (!$url) {
         $url = UrlHelper::referer();
     }
     if (!$url) {
         $url = '/';
     }
     if (!$this->validate()) {
         RedirectHelper::flash($url, $this->getId(), $this->getFlashParams());
     }
 }