public function registerAction() { $authStorage = new AuthenticationStorage(self::NAMESPACE_ZENDSTORE_FRONT); $authService = new AuthenticationService($authStorage); if ($authService->hasIdentity()) { echo 'You have logined'; exit; } $request = $this->getRequest(); $form = new UserForm(); if ($request->isPost()) { $user = new User(); $form->setInputFilter($user->getInputFilter()); $form->setData($request->post()); if ($form->isValid()) { $formData = $form->getData(); $formData['password_salt'] = uniqid(); $formData['password'] = md5($formData['password'] . $formData['password_salt']); $formData['register_date'] = date('Y-m-d H:i:s'); $formData['active'] = 1; $user->populate($formData); $this->getUserTable()->saveUser($user); return $this->redirect()->toRoute('user-front-user', array('action' => 'login')); } else { echo '<pre>'; print_r($form->getMessages()); exit; } } $viewVars = array('form' => $form); $viewModel = $this->getViewModel(); $viewModel->setVariables($viewVars); return $viewModel; }