Example #1
0
 public function createAction()
 {
     $userCreateForm = new Application_Form_UserCreate();
     /** @var $request Zend_Controller_Request_Http */
     $request = $this->getRequest();
     if ($request->isPost() && $userCreateForm->isValid($request->getPost())) {
         $formValues = $userCreateForm->getValues();
         $userModel = new Application_Model_User();
         $userModel->setFromArray($formValues);
         $randomPassword = $this->_generateRandomPassword();
         $userModel->setAndSaltPassword($randomPassword);
         $userMapper = $this->_getUserMapper();
         $userMapper->save($userModel);
         $this->getFlashMessenger()->addSuccessMessage(sprintf('created new user with id %d and password %s', $userModel->getId(), $randomPassword));
         $this->_redirect($this->url('list'), array('exit' => true));
     }
     $this->view->assign('form', $userCreateForm);
 }
Example #2
0
 public function init()
 {
     parent::init();
     $submitButton = $this->getElement('send');
     $submitButton->setLabel('Update user');
 }