/** * Handle the command. * * @param UserRepositoryInterface $users * @return bool */ public function handle(UserRepositoryInterface $users) { $user = $users->findByResetCode($this->code); if (!$user) { return false; } if ($user->getId() !== $this->user->getId()) { return false; } $this->user->setResetCode(null); $this->user->setPassword($this->password); $users->save($this->user); return true; }