public function signupAction()
 {
     $form = new Webteam_Form_Registration();
     $this->view->form = $form;
     if ($this->getRequest()->isPost()) {
         if ($form->isValid($this->getRequest()->getPost())) {
             $values = $form->getValues();
             if ($values['Password'] != $values['ConfirmPassword']) {
                 $this->view->message = 'Passwords do not match.';
                 return;
             }
             //check if the user already exists in the database
             $adapter = new Webteam_Auth_Adapter_Doctrine($values['UserName'], $values['Password']);
             $result = $adapter->isUniqueUsername();
             if ($result) {
                 $user = new Webteam_Model_User();
                 unset($values['ConfirmPassword']);
                 $user->fromArray($values);
                 $user->save();
                 $this->_helper->getHelper('FlashMessenger')->addMessage('Your account has been successfully created.');
                 $this->_redirect('/login/success');
             } else {
                 $this->view->message = 'User name has been taken please choose another.';
             }
         } else {
             $this->view->message = 'Please provide valid input.';
         }
     }
 }
 public function init()
 {
     // get parent form
     parent::init();
     $this->removeElement('UserID');
     $this->removeElement('UserName');
     $this->removeElement('FirstName');
     $this->removeElement('LastName');
     $this->removeElement('Email');
     $this->removeElement('register');
     $submit = new Zend_Form_Element_Submit('save');
     $submit->setLabel('Save');
     $submit->setOptions(array('class' => 'submit'));
     $this->addElement($submit);
     // set form action (set to false for current URL)
     $this->setAction('/user/account/password');
 }