Exemple #1
0
def resend_code(request):
    employee = get_object_or_404(Employee, pk=request.session["employee"])
    if employee:
        s_code = employee.totpdevice_set.last().generate_token()
        if s_code.verified:
            s_code = TOTPDevice.objects.create(user=employee).generate_token()
        send_sms("+2330201415087", s_code)
        data = {"message": "Verification sent!"}
    else:
        data = {"message": "Invalid Employee!"}
    return Response(data=data)
Exemple #2
0
def run_transaction(request):
    if request.method == "POST":
        employee_num = request.POST.get("employee_no")
        wk = get_object_or_404(WorkDetail, employee_no=employee_num)
        if wk.employee:
            totp = TOTPDevice.objects.create(user=wk.employee)
            send_sms("+2330201415087", totp.generate_token())
            data = {"message": "Verification sent!"}
        else:
            data = {"message": "Invalid Employee!"}
        return Response(data=data)
Exemple #3
0
 def send_otp(self):
     msg = 'Your one time password for ILP is %s. Please enter this on our web page or mobile app to verify your mobile number.' % self.sms_verification_pin
     send_sms(self.mobile_no, msg)