/**
  * Handle the command
  *
  * @param $command
  * @throws InvalidOrExpiredResetCode
  * @throws UserNotFoundException
  * @return mixed
  */
 public function handle($command)
 {
     $this->input = $command;
     $user = $this->findUser();
     if (!$this->auth->completeResetPassword($user, $this->input->code, $this->input->password)) {
         throw new InvalidOrExpiredResetCode();
     }
     return $user;
 }
示例#2
0
 /**
  * Finish the reset process
  * @param array $data
  * @return mixed
  * @throws InvalidOrExpiredResetCode
  * @throws UserNotFoundException
  */
 public function finishReset(array $data)
 {
     $user = $this->user->find(array_get($data, 'userId'));
     if ($user === null) {
         throw new UserNotFoundException();
     }
     $code = array_get($data, 'code');
     $password = array_get($data, 'password');
     if (!$this->auth->completeResetPassword($user, $code, $password)) {
         throw new InvalidOrExpiredResetCode();
     }
     return $user;
 }