Beispiel #1
0
 public function indexAction()
 {
     if ($this->request->isPost()) {
         $username = $this->request->getPost('username');
         $password = sha1($this->request->getPost('password'));
         $user = Admin::findFirst(array("username = :username: AND password = :password:"******"bind" => array('username' => $username, 'password' => $password)));
         if ($user != false) {
             $this->_registerSession($user);
             $this->flash->success('Welcome ' . $user->username);
             //Forward to the 'invoices' controller if the user is valid
             /*
                             return $this->dispatcher->forward(array(
                                 'controller' => 'index',
                                 'action' => 'index'
                             ));*/
             $this->response->redirect("http://localhost/phalcon-framework/public/index.php?_url=/admin");
         } else {
             $this->flash->error('username or password error');
         }
     }
 }
Beispiel #2
0
 public static function mostrarModulosByUser()
 {
     $adminMenu = new Admin();
     $datos = $adminMenu->modulosByUser();
     return $datos;
 }