コード例 #1
0
ファイル: login.php プロジェクト: ValenokPC/tabernacms
 function loginFromSite()
 {
     $login = $this->request('login');
     $pass = $this->request('pass');
     if (strlen($login) and strlen($pass) and $this->hash() == $this->request('hash')) {
         if (rad_session::login($login, $pass)) {
             $this->setVar('user', $this->getCurrentUser());
             rad_instances::get('model_corecatalog_bin')->mergeCart();
             if ($this->request('referer')) {
                 $this->redirect($this->request('referer'));
             } else {
                 $this->redirect($this->makeURL('alias=' . $this->config('mainAlias')));
             }
         } elseif (rad_session::$error_code == rad_session::ERROR_USER_IS_BLOCKED) {
             $this->setVar('message_error', $this->lang('user_is_blocked.session.message'));
         } elseif (rad_session::$error_code == rad_session::ERROR_USER_NOT_ACTIVATED) {
             $this->setVar('message_error', $this->lang('user_not_activated.session.message', null, true, array('@link@' => $this->makeURL('alias=register&a=reactivate&hash=' . $this->hash()))));
         } else {
             //login incorrect
             $this->setVar('message_error', $this->lang('loginpassincorrect.session.message'));
             $this->setVar('req', $this->getAllRequest());
         }
     } elseif ($this->request('logout')) {
         rad_session::logout();
         $this->redirect($this->makeUrl('alias=' . $this->config('defaultAlias')));
     }
 }