Beispiel #1
0
 /**
  * Creates a User
  */
 public function createAction()
 {
     if ($this->request->isPost()) {
         $user = new Users();
         $user->assign(array('name' => $this->request->getPost('name', 'striptags'), 'profilesId' => $this->request->getPost('profilesId', 'int'), 'email' => $this->request->getPost('email', 'email')));
         if (!$user->save()) {
             $this->flash->error($user->getMessages());
         } else {
             $this->flash->success("User was created successfully");
             Tag::resetInput();
         }
     }
     $this->view->form = new UsersForm(null);
 }
Beispiel #2
0
 /**
  * Allow a user to signup to the system
  */
 public function signupAction()
 {
     $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());
         }
     }
     $this->view->form = $form;
 }