/** * Create account for new user. * * @param Request $request * @return \Symfony\Component\HttpFoundation\RedirectResponse */ public function registrationAction(Request $request) { $data = $request->request->all(); $data['password'] = md5($data['password']); $user = new User(); $user->load($data['email'], 'email'); if (!$user->getId()) { $user->setData($data); $user->setRoleId('2'); $user->save(); } else { $request->getSession()->set('message', 'User with current email already exists'); return $this->redirectToRoute('lance_newaccount'); } return $this->redirectToRoute('lance_authorization'); }