Git Product home page Git Product logo

Comments (2)

mkb79 avatar mkb79 commented on August 12, 2024

Thank you for open this issue.

With an approval alert detection, an email from Amazon should actually be sent, which you only have to confirm. The fact that a kind of OTP is sent should not actually happen. If I could somehow get the source code of the HTML page where the approval detection appears, it would be helpful.

from audible.

Humni avatar Humni commented on August 12, 2024

I'm also running into this issue. I got the HTML for the page below.

I fixed the login script with this modification #128

OTP Page HTML
<!doctype html>
<html class="a-no-js a-touch a-mobile" data-19ax5a9jf="mongoose">
<head>
    <script>var aPageStart = (new Date()).getTime();</script>
    <meta name="viewport"
          content="width=device-width, maximum-scale=1, minimum-scale=1, initial-scale=1, user-scalable=no, shrink-to-fit=no"/>
    <meta charset="utf-8"/>
    <meta name="robots" content="noindex, nofollow">

    <title dir="ltr"> Amazon
    </title>
    <link rel="stylesheet"
          href="https://images-fe.ssl-images-amazon.com/images/I/31uzTIbgV0L.css?AUIClients/ChimeraWebsiteAssets#mobile"/>
    <link rel="stylesheet"
          href="https://images-fe.ssl-images-amazon.com/images/I/71nDxy-1QCL.css?AUIClients/AudibleiOSMobileWhiteAuthSkin#mobile.not-trident"/>
    <script>
(function(f,h,Q,E){function F(a){u&&u.tag&&u.tag(q(":","aui",a))}function v(a,b){u&&u.count&&u.count("aui:"+a,0===b?0:b||(u.count("aui:"+a)||0)+1)}function m(a){try{return a.test(navigator.userAgent)}catch(b){return!1}}function x(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent&&a.attachEvent("on"+b,c)}function q(a,b,c,e){b=b&&c?b+a+c:b||c;return e?q(a,b,e):b}function G(a,b,c){try{Object.defineProperty(a,b,{value:c,writable:!1})}catch(e){a[b]=c}return c}function ua(a,b,c){var e=
c=a.length,g=function(){e--||(R.push(b),S||(setTimeout(ca,0),S=!0))};for(g();c--;)da[a[c]]?g():(z[a[c]]=z[a[c]]||[]).push(g)}function va(a,b,c,e,g){var d=h.createElement(a?"script":"link");x(d,"error",e);g&&x(d,"load",g);a?(d.type="text/javascript",d.async=!0,c&&/AUIClients|images[/]I/.test(b)&&d.setAttribute("crossorigin","anonymous"),d.src=b):(d.rel="stylesheet",d.href=b);h.getElementsByTagName("head")[0].appendChild(d)}function ea(a,b){return function(c,e){function g(){va(b,c,d,function(b){T?v("resource_unload"):
d?(d=!1,v("resource_retry"),g()):(v("resource_error"),a.log("Asset failed to load: "+c));b&&b.stopPropagation?b.stopPropagation():f.event&&(f.event.cancelBubble=!0)},e)}if(fa[c])return!1;fa[c]=!0;v("resource_count");var d=!0;return!g()}}function wa(a,b,c){for(var e={name:a,guard:function(c){return b.guardFatal(a,c)},guardTime:function(a){return b.guardTime(a)},logError:function(c,d,e){b.logError(c,d,e,a)}},g=[],d=0;d<c.length;d++)H.hasOwnProperty(c[d])&&(g[d]=U.hasOwnProperty(c[d])?U[c[d]](H[c[d]],
e):H[c[d]]);return g}function A(a,b,c,e,g){return function(d,h){function n(){var a=null;e?a=h:"function"===typeof h&&(p.start=w(),a=h.apply(f,wa(d,k,l)),p.end=w());if(b){H[d]=a;a=d;for(da[a]=!0;(z[a]||[]).length;)z[a].shift()();delete z[a]}p.done=!0}var k=g||this;"function"===typeof d&&(h=d,d=E);b&&(d=d?d.replace(ha,""):"__NONAME__",V.hasOwnProperty(d)&&k.error(q(", reregistered by ",q(" by ",d+" already registered",V[d]),k.attribution),d),V[d]=k.attribution);for(var l=[],m=0;m<a.length;m++)l[m]=
a[m].replace(ha,"");var p=B[d||"anon"+ ++xa]={depend:l,registered:w(),namespace:k.namespace};d&&ya.hasOwnProperty(d);c?n():ua(l,k.guardFatal(d,n),d);return{decorate:function(a){U[d]=k.guardFatal(d,a)}}}}function ia(a){return function(){var b=Array.prototype.slice.call(arguments);return{execute:A(b,!1,a,!1,this),register:A(b,!0,a,!1,this)}}}function W(a,b){return function(c,e){e||(e=c,c=E);var g=this.attribution;return function(){t.push(b||{attribution:g,name:c,logLevel:a});var d=e.apply(this,arguments);
t.pop();return d}}}function I(a,b){this.load={js:ea(this,!0),css:ea(this)};G(this,"namespace",b);G(this,"attribution",a)}function ja(){h.body?r.trigger("a-bodyBegin"):setTimeout(ja,20)}function C(a,b){a.className=X(a,b)+" "+b}function X(a,b){return(" "+a.className+" ").split(" "+b+" ").join(" ").replace(/^ | $/g,"")}function ka(a){try{return a()}catch(b){return!1}}function J(){if(K){var a={w:f.innerWidth||n.clientWidth,h:f.innerHeight||n.clientHeight};5<Math.abs(a.w-Y.w)||50<a.h-Y.h?(Y=a,L=4,(a=k.mobile||
k.tablet?450<a.w&&a.w>a.h:1250<=a.w)?C(n,"a-ws"):n.className=X(n,"a-ws")):0<L&&(L--,la=setTimeout(J,16))}}function za(a){(K=a===E?!K:!!a)&&J()}function Aa(){return K}function ma(){D.forEach(function(a){F(a)})}function na(a,b,c){if(b){a=m(/Chrome/i)&&!m(/Edge/i)&&!m(/OPR/i)&&!a.capabilities.isAmazonApp&&!m(new RegExp(Z+"bwv"+Z+"b"));var e="sw:browser:"+c+":";b.browser&&a&&(D.push(e+"supported"),b.browser.action(e,c));!a&&b.browser&&D.push(e+"unsupported")}}"use strict";var M=Q.now=Q.now||function(){return+new Q},
w=function(a){return a&&a.now?a.now.bind(a):M}(f.performance),N=w(),ya={},p=f.AmazonUIPageJS||f.P;if(p&&p.when&&p.register){N=[];for(var l=h.currentScript;l;l=l.parentElement)l.id&&N.push(l.id);return p.log("A copy of P has already been loaded on this page.","FATAL",N.join(" "))}var u=f.ue;F();F("aui_build_date:3.21.9-2023-06-21");var R=[],Ba=[],S=!1;var ca=function(){for(var a=setTimeout(ca,0),b=M();Ba.length||R.length;)if(R.shift()(),50<M()-b)return;clearTimeout(a);S=!1};var da={},z={},fa={},T=
!1;x(f,"beforeunload",function(){T=!0;setTimeout(function(){T=!1},1E4)});var ha=/^prv:/,V={},H={},U={},B={},xa=0,Z=String.fromCharCode(92),t=[],oa=!0,pa=f.onerror;f.onerror=function(a,b,c,e,g){g&&"object"===typeof g||(g=Error(a,b,c),g.columnNumber=e,g.stack=b||c||e?q(Z,g.message,"at "+q(":",b,c,e)):E);var d=t.pop()||{};g.attribution=q(":",g.attribution||d.attribution,d.name);g.logLevel=d.logLevel;g.attribution&&console&&console.log&&console.log([g.logLevel||"ERROR",a,"thrown by",g.attribution].join(" "));
t=[];pa&&(d=[].slice.call(arguments),d[4]=g,pa.apply(f,d))};I.prototype={logError:function(a,b,c,e){b={message:b,logLevel:c||"ERROR",attribution:q(":",this.attribution,e)};if(f.ueLogError)return f.ueLogError(a||b,a?b:null),!0;console&&console.error&&(console.log(b),console.error(a));return!1},error:function(a,b,c,e){a=Error(q(":",e,a,c));a.attribution=q(":",this.attribution,b);throw a;},guardError:W(),guardFatal:W("FATAL"),guardCurrent:function(a){var b=t[t.length-1];return b?W(b.logLevel,b).call(this,
a):a},guardTime:function(a){var b=t[t.length-1],c=b&&b.name;return c&&c in B?function(){var b=w(),g=a.apply(this,arguments);B[c].async=(B[c].async||0)+w()-b;return g}:a},log:function(a,b,c){return this.logError(null,a,b,c)},declare:A([],!0,!0,!0),register:A([],!0),execute:A([]),AUI_BUILD_DATE:"3.21.9-2023-06-21",when:ia(),now:ia(!0),trigger:function(a,b,c){var e=M();this.declare(a,{data:b,pageElapsedTime:e-(f.aPageStart||NaN),triggerTime:e});c&&c.instrument&&O.when("prv:a-logTrigger").execute(function(b){b(a)})},
handleTriggers:function(){this.log("handleTriggers deprecated")},attributeErrors:function(a){return new I(a)},_namespace:function(a,b){return new I(a,b)},setPriority:function(a){oa?oa=!1:this.log("setPriority only accept the first call.")}};var r=G(f,"AmazonUIPageJS",new I);var O=r._namespace("PageJS","AmazonUI");O.declare("prv:p-debug",B);r.declare("p-recorder-events",[]);r.declare("p-recorder-stop",function(){});G(f,"P",r);ja();if(h.addEventListener){var qa;h.addEventListener("DOMContentLoaded",
qa=function(){r.trigger("a-domready");h.removeEventListener("DOMContentLoaded",qa,!1)},!1)}var n=h.documentElement,aa=function(){var a=["O","ms","Moz","Webkit"],b=h.createElement("div");return{testGradients:function(){return!0},test:function(c){var e=c.charAt(0).toUpperCase()+c.substr(1);c=(a.join(e+" ")+e+" "+c).split(" ");for(e=c.length;e--;)if(""===b.style[c[e]])return!0;return!1},testTransform3d:function(){return!0}}}();p=n.className;var ra=/(^| )a-mobile( |$)/.test(p),sa=/(^| )a-tablet( |$)/.test(p),
k={audio:function(){return!!h.createElement("audio").canPlayType},video:function(){return!!h.createElement("video").canPlayType},canvas:function(){return!!h.createElement("canvas").getContext},svg:function(){return!!h.createElementNS&&!!h.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect},offline:function(){return navigator.hasOwnProperty&&navigator.hasOwnProperty("onLine")&&navigator.onLine},dragDrop:function(){return"draggable"in h.createElement("span")},geolocation:function(){return!!navigator.geolocation},
history:function(){return!(!f.history||!f.history.pushState)},webworker:function(){return!!f.Worker},autofocus:function(){return"autofocus"in h.createElement("input")},inputPlaceholder:function(){return"placeholder"in h.createElement("input")},textareaPlaceholder:function(){return"placeholder"in h.createElement("textarea")},localStorage:function(){return"localStorage"in f&&null!==f.localStorage},orientation:function(){return"orientation"in f},touch:function(){return"ontouchend"in h},gradients:function(){return aa.testGradients()},
hires:function(){var a=f.devicePixelRatio&&1.5<=f.devicePixelRatio||f.matchMedia&&f.matchMedia("(min-resolution:144dpi)").matches;v("hiRes"+(ra?"Mobile":sa?"Tablet":"Desktop"),a?1:0);return a},transform3d:function(){return aa.testTransform3d()},touchScrolling:function(){return m(/Windowshop|android|OS ([5-9]|[1-9][0-9]+)(_[0-9]{1,2})+ like Mac OS X|SOFTWARE=([5-9]|[1-9][0-9]+)(.[0-9]{1,2})+.*DEVICE=iPhone|Chrome|Silk|Firefox|Trident.+?; Touch/i)},ios:function(){return m(/OS [1-9][0-9]*(_[0-9]*)+ like Mac OS X/i)&&
!m(/trident|Edge/i)},android:function(){return m(/android.([1-9]|[L-Z])/i)&&!m(/trident|Edge/i)},mobile:function(){return ra},tablet:function(){return sa},rtl:function(){return"rtl"===n.dir}};for(l in k)k.hasOwnProperty(l)&&(k[l]=ka(k[l]));for(var ba="textShadow textStroke boxShadow borderRadius borderImage opacity transform transition".split(" "),P=0;P<ba.length;P++)k[ba[P]]=ka(function(){return aa.test(ba[P])});var K=!0,la=0,Y={w:0,h:0},L=4;J();x(f,"resize",function(){clearTimeout(la);L=4;J()});
var ta={getItem:function(a){try{return f.localStorage.getItem(a)}catch(b){}},setItem:function(a,b){try{return f.localStorage.setItem(a,b)}catch(c){}}};n.className=X(n,"a-no-js");C(n,"a-js");!m(/OS [1-8](_[0-9]*)+ like Mac OS X/i)||f.navigator.standalone||m(/safari/i)||C(n,"a-ember");p=[];for(l in k)k.hasOwnProperty(l)&&k[l]&&p.push("a-"+l.replace(/([A-Z])/g,function(a){return"-"+a.toLowerCase()}));C(n,p.join(" "));n.setAttribute("data-aui-build-date","3.21.9-2023-06-21");r.register("p-detect",function(){return{capabilities:k,
localStorage:k.localStorage&&ta,toggleResponsiveGrid:za,responsiveGridEnabled:Aa}});m(/UCBrowser/i)||k.localStorage&&C(n,ta.getItem("a-font-class"));r.declare("a-event-revised-handling",!1);try{var y=navigator.serviceWorker}catch(a){F("sw:nav_err")}y&&(x(y,"message",function(a){a&&a.data&&v(a.data.k,a.data.v)}),y.controller&&y.controller.postMessage("MSG-RDY"));var D=[];(function(a){var b=a.reg,c=a.unreg;y&&y.getRegistrations?(O.when("A").execute(function(a){na(a,c,"unregister")}),x(f,"load",function(){O.when("A").execute(function(a){na(a,
b,"register");ma()})})):(b&&b.browser&&D.push("sw:browser:register:unsupported"),c&&c.browser&&D.push("sw:browser:unregister:unsupported"),ma())})({reg:{},unreg:{}});r.declare("a-fix-event-off",!1);v("pagejs:pkgExecTime",w()-N)})(window,document,Date);
  (window.AmazonUIPageJS ? AmazonUIPageJS : P).load.js('https://images-fe.ssl-images-amazon.com/images/I/614wuO7B5nL.js?AUIClients/ChimeraWebsiteAssets');
  (window.AmazonUIPageJS ? AmazonUIPageJS : P).load.js('https://images-fe.ssl-images-amazon.com/images/I/6110-nY5BNL.js?AUIClients/MAPWebAssets');
  (window.AmazonUIPageJS ? AmazonUIPageJS : P).load.js('https://images-fe.ssl-images-amazon.com/images/I/61XKxrBtDVL._RC|11Y+5x+kkTL.js,01qkmZhGmAL.js,71E1l4yME+L.js_.js?AUIClients/AudibleiOSMobileWhiteAuthSkin#mobile');

    </script>

    <style>
      .chimera-body-container {
        width: 25.7em !important;
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
      }

    </style>
</head>
<body class="a-color-offset-background auth-audbileios a-aui_72554-c a-aui_accordion_a11y_role_354025-t1 a-aui_killswitch_csa_logger_372963-c a-aui_launch_2021_ally_fixes_392482-c a-aui_pci_risk_banner_210084-c a-aui_preload_261698-c a-aui_rel_noreferrer_noopener_309527-c a-aui_template_weblab_cache_333406-c a-aui_tnr_v2_180836-c">
<div id="a-page">
    <script type="a-state" data-a-state="{&quot;key&quot;:&quot;a-wlab-states&quot;}">
        {"AUI_ACCORDION_A11Y_ROLE_354025":"T1"}
    </script>
    <div id="header" class="a-section a-spacing-none">

        <div class="a-container a-global-nav-wrapper">


            <div class="a-section a-spacing-none a-text-center">


                <img src="https://m.media-amazon.com/images/G/01/Audible/images/authPortal/audible_logo_aui._CB485925042_.svg"/>


            </div>

        </div>
    </div>
    <div id="body" class="a-section a-padding-base">
        <div class="a-section chimera-body-container">


            <noscript>
                <div class="a-box a-alert a-alert-warning" aria-live="polite" aria-atomic="true">
                    <div class="a-box-inner a-alert-container"><h4 class="a-alert-heading">JavaScript Is Disabled</h4>
                        <div class="a-alert-content">This site requires JavaScript to function correctly. Please enable
                            JavaScript on your browser to continue.
                        </div>
                    </div>
                </div>
            </noscript>
            <script>
    'use strict';

    P.when('A', 'ready').execute(function(A) {
        var $ = A.$;
        var lastTransactionStatus = '';
        var verifyOtpException = '';
        var otpStatusOnPageLoad = 'Unverified';
        var formIdSelector = "#verification-code-form";
        var pollingHandler;

        if(otpStatusOnPageLoad == "Expired") {
            disableOtpForm();
        }

        if(verifyOtpException == "AuthenticationException") {
            disableOtpForm();
            $('#approvalPollAlerts').hide();
            $('#resend-approval-alert').hide();
            $('#resend-approval-link').addClass("transaction-approval-link-disabled");
        }

        // Do polling based on the frequency interval value set with in the app configuration.
        $('#pollingForm').ready(function() {
            setPollingIntervalTimeout();
        });

        $(formIdSelector).submit(function () {
            clearTimeout(pollingHandler);
        });

        function polling() {
            A.ajax($('#pollingForm').attr('action'), {
                method: 'GET',
                params: $('#pollingForm').serializeArray(),
                success: handlePollingResponse,
                error: handlePollingError
            });
        }

        function setPollingIntervalTimeout() {
            const interval = 5000;
            pollingHandler = setTimeout(polling, interval);
        }

        function handlePollingResponse(response) {
            $('#channelDetailsWithImprovedLayout').html($(response).find('#updatedChannelDetailsWithImprovedLayout').html());
            $('#approvalPollAlerts').html($(response).find('#updatedApprovalPollAlerts').html());
            var transactionApprovalStatus = $(response).find("input[name='transactionApprovalStatus']").val();
            var otpStatus = $(response).find("input[name='otpStatus']").val();
            var disableRedirect = $('#pollingForm').find("input[name='disableRedirect']").val();

            switch (transactionApprovalStatus) {
                case 'TransactionPending':
                case 'TransactionPendingInline':
                    setPollingIntervalTimeout();
                    lastTransactionStatus = transactionApprovalStatus;
                    break;

                case 'TransactionResponded':
                    if(lastTransactionStatus == 'TransactionPending') {
                        window.location.reload();
                    }
                    $('#resend-transaction-approval').hide();
                    setPollingIntervalTimeout();
                    lastTransactionStatus = transactionApprovalStatus;
                    break;

                case 'TransactionExpired':
                    $('#resend-transaction-approval').hide();
                    setPollingIntervalTimeout();
                    lastTransactionStatus = transactionApprovalStatus;
                    break;

                case 'TransactionCompleted':
                case 'TransactionCompletionTimeout':
                    if (disableRedirect === 'true') return;
                    window.location.replace(decodeURIComponent(getQueryParameters(window.location.href)['openid.return_to']));
                    break;

                default:
                    window.location.reload();
            }

            if(otpStatus == "Expired") {
                disableOtpForm();
            }
        }

        function disableOtpForm() {
            const isSingleInputBoxOTPExperienceEnabled = true;

            //DISABLE otp boxes and verify button and remove any verify otp alerts
            if (isSingleInputBoxOTPExperienceEnabled) {
                $(".single-input-box-otp").attr("disabled", "disabled");
                $(".single-input-box-otp").addClass("a-form-disabled");
            } else {
                $(".otp-input-box").attr("disabled", "disabled");
                $(".otp-input-box").addClass("a-form-disabled");
            }

            $("#cvf-submit-otp-button").find("input").attr("disabled", "disabled");
            $("#cvf-submit-otp-button").addClass("a-button-disabled");
            $("#verifyAlerts").hide();
        }

        function getQueryParameters(url) {
            var paramPairs = {};
            var parameters = url.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m, key, value) {
                paramPairs[key] = value;
            });

            return paramPairs;
        }

        function handlePollingError() {
            window.location.reload();
        }
    });


            </script>

            <div class="a-section a-spacing-medium"><span
                    class="a-size-base-plus transaction-approval-word-break a-text-bold">Enter verification code</span>
            </div>
            <div id="channelDetailsForOtp" class="a-section">

                <div class="a-section a-spacing-medium"><span class="a-size-base transaction-approval-word-break">For your security, we've sent the code to your phone ***-***-**31.</span>
                </div>
            </div>
            <div class="a-row a-spacing-none">
                <form id="verification-code-form" method="post" action="/ap/cvf/approval/verifyOtp"
                      class="cvf-widget-form fwcim-form a-spacing-none">
                    <div class="a-row a-spacing-none">
                        <div id="otp_submit_form" class="a-section">
                            <div id="cvf-input-code"
                                 class="a-section cvf-widget-input cvf-widget-input-code cvf-widget-section-js"><span
                                    class="a-declarative" data-action="single-input-box-otp-handler"
                                    data-csa-c-type="widget" data-csa-c-func-deps="aui-da-single-input-box-otp-handler"
                                    data-single-input-box-otp-handler="{}">            <div
                                    class="single-input-box-otp-container" data-isembded=false>
<div class="a-input-text-wrapper cvf-widget-input cvf-widget-input-code single-input-box-otp"><input type="tel"
                                                                                                     maxlength="6"
                                                                                                     required
                                                                                                     id="input-box-otp"
                                                                                                     autocomplete="off"
                                                                                                     spellcheck="false"
                                                                                                     autocorrect="off"
                                                                                                     autocapitalize="off"/></div>            </div>
</span><span id="otp-input-spinner" class="a-spinner a-spinner-medium otp-input-code-spinner aok-hidden"></span><input
                                    type="hidden" name="otpCode" id="otpCode"
                                    class="cvf-widget-input cvf-widget-input-code"/><span
                                    class="a-button a-button-primary cvf-widget-btn cvf-widget-btn-verify aok-hidden"><span
                                    class="a-button-inner"><input class="a-button-input" type="submit"/><span
                                    class="a-button-text" aria-hidden="true"></span></span></span></div>
                            <style>

    .single-input-box-otp {
        box-sizing: border-box;
        background: #FFFFFF;
        border: 1px solid #979A9A;
        box-shadow: inset 0px 2px 4px rgba(0, 0, 0, 0.25);
        border-radius: 5px;
        font-family: 'Amazon Ember';
        font-style: normal;
        font-weight: 400;
        text-align: left;
        letter-spacing: 4px;
        color: #000000;
        font-size: 14px;
        width: 100% !important;
    }

    .single-input-box-otp:focus {
        border: 1px solid #007185;
        box-shadow: inset 0px 2px 4px #C8F3FA;
    }

    .single-input-box-otp-container {
        display: inline-flex;
        justify-content: space-between;
        width: 100% !important;
        max-width: 350px !important;
    }

    .otp-input-code-spinner {
        position: absolute;
        z-index: 1;
        right: 50%;
        align-self: center;
        top: auto;
        display: block;
    }


                            </style>
                            <script>
    "use strict";

    P.when('A', 'a-spinner', 'ready').execute(function (A, getSpinners) {

        var $ = A.$;
        var singleInputBoxOTPHandler = 'single-input-box-otp-handler';
        var inputCodeName = "otpCode";
        var formIdSelector = "#verification-code-form";
        var verificationTriggerSelector = ".cvf-widget-btn-verify";
        var defaultIsEmbded = 'false';
        var singleInputBoxOTPClassSelector = ".single-input-box-otp";
        var otpInputSpinnerIdSelector = "#otp-input-spinner";
        var singleInputBoxOTPContainerSelector = '.single-input-box-otp-container';
        var otpInputButtonContainerSelector = '#cvf-submit-otp-button';
        var inputBoxId = "#input-box-otp";

        // Autofocus the input box upon loading the page
        $(inputBoxId).focus();

        /**
         * Validate last entered input digit is number and replace any other character entered. No validation when user copy and paste
         * the otp.
         *
         * If user tries to paste or type more than 6 digits, discard all after 6th digit, this is taken care by a.textInput element's
         * maxLength=6.
         */
        A.declarative(singleInputBoxOTPHandler, 'keyup', function (event) {

            /**
             * Regular expression: \D metacharacter matches non-digit characters.
             * @type {RegExp}
             */
            var INVALID_DIGIT_REGEX = /\D/g;

            var $target = event.$target;

            // Ignore the event since focus is not on OTP box
            if (!$target.is(inputBoxId)) return;

            const otpInput = $(inputBoxId).val();
            var normalizedOtpInput = otpInput;
            if (INVALID_DIGIT_REGEX.test(otpInput.slice(-1))) {
                normalizedOtpInput = otpInput.slice(0, -1)
            }
            $(inputBoxId).val(normalizedOtpInput);
        });

        $(formIdSelector).submit(function () {
            readOtpInput();
        });

        function readOtpInput() {
            $(otpInputButtonContainerSelector).find("input").attr("disabled", "disabled");
            $(otpInputButtonContainerSelector).addClass("a-button-disabled");
            $(singleInputBoxOTPClassSelector).attr('disabled', 'disabled');
            $("input[name='" + inputCodeName + "']").val(getOtpCode());

            if (isEmbded()) {
                $(verificationTriggerSelector).click();
            } else {
                getSpinners(otpInputSpinnerIdSelector).show();
            }
        }

        function getOtpCode() {
            return $(inputBoxId).val();
        }

        function isEmbded() {
            return $(singleInputBoxOTPContainerSelector).data('isembded') !== null ? $(singleInputBoxOTPContainerSelector).data('isembded') : defaultIsEmbded;
        }

    });

                            </script>
                        </div>
                    </div>
                    <div class="a-section a-spacing-medium"><a id="resend-approval-link" class="a-link-normal" href="#">Resend
                        code</a></div>
                    <div class="a-section a-spacing-medium">

                        <div class="a-row">
                            <div id="resend-approval-alert" class="a-box a-alert-inline a-alert-inline-info"
                                 aria-live="polite" aria-atomic="true">
                                <div class="a-box-inner a-alert-container"><i class="a-icon a-icon-alert"></i>
                                    <div class="a-alert-content">
                                        <div id="timer" class="a-section"></div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div id="verifyAlerts" class="a-section a-spacing-medium"></div>
                    <div id="verifyFailureAlerts" class="a-section a-spacing-medium"></div>
                    <div id="approvalPollAlerts" class="a-section a-spacing-medium">
                    </div>


                    <input type="hidden" name="arb" value="068b3028-b723-4330-ab52-33016bbb1784"/><input type="hidden"
                                                                                                         name="openid.return_to"
                                                                                                         value="https://www.amazon.com.au/ap/signin?ie=UTF8&amp;clientContext=357-3284625-0900837&amp;openid.pape.max_auth_age=0&amp;use_global_authentication=false&amp;forceMobileLayout=true&amp;accountStatusPolicy=P1&amp;openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&amp;use_audio_captcha=false&amp;marketPlaceId=AN7EY7DTAW63G&amp;pageId=amzn_audible_ios&amp;arb=cefc8763-6171-458b-aa35-b884415767c4&amp;openid.return_to=https%3A%2F%2Fwww.amazon.com.au%2Fap%2Fmaplanding&amp;openid.assoc_handle=amzn_audible_ios_au&amp;openid.oa2.response_type=code&amp;openid.mode=checkid_setup&amp;openid.ns.pape=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape%2F1.0&amp;openid.ns.oa2=http%3A%2F%2Fwww.amazon.com%2Fap%2Fext%2Foauth%2F2&amp;openid.oa2.code_challenge_method=S256&amp;openid.oa2.code_challenge=rQbG0MOPoJrjP42NCgmuo9TTEzVeCxHHuNMkPApf9Uc&amp;openid.oa2.scope=device_auth_access&amp;openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&amp;openid.oa2.client_id=device%3A3636384438453245383230343439453941433245363038353341313135333146234132435a4a5a474c4b324a4a564d&amp;openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0"/><input
                        type="hidden" name="pageId" value="amzn_audible_ios"/><input type="hidden"
                                                                                     name="openid.assoc_handle"
                                                                                     value="amzn_audible_ios_au"/>
                    <input type="hidden" name="disableRedirect" value="false"/><input type="hidden" name="isResend"
                                                                                      value="1"/>
                    <input type='hidden' name='csrfToken'
                           value='gjk3+57WyoBIoygSeRO79WZF845Sz4oc36tNWrIAAAABAAAAAGT0TzxyYXcAAAAAci9WQJ8T3F+olPtdUfyk'/>
                    <div class="a-row a-spacing-small"><span id="cvf-submit-otp-button"
                                                             class="a-button a-button-span12 a-button-primary cvf-widget-btn cvf-widget-btn-verify"><span
                            class="a-button-inner"><input class="a-button-input" type="submit"
                                                          aria-labelledby="cvf-submit-otp-button-announce"/><span
                            id="cvf-submit-otp-button-announce" class="a-button-text"
                            aria-hidden="true">Submit code</span></span></span></div>
                </form>
            </div>
            <div id="resend_notification_expander" class="a-section">
                <div id="resend-transaction-approval"
                     class="a-section a-spacing-top-medium transaction-approval-js-enabled">

                    <div class="a-section">
                        <form id="resend-approval-form" method="post" action="/ap/cvf/approval/resend">


                            <input type="hidden" name="arb" value="068b3028-b723-4330-ab52-33016bbb1784"/><input
                                type="hidden" name="openid.return_to"
                                value="https://www.amazon.com.au/ap/signin?ie=UTF8&amp;clientContext=357-3284625-0900837&amp;openid.pape.max_auth_age=0&amp;use_global_authentication=false&amp;forceMobileLayout=true&amp;accountStatusPolicy=P1&amp;openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&amp;use_audio_captcha=false&amp;marketPlaceId=AN7EY7DTAW63G&amp;pageId=amzn_audible_ios&amp;arb=cefc8763-6171-458b-aa35-b884415767c4&amp;openid.return_to=https%3A%2F%2Fwww.amazon.com.au%2Fap%2Fmaplanding&amp;openid.assoc_handle=amzn_audible_ios_au&amp;openid.oa2.response_type=code&amp;openid.mode=checkid_setup&amp;openid.ns.pape=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape%2F1.0&amp;openid.ns.oa2=http%3A%2F%2Fwww.amazon.com%2Fap%2Fext%2Foauth%2F2&amp;openid.oa2.code_challenge_method=S256&amp;openid.oa2.code_challenge=rQbG0MOPoJrjP42NCgmuo9TTEzVeCxHHuNMkPApf9Uc&amp;openid.oa2.scope=device_auth_access&amp;openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&amp;openid.oa2.client_id=device%3A3636384438453245383230343439453941433245363038353341313135333146234132435a4a5a474c4b324a4a564d&amp;openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0"/><input
                                type="hidden" name="pageId" value="amzn_audible_ios"/><input type="hidden"
                                                                                             name="openid.assoc_handle"
                                                                                             value="amzn_audible_ios_au"/>
                            <input type="hidden" name="disableRedirect" value="false"/><input type="hidden"
                                                                                              name="isResend"
                                                                                              value="1"/>
                            <input type='hidden' name='csrfToken'
                                   value='gjk3+57WyoBIoygSeRO79WZF845Sz4oc36tNWrIAAAABAAAAAGT0TzxyYXcAAAAAci9WQJ8T3F+olPtdUfyk'/>
                        </form>
                    </div>
                </div>
                <style>

    .a-no-js .transaction-approval-js-enabled {
        display: none;
    }


                </style>
            </div>


            <div class="a-section"><h5 class="a-size-small a-color-secondary">Need help?</h5><span
                    class="a-size-small a-color-secondary">If you cannot receive the code, or if you changed your email or phone number, <a
                    href="https://www.amazon.com.au:443/ap/cvf/accountrecovery?arb=068b3028-b723-4330-ab52-33016bbb1784&amp;openid.assoc_handle=amzn_audible_ios_au&amp;pageId=amzn_audible_ios&amp;orig_return_to=https%3A%2F%2Fwww.amazon.com.au%2Fap%2Fsignin%3Fie%3DUTF8%26clientContext%3D357-3284625-0900837%26openid.pape.max_auth_age%3D0%26use_global_authentication%3Dfalse%26forceMobileLayout%3Dtrue%26accountStatusPolicy%3DP1%26openid.identity%3Dhttp%253A%252F%252Fspecs.openid.net%252Fauth%252F2.0%252Fidentifier_select%26use_audio_captcha%3Dfalse%26marketPlaceId%3DAN7EY7DTAW63G%26pageId%3Damzn_audible_ios%26arb%3Dcefc8763-6171-458b-aa35-b884415767c4%26openid.return_to%3Dhttps%253A%252F%252Fwww.amazon.com.au%252Fap%252Fmaplanding%26openid.assoc_handle%3Damzn_audible_ios_au%26openid.oa2.response_type%3Dcode%26openid.mode%3Dcheckid_setup%26openid.ns.pape%3Dhttp%253A%252F%252Fspecs.openid.net%252Fextensions%252Fpape%252F1.0%26openid.ns.oa2%3Dhttp%253A%252F%252Fwww.amazon.com%252Fap%252Fext%252Foauth%252F2%26openid.oa2.code_challenge_method%3DS256%26openid.oa2.code_challenge%3DrQbG0MOPoJrjP42NCgmuo9TTEzVeCxHHuNMkPApf9Uc%26openid.oa2.scope%3Ddevice_auth_access%26openid.claimed_id%3Dhttp%253A%252F%252Fspecs.openid.net%252Fauth%252F2.0%252Fidentifier_select%26openid.oa2.client_id%3Ddevice%253A3636384438453245383230343439453941433245363038353341313135333146234132435a4a5a474c4b324a4a564d%26openid.ns%3Dhttp%253A%252F%252Fspecs.openid.net%252Fauth%252F2.0&amp;isResend=0&amp;ref_=ch_tiv_approval_broadcast_to_account_recovery">try a different way</a>.</span>
            </div>

            <div class="a-section transaction-approval-js-enabled">
                <form id="pollingForm" method="get" action="/ap/cvf/approval/poll">

                    <input type="hidden" name="arb" value="068b3028-b723-4330-ab52-33016bbb1784"/><input type="hidden"
                                                                                                         name="openid.return_to"
                                                                                                         value="https://www.amazon.com.au/ap/signin?ie=UTF8&amp;clientContext=357-3284625-0900837&amp;openid.pape.max_auth_age=0&amp;use_global_authentication=false&amp;forceMobileLayout=true&amp;accountStatusPolicy=P1&amp;openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&amp;use_audio_captcha=false&amp;marketPlaceId=AN7EY7DTAW63G&amp;pageId=amzn_audible_ios&amp;arb=cefc8763-6171-458b-aa35-b884415767c4&amp;openid.return_to=https%3A%2F%2Fwww.amazon.com.au%2Fap%2Fmaplanding&amp;openid.assoc_handle=amzn_audible_ios_au&amp;openid.oa2.response_type=code&amp;openid.mode=checkid_setup&amp;openid.ns.pape=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape%2F1.0&amp;openid.ns.oa2=http%3A%2F%2Fwww.amazon.com%2Fap%2Fext%2Foauth%2F2&amp;openid.oa2.code_challenge_method=S256&amp;openid.oa2.code_challenge=rQbG0MOPoJrjP42NCgmuo9TTEzVeCxHHuNMkPApf9Uc&amp;openid.oa2.scope=device_auth_access&amp;openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&amp;openid.oa2.client_id=device%3A3636384438453245383230343439453941433245363038353341313135333146234132435a4a5a474c4b324a4a564d&amp;openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0"/><input
                        type="hidden" name="pageId" value="amzn_audible_ios"/><input type="hidden"
                                                                                     name="openid.assoc_handle"
                                                                                     value="amzn_audible_ios_au"/>
                    <input type="hidden" name="disableRedirect" value="false"/><input type="hidden" name="isResend"
                                                                                      value="1"/>
                    <input type='hidden' name='csrfToken'
                           value='gjk3+57WyoBIoygSeRO79WZF845Sz4oc36tNWrIAAAABAAAAAGT0TzxyYXcAAAAAci9WQJ8T3F+olPtdUfyk'/>
                </form>
            </div>
            <style>

  .a-no-js .transaction-approval-js-enabled {
    display: none;
  }


            </style>

            <script>
    P.when('A', 'ready').execute(function(A) {
        var $ = A.$;

        $('#resend-approval-link').click(function() {
            $('#resend-approval-form').submit();
        });
    });

            </script>

            <script>
    P.when('A', 'ready').register('resendApprovalLinksTimerStatic', function(A) {
        function updateTime(timeleft, updateMsg) {
            var resultMsg = updateMsg.split('+timeleft+');
            var endResult = resultMsg[0].split('"').join('') +timeleft+ resultMsg[1].split('"').join('');
            A.$('#timer').html(endResult);
        }

        function onComplete() {
            A.$('#resend-approval-alert').hide();
            A.$("#resend-approval-link").removeClass("transaction-approval-link-disabled");
        }

        function Timer(time, updateMsg) {
            var start = Date.now();
            updateTime(Math.ceil(time / 1000), updateMsg);

            var interval = setInterval(function() {
                var currTime = Date.now();
                var timePassed = currTime - start;
                var timeRemaining = time - timePassed;
                updateTime(Math.ceil(timeRemaining / 1000), updateMsg);

                if (timeRemaining <= 0) {
                    clearInterval(interval);
                    onComplete();
                }
            }, 1000);
        }

        function createTimer(timeInMillis, updateMsg) {
            return new Timer(timeInMillis, updateMsg);
        }

        return {
            createTimer: createTimer
        };
    });

            </script>

            <script>
    P.when('A', 'resendApprovalLinksTimerStatic', 'ready').execute(function(A, resendApprovalLinksTimerStatic) {
        var verifyOtpException = '';

        if (true && verifyOtpException !== "AuthenticationException") {
            resendApprovalLinksTimerStatic.createTimer(1693732728779 - Date.now(), 'Please wait " +timeleft+ " seconds before requesting another code.');
            A.$("#resend-approval-link").addClass("transaction-approval-link-disabled");
        }
        if(false) {
            A.$("#resend-approval-link").addClass("transaction-approval-link-disabled");
        }
    });

            </script>

            <style>
    .transaction-approval-link-disabled {
        pointer-events: none;
        opacity: 0.5;
    }

            </style>
        </div>
    </div>
</div>
</body>
</html>

from audible.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.