o
    ק-gk                     @   sH   d dl mZ d dlmZ d dlmZ d dlmZ d dlm	Z	 dd Z
dS )	    )PasswordResetTokenGenerator)urlsafe_base64_encode)force_bytes)User)ValidationErrorc                 C   sn   t jj| d r3t jj| d}tt|j}t 	|}d| d| }d| }d||j
d}dS td)	z
    Service function to handle sending a password reset email.
    :param email: The email address of the user requesting a password reset
    :return: None
    :raises ValidationError: If the user does not exist
    )emailz$http://127.0.0.1:8000/account/reset//z1Click the following link to reset your password: zReset Your Password)subjectbodyto_emailNzYou are not a Registered User)r   objectsfilterexistsgetr   r   idr   
make_tokenr   r   )r   useruidtokenlinkr
   data r   </var/www/html/django-vendor/services/password_reset_email.pysend_password_reset_email   s   
r   N)django.contrib.auth.tokensr   django.utils.httpr   django.utils.encodingr   account.modelsr   utils.exceptionr   r   r   r   r   r   <module>   s   