class PasswordRecoveryServiceImpl implements PasswordRecoveryService {

    @Transactional
    @Override
    public void updatePasswordUsingToken(String token, String newPassword) {
        RestorePasswordEmail restorePasswordEmail = restorePasswordEmailRepo
            .findByToken(token)
            .orElseThrow(() -> new BadVerifyEmailTokenException(NO_ANY_EMAIL_TO_VERIFY_BY_THIS_TOKEN));
        if (isNotExpired(restorePasswordEmail.getExpiryDate())) {
            applicationEventPublisher.publishEvent(
                new UpdatePasswordEvent(this, newPassword, restorePasswordEmail.getUser().getId())
            );
            restorePasswordEmailRepo.delete(restorePasswordEmail);
            log.info("User with email " + restorePasswordEmail.getUser().getEmail()
                + " has successfully restored the password using token " + token);
        } else {
            log.info("Password restoration token of user with email " + restorePasswordEmail.getUser().getEmail()
                + " has been expired. Token: " + token);
            throw new UserActivationEmailTokenExpiredException(EMAIL_TOKEN_EXPIRED);
        }
    }

    public  PasswordRecoveryServiceImpl(
        RestorePasswordEmailRepo restorePasswordEmailRepo,
        UserRepo userRepo,
        ApplicationEventPublisher applicationEventPublisher,
        RabbitTemplate rabbitTemplate,
        JwtTool jwtTool
    );

}