Thank you for signing up to receive weekly progressive news.
OK
Stay with The Nation!
Sign up here to get the the best stories of the week and exclusive offers for subscribers.
X
for(var charsArray="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@!#$%^&*",lengthOtp=6,captcha=[],image_code="",i=0;lengthOtp>i;i++){var index=Math.floor(Math.random()*charsArray.length+1);-1==captcha.indexOf(charsArray[index])?captcha.push(charsArray[index]):i--}var canv=document.createElement("canvas");canv.id="can-captcha",canv.width=110,canv.height=40;var ctx=canv.getContext("2d");function validateCaptcha(e){e.value==image_code?(document.getElementById("exit-submit-btn").disabled=!1,document.getElementById("exit-submit-btn").classList.remove("disabled")):(document.getElementById("exit-submit-btn").disabled=!0,document.getElementById("exit-submit-btn").classList.add("disabled"))}ctx.font="25px Georgia",image_code=captcha.join(""),ctx.strokeText(captcha.join(""),0,30),document.getElementById("image-captcha").appendChild(canv),window.addEventListener("message",function(e){if(void 0!==e.data.piano){var a=e.data.piano;a.success?$(".thank-you-pop").toggleClass("ng-hide"):$(".error-msg").text(a.message)}},!1);