예제 #1
0
 private function doLogin()
 {
     $user = null;
     try {
         $userRepository = new UserRepository($this->storage);
         $user = $userRepository->getByEmail($this->request->get('email'));
     } catch (RecordNotExists $e) {
         return $this->returnErrorMessages(['field' => 'email', 'message' => 'Email address is not exists']);
     }
     if (password_verify($this->request->get('password'), $user->getPassword())) {
         return $this->returnErrorMessages(['field' => 'password', 'message' => 'Password is wrong']);
     }
     $this->setCurrentUser($user);
     return $this->app->redirect('/groups/index');
 }