public function registerAction()
{
$this->_helper->viewRenderer('registerform');
$form = new Application_Form_Register();
if ($form->isValid($this->getRequest()->getPost())) {
$User = new Application_Model_DbTable_User();
$salt = My_Salt::getSalt();
$dane = array(
'username' => $form->getValue('username'),
'password' => md5($form->getValue('password') . $salt),
'salt' => $salt,
'email' => $form->getValue('email')
);
$User->createRow($dane)->save();
return $this->_helper->redirector(
'index',
'index',
'default'
);
}
$this->view->form = $form;
}
Listing 37.4. Akcja auth/register
Rozdział 37. Rejestracja użytkowników