Ejemplo n.º 1
0
 public function deleteAction()
 {
     $this->view->disable();
     $id = $this->getParam('id');
     $row = Core_UserCenter_Table::getInstance()->find($id);
     $row->delete();
 }
Ejemplo n.º 2
0
 public function loginAction()
 {
     $this->view->setRenderLevel(Phalcon\Mvc\View::LEVEL_LAYOUT);
     if ($this->session->has('auth_hash')) {
         $hash = $this->session->get('auth_hash')['hash'];
         $user = Core_UserCenter_Table::findFirst(array("conditions" => "hash = '{$hash}'"));
         if (!$user) {
             $this->_removeAllSession();
             return;
         }
         $this->view->pick('auth/locked');
         $this->view->user = $user;
     }
     if (!$this->request->isPost()) {
         return;
     }
     $validation = new Core_Validation();
     $validation->add('login', new \Phalcon\Validation\Validator\PresenceOf());
     $messages = $validation->validate($this->request->getPost());
     // Получение переменных методом POST
     $login = $this->request->getPost('login');
     $password = $this->request->getPost('password');
     // Поиск пользователя в базе данных
     $user = Core_UserCenter_Table::findFirst(array("conditions" => "login = '******' AND password = '******'"));
     if ($user) {
         $this->_authorization($user);
         $this->view->setRenderLevel(Phalcon\Mvc\View::LEVEL_MAIN_LAYOUT);
         return $this->response->redirect();
     }
 }