Exemplo n.º 1
0
def sending_otp(otp, phone):
    otpobj = sendotp.sendotp(
        access_key,
        """ I LOVE YOU {{otp}} TIME, YOUR LOVER KHUSHBOO.KEEP IN TUCH AND TAKE CARE YOUR SELF"""
    )
    res = otpobj.send(phone, 'AnalogIt', otp)
    return res


#Use this OTP for confirmation please donot share with anyone
Exemplo n.º 2
0
 def post(self):
     try:
         some_json = request.get_json()
         user = some_json['country_code'] + some_json['phone_number']
         otpobj = sendotp.sendotp('30349Af2uB99a7996063bc8',
                                  'Your OTP is {{otp}}.')
         l_otp = random.randint(1000, 9999)
         l_key = 'otp_' + user
         status = r.setex(l_key, 150, l_otp)
         otpobj.send(user, 'msgind', l_otp)
         return ({'result': 'OK'}, 200)
     except:
         return ({'error': 'exception'}, 400)
Exemplo n.º 3
0
 def post(self):
   try:
     some_json = request.get_json()
     user = some_json['country_code'] + "_" + some_json['phone_number']
     mob_no = some_json['country_code'] + some_json['phone_number']
     otpobj =  sendotp.sendotp('9353063ad8','Your OTP is {{otp}}.')
     l_otp = random.randint(1000,9999)
     l_key = user + "_OTP"
     r.setex(l_key,150,l_otp)
     otpobj.send(mob_no,'msgind',l_otp)
     return ({'error':'','success': 'OK'}, 200)
   except:
     return ({'error': 'exception','success':''}, 400)
Exemplo n.º 4
0
def send_otp(bryuser_obj, user_id, user_mobile):
    otp = randint(1000, 9999)
    bryuser_obj.update(t_otp=otp)
    otpobj = sendotp.sendotp('OTP_KEY',
                             'Thank you for using our service . Please Use this OTP  {{otp}} , keep otp with you.')
    # print(bryuser_obj)
    user_comp = int(find_user_company(user_id))
    # print(user_comp)
    msg_label = 'APP'
    if user_comp == 100:
        msg_label = 'BRYAPP'
    elif user_comp == 200:
        msg_label = 'DRIAPP'
    elif user_comp == 300:
        msg_label = 'DAIAPP'
    mobile_no_for_otp = int('91' + user_mobile)
    # print(type(a))
    # print(91+int(user_mobile))
    otpobj.send(mobile_no_for_otp, msg_label, otp)
Exemplo n.º 5
0
def send_otp(request, *args, **kwargs):

    if request.method == 'POST':

        current_userid = kwargs['user_id']

        current_user = User.objects.get(id=current_userid)

        contact_no = request.POST.get('contact_no')
        contact_no = str(91) + str(contact_no)
        contact_no = int(contact_no)

        Atkey = config('Atkey')

        Msg = 'Your otp is {{otp}}.'
        otpobj = sendotp.sendotp(Atkey, Msg)
        otp = otpobj.generateOtp()
        otp = int(otp)

        otpobj.send(contact_no, 'ECelll', otp)
        #Don't change the name 'ECelll' in above line

        otps = otpobj.send(contact_no, 'ECelll', otp)
        #Don't change the name 'ECelll' in above line

        contact_no = str(contact_no)

        otps = str(otps)

        profile = Profile.objects.get(user=current_user)
        profile.contact_no = contact_no
        profile.otp = otps
        profile.save()

        return JsonResponse({
            'success': True,
            'msg': 'OTP sent successfully',
        })
    else:
        return render(request, 'phone.html')

    return render(request, 'phone.html')
Exemplo n.º 6
0
def retry_otp(request, *args, **kwargs):
    current_userid = kwargs['user_id']

    current_user = User.objects.get(id=current_userid)

    profile = Profile.objects.get(user=current_user)
    contact_no = profile.contact_no
    contact_no = str(contact_no)
    contact_no = contact_no[0:12]
    contact_no = int(contact_no)

    Atkey = config('Atkey')

    Msg = 'Your otp is {{otp}}.'
    otpobj = sendotp.sendotp(Atkey, Msg)

    otpobj.retry(contact_no, 'ECelll')
    #Don't change the name 'ECelll' in above line

    return JsonResponse({'success': True, 'msg': 'OTP sent through call'})
Exemplo n.º 7
0
#import msg91_sms as msgsms
import math, random
from flask import jsonify
from sendotp import sendotp

#msg = msgsms.Cspd_msg91(apikey='347501AvfXIC34KH5fb76916P1')
otpobj = sendotp.sendotp('347501AvfXIC34KH5fb76916P1',
                         'Your 6 digit OTP is : {{otp}}')


def generateOTP():

    # string = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
    # OTP = ""

    # length = len(string)
    # for i in range(6) :
    #     OTP += string[math.floor(random.random() * length)]

    # return OTP

    digits = "0123456789"
    OTP = ""

    for i in range(6):
        OTP += digits[math.floor(random.random() * 10)]

    return OTP


def sendOTP(Phone_Number):
Exemplo n.º 8
0
from sendotp import sendotp

otpobj = sendotp.sendotp('190375ALnQVrF2Z5a46383e',
                         'my message is {{otp}} keep otp with you.')

# 3245 is the otp to send
#print(otpobj.send(919981534313,'msgind',3245))

#