1$(document).ready(function () { 2 $('.custom-form .form-control').blur(function () { 3 if (!$(this).val()) { 4 $(this).addClass('empty'); 5 } else { 6 $(this).removeClass('empty'); 7 } 8 }); 9 10 $('.custom-form .form-control').each(function (index) { 11 if (!$(this).val()) { 12 $(this).addClass('empty'); 13 } else { 14 $(this).removeClass('empty'); 15 } 16 }); 17 18 $('.jobRef .thClose').click(function () { 19 $("body").removeClass("jobRef-active"); 20 }); 21 22 $('#login-form .show-password').click(function () { 23 $(this).text(function (i, text) { 24 txtShow = $(this).attr('data-txtShow'); 25 txtHide = $(this).attr('data-txtHide'); 26 return text === txtShow ? txtHide : txtShow; 27 }); 28 $('#login-form #pwd').attr('type', function (index, attr) { 29 return attr == 'password' ? 'text' : 'password'; 30 }); 31 }); 32 33 $('body').on('click', "#chngType", function(event) { 34 event.preventDefault(); 35 var that = $(this); 36 var password = $("#pwd"); 37 var pType = password.attr('type'); 38 var type = (pType == 'text' ? 'password' : 'text'); 39 password.attr('type',type); 40 41 }); 42 43 $('#login-form').validate({ 44 rules: { 45 username_or_email: { 46 required: true, 47 validUsernameOrEmail: true 48 }, 49 email: { 50 required: true, 51 email: true 52 }, 53 password: { 54 required: true 55 } 56 }, 57 highlight: function (element) { 58 $(element).addClass('is-invalid'); 59 }, 60 unhighlight: function (element) { 61 $(element).removeClass('is-invalid'); 62 }, 63 errorElement: 'span', 64 errorClass: 'invalid-feedback', 65 errorPlacement: function (error, element) { 66 error.insertAfter(element.siblings('.theLabel')); 67 }, 68 submitHandler: function (form) { 69 signIn_layer(); 70 } 71 }); 72 73 $('body').on('click', "#gpluslogin", function(event) { 74 event.preventDefault(); 75 var params = { 76 client_id: client_id, 77 cookiepolicy: 'single_host_origin', 78 //'callback' : 'GplusLogin' 79 //'approvalprompt':'force', 80 'scope' : 'https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/plus.me https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile' 81 }; 82 gapi.load('client:auth2', function() { 83 gapi.auth2.init(params).then(function() {
84 gapi.auth2.getAuthInstance().signIn().then(GplusLogin).catch(gPlusLoginError); 85 }); 86 }); 87 }); 88 89 $.validator.addMethod('validUsernameOrEmail', function (value, element) { 90 var emailRegex = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i; 91 var userNameRegex = /^[0-9a-zA-Z_]+$/; 92 // Vendor Specific login case 93 if (value.indexOf('|#|') > 0) { 94 var emails = value.split('|#|'); 95 if (emails.length === 2) { 96 for (var i in emails) { 97 val = emails[i]; 98 if (val.indexOf('@') > 0) { 99 if (emailRegex.test(val) === false) { 100 return false; 101 } 102 } else { 103 if (userNameRegex.test(val) === false) { 104 return false; 105 } 106 } 107 } 108 return true; 109 } 110 return false; 111 } else if (value.indexOf('@') > 0) { 112 return this.optional(element) || emailRegex.test(value); 113 } else { 114 return this.optional(element) || userNameRegex.test(value); 115 } 116 }, 'Enter valid email'); 117 118}); 119 120 121function gPlusLoginError(error) { 122 if (error.error == 'popup_blocked_by_browser') { 123 alert("Please Allow popups"); 124 } 125} 126 127var captchaOnloadCallback = function () { 128 if ($('#googleCaptcha').length) { 129 grecaptcha.render('googleCaptcha', { 130 'sitekey': '6LdTBRUTAAAAAJfuZIS-4yMBHOgaY0yu-VigaxY3', 131 'callback': function (response) { 132 $('#googleCaptcha').val(response); 133 } 134 }); 135 } 136}; 137 138function signIn_layer(confirm) { // from rozee 139 $('#login-form .loading').show(); 140 $('#messageContainer').html(''); 141 $('#login-form .btn-default').hide(); 142 $('#login-form .btn-primary').hide(); 143 showLoader("#submit_button", ".cloader"); 144 var params = {}; 145 params.email = $('#login-form #_email').val(); 146 params.pwd = $('#login-form #pwd').val(); 147 params.rzTkn = $('#rzTkn').val(); 148 if ($('#sourcFrom').length > 0) { 149 params.sourcFrom = $('#sourcFrom').val(); 150 } else { 151 params.sourcFrom = 'Login'; 152 } 153 var gCaptcha = $('#googleCaptcha').val(); 154 if (gCaptcha != null && gCaptcha != '') { 155 params.gCaptcha = gCaptcha; 156 } 157 if (typeof confirm !== 'undefined') { 158 params.goAheadCall = confirm; 159 params.token = $('#token').val(); 160 } 161 162 if(typeof otp_flag !== 'undefined'){ 163 if(otp_flag != ''){ 164 params.otp_flag = otp_flag; 165 } 166 }else{ 167 params.otp_flag = 'N'; 168 } 169 170 var alertDivIdClass = 'message'; 171 172 $.ajax({
173 url: ajax_url + 'user/login', 174 type: 'POST', 175 data: params, 176 dataType: 'json', 177 }) 178 .done(function(resp) { 179 180 if(typeof sigin_flag !== 'undefined'){ 181 if (sigin_flag != '') { 182 alertDivIdClass = '.alertMessage'; 183 } 184 } 185 //console.log('========> '+typeof resp, resp); 186 if (typeof resp.status !== 'undefined' && resp.status === false) { 187 commonAlert('danger', resp.response, '', alertDivIdClass); 188 } 189 if (typeof resp.captcha !== 'undefined' && params.sourcFrom != 'Layer') { 190 if (resp.captcha == 'loadCaptcha') { 191 var captchaHtml = $('#captchaContainer').html().trim(); 192 $('#login-form .loading').hide(); 193 $('.btn-default').show(); 194 commonAlert('danger', resp.response, '', alertDivIdClass); 195 if (captchaHtml == '') { 196 $('#captchaContainer').html(''); 197 try { 198 loadCaptcha('signIn'); 199 } catch (err) { 200 grecaptcha.reset(); 201 } 202 } else { 203 grecaptcha.reset(); 204 } 205 } 206 } 207 if (typeof resp.code !== 'undefined' && resp.code === 121) { 208 $('#token').val(resp.token); 209 $('#rzTkn').val(resp.rzTkn); 210 bootbox.confirm({ 211 title: msg_duplicateLogin, 212 message: "<h5>" + resp.message + "</h5>", 213 //className: 'confirmLoginProceed', 214 //closeButton: true, 215 buttons: { 216 confirm: { 217 label: msg_continuelogin_btn, 218 className: 'btn-success' 219 }, 220 cancel: { 221 label: msg_cancel_btn, 222 className: 'btn-danger d-block' 223 } 224 }, 225 callback: function (result) { 226 //console.log('This was logged in the callback: ' + result); 227 if (result) { 228 signIn_layer('Y'); 229 } else { 230 $('#login-form .loading').hide(); 231 $('.btn-default, .btn-primary').show(); 232 } 233 } 234 }); 235 return; 236 } 237 238 if (typeof resp.data !== 'undefined') { 239 if(typeof sigin_flag !== 'undefined'){ 240 if (sigin_flag != '') { 241 getApplyLayers("", resp.user_meta); 242 $("#submit_button").show(); 243 return false; 244 } 245 } 246 247 window.location.href = (typeof resp.url === 'undefined') ? site_url + 'dashboard' : resp.url; 248 return; 249 } 250 if (resp.response == 11) { 251 window.location.href = site_url + 'dashboard'; 252 } else if (resp.response == 'TknMisMatch') { 253 $('#rzTkn').val(resp.rzTkn); 254 $('#login-form .loading').hide(); 255 $('.btn-default, .btn-primary').show(); 256 commonAlert('danger', 'Something went wrong. Please try again.', '', alertDivIdClass); 257 return false; 258 } else if (resp.response == 'N') { 259 window.location.href = site_url + 'register/verifyregister/?email=' + resp.email; 260 } else { 261 $('#login-form .loading').hide(); 262 $('.btn-default, .btn-primary').show(); 263 commonAlert('danger', resp.response, '', alertDivIdClass); 264 $('#rzTkn').val(resp.rzTkn); 265 $('.merror').text(resp.response); 266 return false; 267 } 268 }) 269 .always(function() { 270 hideLoader("#submit_button", ".cloader"); 271 }); 272} 273 274function GplusLogin(googleUser) { 275 if (is_empty_obj(googleUser) || googleUser == {}) { 276 return false; 277 } 278 279 var id_token = googleUser.getAuthResponse().id_token; 280 var gplusName = googleUser.getBasicProfile().getName(); 281 var gplusImage = googleUser.getBasicProfile().getImageUrl(); 282 var gplusEmail = googleUser.getBasicProfile().getEmail(); 283 284 var data = { 285 token :id_token, 286 name :gplusName, 287 email :gplusEmail 288 } 289 /*console.log(data); 290 return false;*/ 291 292 if (typeof googleUser.goAheadCall !== 'undefined') { 293 data.goAheadCall = googleUser.goAheadCall; 294 } 295 296 $.ajax({
297 url: site_url+'gplus/token', 298 type: 'POST', 299 dataType: 'json', 300 data: data, 301 }) 302 .done(function(jResult) { 303 if (typeof jResult.code !== 'undefined' && jResult.code === 121) { 304 bootbox.confirm({ 305 title: msg_duplicateLogin, 306 message: "<h5>" + jResult.message + "</h5>", 307 //className: 'confirmLoginProceed', 308 buttons: { 309 confirm: { 310 label: msg_continuelogin_btn, 311 className: 'btn-success' 312 }, 313 cancel: { 314 label: msg_cancel_btn, 315 className: 'btn-danger' 316 } 317 }, 318 callback: function (result) { 319 //console.log('This was logged in the callback: ' + result); 320 if (result) { 321 googleUser.goAheadCall = 'Y'; 322 console.log('NEW: ', googleUser); 323 GplusLogin(googleUser); 324 } else { 325 $('#login-form .loading').hide(); 326 $('.btn-default').show(); 327 } 328 } 329 }); 330 return; 331 } 332 333 if (jResult.status == 'success') { 334 335 var job_id = $('#modal_job_id').val(); 336 337 if(typeof sigin_flag !== 'undefined'){ 338 if(sigin_flag != ''){ 339 getApplyLayers(job_id, jResult.user_meta); 340 return false; 341 } 342 } 343 344 commonAlert('success', jResult.msg, 'no-hide'); 345 var redirectTo = localStorage.getItem('lastUrl'); 346 localStorage.setItem('lastUrl', null); 347 if (redirectTo != null && redirectTo != 'null') { 348 setTimeout(window.location = redirectTo, 1500); 349 } else { 350 setTimeout(window.location = jResult.rUrl + 'dashboard', 1500); 351 } 352 return; 353 } else if (jResult.status == 'danger') { 354 commonAlert('danger', jResult.msg, 'no-hide'); 355 } else if (jResult.status == 'info') { 356 commonAlert('info', jResult.msg, 'no-hide'); 357 if (jResult.action == 'createNewEmail' && jResult.fRedirect == 'Yes') { 358 if(sigin_flag != ''){ 359 if(typeof jResult.socialEmail !== 'undefined' && typeof jResult.fullname !== 'undefined'){ 360 sigup_flag = '1'; 361 $('#full_name').val(jResult.fullname); 362 $('#email').val(jResult.socialEmail); 363 $('#email_second').val(jResult.socialEmail); 364 $('#register_div').show(); 365 $('#signin_div').hide(); 366 }else{ 367 getApplyLayers(job_id, jResult.user_meta); 368 } 369 }else{ 370 setTimeout(window.location = site_url + 'register/indexNew/?utm_campaign=GPLUS_REGISTER&utm_source=register&utm_medium=website', 1500); 371 } 372 } 373 } else if (jResult.status == "setpass") { 374 setTimeout( 375 (window.location = site_url + "user/setPassword"), 376 1500 377 ); 378 } 379 380 console.log(res); 381 }) 382 .always(function(jResult) { 383 if (typeof jResult.code !== 'undefined' && jResult.code === 121) { 384 } else { 385 logoutGplus(); 386 } 387 console.log("complete"); 388 }); 389} 390 391function GplusLoginError(error) { 392 console.log(JSON.stringify(error, undefined, 2)); 393} 394 395function logoutGplus() { 396 var auth2 = gapi.auth2.getAuthInstance(); 397 auth2.signOut().then(function () { 398 console.log('User signed out.'); 399 }); 400} 401 402function is_empty_obj(obj) { 403 for(var key in obj) { 404 if(obj.hasOwnProperty(key)) 405 return false; 406 } 407 return true; 408} 409 410function showLoader(argument1, loader) { 411 var load = $(loader); 412 $(argument1).addClass('d-none'); 413 $(loader).removeClass('d-none'); 414} 415 416function hideLoader(argument1, loader) { 417 $(loader).addClass('d-none'); 418 $(argument1).removeClass('d-none'); 419} 420 421function showLoaderClassBased(argument1, loader) { 422 var load = $(loader); 423 argument1.addClass('d-none'); 424 loader.removeClass('d-none'); 425} 426 427function hideLoaderClassBased(argument1, loader) { 428 loader.addClass('d-none'); 429 argument1.removeClass('d-none'); 430}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.