activity indicator
 Loading , please wait... 

Login to your account

Need a Legitquest account? Create an account


Forgot password?

Or log in with:

OTP sent to mobile number Resend

We need some more information regarding your profile.
© 2020 LQ Global Services Private Limited. All rights reserved.
'; } $(function(){ setForm(); }); $('input[name="loginType"]').on('change',function(){ setForm(); }) function getPop(message,currentForm){ bootbox.confirm({ title: 'Login Alert', message: message, buttons: { cancel: { label: ' Cancel' }, confirm: { label: ' Login' } }, callback: function (result) { if(result){ forced_login_indiviual(currentForm); } } }); } function setForm(){ var loginType=$('input[name="loginType"]:checked').val(); $("#loginCoorporateForm").hide(); $("#otpForm").hide(); if(loginType=='coorporate'){ $("#indiviual_form").hide(); $("#coorporate_form").show(); $("#loginForm").attr('action',"https://login.legitquest.com/ajax/login_coorporate") } else{ $("#indiviual_form").show(); $("#coorporate_form").hide(); $("#loginForm").attr('action',"https://login.legitquest.com/ajax/login_indiviual") } $('#otpForm').hide(); $('#profileForm').hide(); } $("#loginForm").submit(function(event){ $(this).find('#msg').html(''); $.post($(this).attr('action'),$(this).serialize()+'&redirectUrl='+encodeURIComponent($("#redirectUrl").val())+'&baseurl='+$("#baseurl").val()+"&machine_name="+getCookie('machine_name'),function(data){ try { var o= data; if(o.success){ if(o.show_otp_form){ $('#otpForm').show(); $('#otpForm').find('input[name="token"]').val(o.data.token); $('#otpForm').find('#mobile_x').html(o.data.mobile); $('.loginformbox').hide(); } if(o.show_user_profile_page){ $('#profileForm').show(); $('#profileForm').find('input[name="token"]').val(o.data.token); $('.loginformbox').hide(); } else if(o.showCoorporateLoginForm){ $("#loginCoorporateForm").find('input[name="company_name"]').val(o.data.companyName); $("#loginCoorporateForm").find('input[name="company_code"]').val(o.data.companyCode); $("#loginCoorporateForm").show(); $("#loginForm").hide(); } else{ validateUser(data,$(this).find('#msg')); } } else if(o.showpop){ getPop(o.message,'loginForm'); } else{ $('#msg').html(error_msg(o.message)); } } catch(error) { $('#msg').html(error_msg('Something went wrong.')); } }) event.preventDefault(); }) $("#otpForm").submit(function(event){ $(this).find('#msg1').html(''); $.post($(this).attr('action'),$(this).serialize()+'&redirectUrl='+encodeURIComponent($("#redirectUrl").val())+'&baseUrl='+$("#baseurl").val()+"&ip="+getCookie('machine_name'),function(data){ try { var o= data; if(o.success){ validateUser(data,$('#msg1')); } else{ $('#msg1').html(error_msg(o.message)); } } catch(error) { $('#msg1').html(error_msg('Something went wrong.')); } }) event.preventDefault(); }) $("#loginCoorporateForm").submit(function(event){ $(this).find('#msg2').html(''); $.post($(this).attr('action'),$(this).serialize()+'&redirectUrl='+encodeURIComponent($("#redirectUrl").val())+'&baseUrl='+$("#baseurl").val()+"&machine_name="+getCookie('machine_name'),function(data){ try { var o= data; if(o.success){ validateUser(data,$('#msg2')); } else if(o.showpop){ getPop(o.message,'loginCoorporateForm'); } else{ $('#msg2').html(error_msg(o.message)); } } catch(error) { $('#msg2').html(error_msg('Something went wrong.')); } }) event.preventDefault(); }) function sendOTP(){ var form=document.getElementById('otpForm'); $("#error").html('Sending OTP...'); $.post(baseUrl+"/ajax/sendOtp","_token="+window.Laravel.csrfToken+"&token="+form.token.value+'&baseurl='+$("#baseurl").val(), function( o ) { if(o.trim() =='OTP Sent'){ $("#error").html('OTP sent to your registered mobile number.'); } else{ $("#error").html('Error Sending OTP'); } }); } function validateUser(data,obj){ $.post(baseUrl+"/ajax/validate_user","_token="+window.Laravel.csrfToken+"&jsonString="+encodeURIComponent(JSON.stringify(data))+'&baseurl='+$("#baseurl").val(), function( o ) { try{ response=o; if(response.status==200){ var expiration_date = new Date(); var cookie_string = ''; expiration_date.setFullYear(expiration_date.getFullYear() + 1); cookie_string = "token="+response.token+"; domain=.legitquest.com; expires=" + expiration_date.toUTCString(); // Create or update the cookie: document.cookie = cookie_string; // window.open(baseUrl+"/package/"+response.type,'_blank','location=yes,height=570,width=520,scrollbars=yes,status=yes'); location.href=response.url; } else{ obj.html(error_msg(response.msg)); } } catch(error){ obj.html(error_msg('Something went wrong.')); } }); } function forced_login_indiviual(form){ $("#"+form).find('input[name="forced_login"]').val(1); $("#"+form).submit(); }