Subversion Repositories SmartDukaan

Rev

Rev 33869 | Rev 33879 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 33869 Rev 33871
Line 471... Line 471...
471
        window.print();
471
        window.print();
472
        document.body.innerHTML = originalContents;
472
        document.body.innerHTML = originalContents;
473
    }
473
    }
474
 
474
 
475
    function validateOTP() {
475
    function validateOTP() {
476
 
-
 
-
 
476
        while (true) {
477
        let otp = prompt("Enter received OTP here");
477
            let otp = prompt("Enter received OTP here");
478
        if (otp != null) {
478
            if (otp === null) {
-
 
479
                alert('OTP entry was cancelled. Try again.');
-
 
480
                return null;
-
 
481
            }
479
            let regex = new RegExp(/^[0-9]{5}$/);
482
            let regex = /^[0-9]{5}$/;
480
            if (otp != null && regex.test(otp)) {
483
            if (regex.test(otp)) {
481
                console.log('otp-flag-', otp);
484
                console.log('otp-flag-', otp);
482
                return otp;
485
                return otp;  // Return valid OTP
483
            } else {
486
            } else {
484
                alert('Please enter a valid 5-digit numeric OTP');
487
                alert('Please enter a valid 5-digit numeric OTP');
485
                return validateOTP();
-
 
486
            }
488
            }
487
        } else {
-
 
488
            alert('Enter received OTP and Try again')
-
 
489
        }
489
        }
490
 
-
 
491
    }
490
    }
492
 
491
 
493
    $(document).one('click', "#confirmSign", function () {
492
    $(document).on('click', "#confirmSign", function () {
494
        let loiId = $(this).val();
493
        let loiId = $(this).val();
495
        let otp = validateOTP();
494
        let otp = validateOTP();
496
        console.log("loiId-", loiId, ",otp-", otp);
495
        console.log("loiId-", loiId, ",otp-", otp);
497
        let validateOtpUrl = `${context}/validateLoiOtp?loiId=${loiId}&provideOtp=${otp}`;
496
        let validateOtpUrl = `${context}/validateLoiOtp?loiId=${loiId}&provideOtp=${otp}`;
498
        if (otp != undefined) {
497
        if (otp != undefined) {