Ejemplo n.º 1
0
 /**
  * Creates a User
  *
  */
 public function createAction()
 {
     Tag::displayTo("role_id", 3);
     if ($this->request->isPost()) {
         $model = new Users();
         $model->assign(array('name' => $this->request->getPost('name', 'striptags'), 'role_id' => $this->request->getPost('role_id', 'int'), 'email' => $this->request->getPost('email', 'email')));
         if (!$model->save()) {
             $this->flash->error($model->getMessages());
         } else {
             $this->flashSession->success("Новый пользователь добавлен");
             Tag::resetInput();
             return $this->response->redirect("backend/users");
         }
     }
 }
Ejemplo n.º 2
0
 public function signupAction()
 {
     \Phalcon\Tag::appendTitle(" - Регистрация");
     $form = new SignUpForm();
     if ($this->request->isPost()) {
         if ($form->isValid($this->request->getPost()) != false) {
             $user = new Users();
             $user->assign(array('name' => $this->request->getPost('name', 'striptags'), 'email' => $this->request->getPost('email'), 'password' => $this->security->hash($this->request->getPost('password')), 'profilesId' => 2));
             if ($user->save()) {
                 return $this->dispatcher->forward(array('controller' => 'index', 'action' => 'index'));
             }
             $this->flash->error($user->getMessages());
         }
     }
     $pass = $this->security->checkHash('bob', '$2a$08$MtaK0TBGL0Wh4IVpMYMwlu.SmRpxja3r5n46edlPINe5uzlqi1Vym');
     $this->view->form = $form;
     $this->view->setVar('pass', $pass);
 }