Rev 13739 | Blame | Compare with Previous | Last modification | View Log | RSS feed
<div class="container mobileverification"><div class="askformobileverification text-center">Please give a missed call to verify your mobile number</div><div class="telecaller"><img src="/img/telecaller.png" class="img "/></div><div class="telecaller hidden" id="callbtncontainer"><a id="callbtn"><img src="/img/callbtn.png" class="img "/></a></div><div class="verificationcontrols"><?php if(empty($logged_user['User']['mobile_number'])):?><form id="enter_number"><p>Enter your phone number:</p><p><input type="number" name="phone_number" id="phone_number" /></p><p><input type="submit" name="submit" value="Verify" /></p></form><?php endif;?><div id="dial2verify" class="hidden"><p id="waiting_msg"></p><p id="Image">Loading ..</strong></p><p id="status">Loading ..</strong></p></div></div><div class="pull-right skipbtn"><a href="/users/skipmobileverification"><img src="/img/skipbtn.png" class="img "/></a></div></div><script type="text/javascript">var attempt=1;var SID="";$(document).ready(function(){$("#enter_number").submit(function(e) {e.preventDefault();initiateDial2Verify();});});function initiateDial2Verify() {showCodeForm(1);GetVerificationImage();}function showCodeForm(code) {$("#dial2verify").toggleClass('hidden');$("#dial2verify").fadeIn();$("#enter_number").fadeOut();$("#waiting_msg").text("Waiting for missed call from "+$("#phone_number").val());}function GetVerificationImage() {$.post("/users/getdial2verifynumber", { phone_number : $("#phone_number").val() },function(data) { updateImage(data.ImageUrl,data.SessionId,data.VerificationNode); }, "json");}function updateImage(ImageURL, vSID, telnum) {if ( ImageURL === "Err" || ImageURL === "" ) {Err();} else {$("#Image").html("Please give a missed call to <br><img src=\""+ImageURL+"\"/>");SID = vSID;$('#callbtncontainer').removeClass('hidden');$('#callbtn').attr('href','tel:'+telnum);PollStart("UnVerified");}}function CheckStatus() {$.post("/users/getdial2verifystatus", { SID : SID },function(data) { PollStart(data.VerificationStatus); }, "json");}function PollStart(vStatus) {attempt =attempt+1;if ( attempt >= 90 ) {TimeoutCheck();} else if (vStatus === "UnVerified") {$("#status").html("Please give a missed call in <b><i>"+(90-attempt) +"</i></b> seconds");setTimeout(CheckStatus, 1000);} else if (vStatus === "VERIFIED") {success();} else{TimeoutCheck();}}function Err() {$("#status").html("Error!<br>Sorry something went wrong, Please cross check your telephone number.");}function success() {$("#status").text("Congrats !!! Phone number is Verified!");var dt = new Date();var str = dt.toYMD();$.post("/users/edit/"+me, { mobile_number : $("#phone_number").val(),'mobile_verified' : 1, 'mobile_number_last_updated' : str, 'id' : me},function(data) {if(data,success) {$.get("/users/reauthenticate/"+me,function(authdata){document.location = '/deals/mine/?user_id='+me;},'json');}}, "json");}function TimeoutCheck() {$("#status").text("Verification Failed!");}(function() {Date.prototype.toYMD = Date_toYMD;function Date_toYMD() {var year, month, day;year = String(this.getFullYear());month = String(this.getMonth() + 1);if (month.length == 1) {month = "0" + month;}day = String(this.getDate());if (day.length == 1) {day = "0" + day;}return year + "-" + month + "-" + day;}})();</script>