public function processsignupAction() { $request = $this->getRequest(); // Check if we have a POST request if (!$request->isPost()) return $this->_helper->redirector('index'); // Get our form and validate it; display signup form if entries // are invalid $form = $this->getSignupForm(); if (!$form->isValid($request->getPost())) { $this->view->loginForm = $this->getLoginForm(); $this->view->signupForm = $form; return $this->render('index'); } // create the new profile. this function will return null // if the profile already exists $ar=$form->getValues(); $username=$ar['username']; try { $profile = ProfileTable::create($username); } catch (Exception $e) { $this->handleError($e); } if (!$profile) { // already exists $form->setDescription('Username already exists, please choose '. 'another one!'); $this->view->loginForm = $this->getLoginForm(); $this->view->signupForm = $form; return $this->render('index'); } else { // initialize with an empty password $profile->setId($username); $profile->setPasswordPlain(''); ProfileTable::store($profile); // The user was created! Authenticate the user against his empty // password and redirect him to the profile page. $adapter=$this->getAuthAdapter(array('username' => $username, 'password' => '')); $auth=Zend_Auth::getInstance(); $result=$auth->authenticate($adapter); if (!$result->isValid()) die("This should never happen..."); $this->_helper->redirector('index', 'profile'); } }