Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function checkLogin(u,ts,uid) {
- // console.log("checkLogin()");
- var login;
- var unique = $.now();
- Pace.ignore(function() {
- $.ajax({
- url: "{{ url('checkbro') }}/" + u +"/"+uid,
- type: "get",
- async: false,
- success: function (data) {
- login = data;
- },
- error: function () {
- //error class="text-center"
- }
- });
- });
- // swal('Status Login is ' + login.status);
- if (login.status == 0 && login.auto_wa == 1) {
- // swal('Proccess Login');
- {{--var img = '<img class="zmdi-hc-spin" src="{{asset('images/watele.png')}}" width="48" height="48" alt="sQuare">';--}}
- var img = '<img style="margin-top:90px;" src="{{asset('loader-64x/712.gif')}}">';
- if(login.hp_connected == 0){
- var alert = "<div class='alert alert-warning font-bold'>Phone not connected to internet, please check..</div>";
- }
- else if(login.pc_connected == 0) {
- var alert = "<div class='alert alert-warning font-bold'>WBS not connected to internet, please check..</div>";
- }
- else{
- var alert = "<div class='alert alert-warning font-bold'>Running services, please wait..</div>";
- }
- if (ts < new Date(login.update_qr)) {
- img = "<img src='/" + login.name + "qrcode.png?" + unique + "'>";
- alert = "<div class='alert alert-danger font-bold'>Whatsapp has been logged out, please rescan phone</div>";
- }
- $('#myModal .modal-header h3').html("Scan "+login.name+" ("+login.number+")");
- $('#myModal .modal-body').html("<div class='text-center' style='height:290px; margin-bottom: 0px'>"+img+"</div>"+alert);
- if($('#myModal').hasClass('show') === false) {
- window.setTimeout(function () {
- $('#myModal').modal('show');
- }, 1000);
- }
- window.setTimeout(checkLogin, 5000, u,ts,uid);
- }else if (login.status == 1) {
- // swal('Login Succedd');
- //actually this isn't necessary
- if($('#myModal').hasClass('in')) {
- $('#myModal .modal-body div.alert').removeClass("alert-danger");
- $('#myModal .modal-body div.alert').removeClass("alert-warning");
- $('#myModal .modal-body div.alert').addClass("alert-success");
- $('#myModal .modal-body div.alert').html("Whatsapp Successfully Logged In");
- window.setTimeout(function () {
- $('#myModal').modal('hide');
- var pathArray = window.location.pathname.split( '/' );
- if (pathArray[1] == "account") {
- window.location.reload();
- }
- }, 1000);
- }
- window.setTimeout(needScan, 5000, uid);
- } else {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement