
    Wf                     R    d dl Z 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 Z
d ZdS )    N)JsonResponse)render)status)Userc                 P   	 t          j        | j                  }t          j                            |d                   }d                    d t          d          D                       }|| j        d<   |j	        | j        d<   t          dt          j        d	d
t          j                  S # t          j        $ r, t          dt          j        d	d
t          j                  cY S t          $ r3}t          dt          j        d	d
t          j                  cY d }~S d }~ww xY w)Nmobile)r    c              3   >   K   | ]}t          j        d           V  dS )
1234567890N)randomchoice).0is     6C:\Users\hp\python\driver_apis\authentication\views.py	<genexpr>zrequestOtp.<locals>.<genexpr>   s,      EEqv}\22EEEEEE       otpuser_idzOTP sent to registered Mobilemessager   Fsafer   zOTP unable to sent.z-Something went wrong. Please try again later.)jsonloadsbodyr   objectsgetjoinrangesessionidr   r   HTTP_200_OKDoesNotExistHTTP_400_BAD_REQUEST	Exception)requestrequest_datauserr   es        r   
requestOtpr+      s   
qz',//|h)?@@ggEEE!HHEEEFF!$%)W	")HSYSeffmr  |B  |N  O  O  O  	O W W W)>Ideelq  {A  {V  W  W  W  	W  	W  	W q q q)Xcic~  GL  U[  Up  q  q  q  	q  	q  	q  	q  	q  	qqs$   B,B/ /8D%)	D%2(D D% D%c                 
   t          j        | j                  }|d         }|| j        d         k    r)t	          dt
          j        ddt
          j                  S t	          dt
          j        ddt
          j                  S )Nr   zOtp Matched successfullyr   Fr   zOtp not Matched)r   r   r   r!   r   r   r#   r%   )r'   r(   r   s      r   	verifyOtpr-      s    :gl++L
u
C
goe$$$(BFL^__fktz  uG  H  H  H  	H(96C^__ejsy  tO  P  P  P  	Pr   )r   r   django.httpr   django.shortcutsr   rest_frameworkr   authentication.modelsr   r+   r-    r   r   <module>r3      s      $ $ $ $ $ $ # # # # # # ! ! ! ! ! ! & & & & & &q q qP P P P Pr   