o
    #.h                     @   sP   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	 G dd deZ
dS )	    )PasswordResetView)EmailMultiAlternatives)render_to_string)
strip_tags)settingsc                   @   s   e Zd ZdZ	dddZdS )CustomPasswordResetViewzFCustom password reset view that ensures HTML emails are sent properly.Nc                 C   s   t ||}d| }t ||}d|vr?d|v r?d|v r?| j r$dnd}	| j }
|	 d|
 d|d  d	|d  d	|d< t||||gd
}t d|}||d |jdd dS )z;Override send_mail to ensure HTML content is properly sent. 	reset_urluidtokenhttpshttpz://z/reset//)subjectbody
from_emailtozemail/password_reset.htmlz	text/htmlF)fail_silentlyN)	r   join
splitlinesrequest	is_secureget_hostr   attach_alternativesend)selfsubject_template_nameemail_template_namecontextr   to_emailhtml_email_template_namer   plain_messageprotocoldomainemailhtml_message r&   //var/www/html/bloggers_ems/events/views/auth.py	send_mail
   s    


(
z!CustomPasswordResetView.send_mail)N)__name__
__module____qualname____doc__r(   r&   r&   r&   r'   r      s    r   N)django.contrib.auth.viewsr   django.core.mailr   django.template.loaderr   django.utils.htmlr   django.confr   r   r&   r&   r&   r'   <module>   s    