U
    .þcˆ'  ã                   @   sò   d dl Z d dlmZ d dlmZ d dlmZ d dlmZ d dl	Z	d dlmZ d dlm
Z
 eƒ ZG dd„ de jƒZG d	d
„ d
e jƒZG dd„ de jƒZG dd„ de jƒZG dd„ de jƒZG dd„ de jƒZG dd„ de jƒZG dd„ de jƒZdS )é    N)Úget_user_model)Úsettings)Úrender_to_string)Ú	send_mail)ÚEmailMessagec                       s*   e Zd Zdd„ Zddœ‡ fdd„Z‡  ZS )ÚRegisterMailToUserThreadc                 C   s   || _ tj | ¡ d S ©N©Úrecord_dataÚ	threadingÚThreadÚ__init__©Úselfr
   © r   úV/var/www/html/staging.mfahmagazine.net/magazine_api/magazine_web_admin/base/threads.pyr      s    z!RegisterMailToUserThread.__init__N©Úreturnc           	         sj   t dƒ | jd }| jd }| jd }d}d}tj}|}td|||dœƒ}t||||d	g|d
� tƒ  ¡ S )Nz,>>>>>>>>>>>>>>>>>>>>>>>>>>.. thread registerÚnameÚusernameÚcurrent_otpÚMagazineúMFAH Magazine OTPzbase/register.html©r   Úotpr   úashishk140@triazinesoft.com©Úhtml_message©Úprintr
   r   ÚEMAIL_HOST_USERr   r   ÚsuperÚrun©	r   r   r   r   Ú	msg_plainÚsubjectÚ
from_emailÚemail_toÚmsg_html©Ú	__class__r   r   r"      s    


zRegisterMailToUserThread.run©Ú__name__Ú
__module__Ú__qualname__r   r"   Ú__classcell__r   r   r)   r   r      s   r   c                       s*   e Zd Zdd„ Zddœ‡ fdd„Z‡  ZS )ÚResendOTPMailToUserThreadc                 C   s   || _ tj | ¡ d S r   r	   r   r   r   r   r       s    z"ResendOTPMailToUserThread.__init__Nr   c           	         sl   t dƒ | jd }| jd }| jd }d}d}tj}|}td|||dœƒ}t||||d	g|d
d� tƒ  ¡ S )Nz->>>>>>>>>>>>>>>>>>>>>>>>>>.. thread ResendOTPr   r   r   r   r   zbase/resendotp.htmlr   r   F)r   Úfail_silentlyr   r#   r)   r   r   r"   $   s    


zResendOTPMailToUserThread.runr+   r   r   r)   r   r0      s   r0   c                       s*   e Zd Zdd„ Zddœ‡ fdd„Z‡  ZS )ÚLoginMailToUserThreadc                 C   s   || _ tj | ¡ d S r   r	   r   r   r   r   r   g   s    zLoginMailToUserThread.__init__Nr   c           	         sj   t dƒ | jd }| jd }| jd }d}d}tj}|}td|||dœƒ}t||||d	g|d
� tƒ  ¡ S )Nz->>>>>>>>>>>>>>>>>>>>>>>>>>.. thread LoginMailr   r   r   r   r   zbase/login.htmlr   r   r   r   r#   r)   r   r   r"   k   s    


zLoginMailToUserThread.runr+   r   r   r)   r   r2   f   s   r2   c                       s*   e Zd Zdd„ Zddœ‡ fdd„Z‡  ZS )ÚContactMailToUserThreadc                 C   s   || _ tj | ¡ d S r   r	   r   r   r   r   r   ~   s    z ContactMailToUserThread.__init__Nr   c           	         sj   t dƒ | jd }| jd }| jd }d}d}tj}|}td|||dœƒ}t||||d	g|d
� tƒ  ¡ S )Nz+>>>>>>>>>>>>>>>>>>>>>>>>>>.. thread Contactr   r   Úmessager   zMagazine Reader Projectúbase/contact.html©r   r   r4   r   r   r   ©	r   r   r   r4   r$   r%   r&   r'   r(   r)   r   r   r"   ‚   s    


zContactMailToUserThread.runr+   r   r   r)   r   r3   }   s   r3   c                       s*   e Zd Zdd„ Zddœ‡ fdd„Z‡  ZS )ÚBuyMailToUserThreadc                 C   s   || _ tj | ¡ d S r   r	   r   r   r   r   r   “   s    zBuyMailToUserThread.__init__Nr   c           
         sx   t dƒ | jd }| jd }| jd }| jd }d}d}tj}|}td|||d	œƒ}	t||||d
|dg|	d� tƒ  ¡ S )Nú,>>>>>>>>>>>>>>>>>>>>>>>>>>.. thread purchaser   r   Ú	publisherr4   r   úYour Transaction is successr5   r6   r   úajay158@triazinesoft.comr   r   ©
r   r   r   r:   r4   r$   r%   r&   r'   r(   r)   r   r   r"   —   s    



zBuyMailToUserThread.runr+   r   r   r)   r   r8   ’   s   r8   c                       s*   e Zd Zdd„ Zddœ‡ fdd„Z‡  ZS )ÚFailMailToUserThreadc                 C   s   || _ tj | ¡ d S r   r	   r   r   r   r   r   ¨   s    zFailMailToUserThread.__init__Nr   c           
         sx   t dƒ | jd }| jd }| jd }| jd }d}d}tj}|}td|||d	œƒ}	t||||d
|dg|	d� tƒ  ¡ S )Nr9   r   r   r:   r4   r   úYour Transaction is failúbase/fail.htmlr6   r   r<   r   r   r=   r)   r   r   r"   ¬   s    



zFailMailToUserThread.runr+   r   r   r)   r   r>   §   s   r>   c                       s*   e Zd Zdd„ Zddœ‡ fdd„Z‡  ZS )ÚSubcriptionMailToUserThreadc                 C   s   || _ tj | ¡ d S r   r	   r   r   r   r   r   ¾   s    z$SubcriptionMailToUserThread.__init__Nr   c           	         sl   t dƒ | jd }| jd }| jd }d}d}tj}|}td|||dœƒ}t||||d	d
g|d� tƒ  ¡ S )Nr9   r   r   r4   r   r;   r5   r6   r   r<   r   r   r7   r)   r   r   r"   Â   s    


zSubcriptionMailToUserThread.runr+   r   r   r)   r   rA   ½   s   rA   c                       s*   e Zd Zdd„ Zddœ‡ fdd„Z‡  ZS )ÚFailSubcriptionMailToUserThreadc                 C   s   || _ tj | ¡ d S r   r	   r   r   r   r   r   Ò   s    z(FailSubcriptionMailToUserThread.__init__Nr   c           	         sl   t dƒ | jd }| jd }| jd }d}d}tj}|}td|||dœƒ}t||||d	d
g|d� tƒ  ¡ S )Nr9   r   r   r4   r   r?   r@   r6   r   r<   r   r   r7   r)   r   r   r"   Ö   s    


z#FailSubcriptionMailToUserThread.runr+   r   r   r)   r   rB   Ñ   s   rB   )r   Údjango.contrib.authr   Údjango.confr   Údjango.template.loaderr   Údjango.core.mailr   Údatetimer   ÚUserr   r   r0   r2   r3   r8   r>   rA   rB   r   r   r   r   Ú<module>   s    G