public function renew($email, $token, ResetPasswordRequest $resetPasswordRequest, UserRepositoryInterface $userRepository, TokenRepositoryInterface $tokenRepository) { $input = $resetPasswordRequest->all(); $user = $userRepository->findByEmail($email); if (!$user) { return $this->sendUnauthorized('Email not found.'); } if (!$tokenRepository->exists($user, $token)) { return $this->sendUnauthorized('Invalid token.'); } $user = $userRepository->changePassword($user, $input['password']); $tokenRepository->delete($token); return $this->sendSuccess([], 'Successfully reset your password. Now try logging in.'); }