public function registrationAction() { $this->view->title = "Реєстрація нового користувача"; $this->view->headTitle($this->view->title, 'PREPEND'); $form = new Form_Registration(); if ($this->getRequest()->isPost()) { if ($form->isValid($this->getRequest()->getPost())) { //добавляємо користувача //save і fill створені методи в створеному класі Model_User $user = new Model_User(); $user->fill($form->getValues()); //getValues() - повертає асоціативний масив полів форми $user->created = date('Y-m-d, H:i:s'); $user->password = sha1($user->password); //sha1 — хэш строки $user->code = uniqid(); //генерація унікального ID $user->save(); $user->sendActivationEmail(); //надсилаємо активаційний email $this->_helper->redirector('index'); } } $this->view->form = $form; }
public function validateformAction() { $this->_helper->viewRenderer->setNoRender(); //$this->_helper->getHelper('layout')->disableLayout(); $f = new Form_Registration(); $f->isValid($this->_getAllParams()); $json = $f->getMessages(); header('Content-type: application/json'); echo Zend_Json::encode($json); }
public function registrationAction() { $this->view->title = "Регистрация нового пользователя."; $this->view->headTitle($this->view->title, 'PREPEND'); $form = new Form_Registration(); if ($this->getRequest()->isPost()) { if ($form->isValid($this->getRequest()->getPost())) { $user = new Model_User(); $user->fill($form->getValues()); $user->created = date('Y-m-d H:i:s'); $user->password = sha1($user->password); $user->code = uniqid(); $user->save(); $user->sendActivationEmail(); $this->_helper->redirector('index'); } } $this->view->form = $form; }
public function registerAction() { /* * Register for new account */ $register = new Form_Registration(); if (Zend_Auth::getInstance()->hasIdentity()) { $this->_redirect('/index/hello'); } else { if ($this->getRequest()->isPost()) { if ($register->isValid($this->getRequest()->getPost())) { } } } $this->view->register = $register; }