public function postSignUp($request, $response) { $validation = $this->validator->validate($request, ['email' => v::noWhitespace()->notEmpty()->email()->emailAvailable(), 'name' => v::noWhitespace()->notEmpty()->alpha(), 'password' => v::noWhitespace()->notEmpty()]); if ($validation->failed()) { return $response->withRedirect($this->router->pathFor('auth.signup')); } $user = User::create(['email' => $request->getParam('email'), 'name' => $request->getParam('name'), 'password' => password_hash($request->getParam('password'), PASSWORD_DEFAULT)]); $this->flash->addMessage('info', 'You have been signed up'); $this->auth->attempt($user->email, $request->getParam('password')); return $response->withRedirect($this->router->pathFor('home')); }