1var TKN = null; 2var TagAccountKey = /^(099)[0-9]{7}$|^[0-9]{9}$/; 3var TagAccount = /^(ohlm|OHLM)[0-9]{8}$|^(099)[0-9]{8}$|^[0-9]{10}$/i; 4var TagOHLM = /^(OHLM)[0-9]{8}$/i; 5var Tag099 = /^(099)[0-9]{8}$/; 6var Account = /^(?!0{10})\d{10}$/; 7var OnlyNumbers = /^[0-9]+$/; 8var OnlyNumbersBlur = /[0-9]+/; 9var regexpass = /(\<|\>|\"|\'|\&)$/i; 10var Aviso_privacidad = $("#Entraraviso_priv").is(':checked'); 11var emailRegex = /^[-\w.%+]{1,64}@(?:[A-Z0-9-]{1,63}\.){1,125}[A-Z]{2,63}$/i; 12 13function recoverypass() { 14 $("#modalbanmisEntrar").css("display", "block"); 15} 16function closeRecovery() { 17 $("#modalbanmisEntrar").css("display", "none"); 18} 19 20//Validación de campo de Cuenta o Tag 21jQuery('#EntrarUserName').keypress(function (e) { 22 input = $(this).val($(this).val().toUpperCase()); 23 var TextBox1 = document.getElementById("EntrarUserName").value; 24 ohlm = TextBox1.substring(0, 4); 25 //Se utiliza validación por si el usuario ingresa tag OHLM 26 if (ohlm == "O" || ohlm == "OH" || ohlm == "OHL" || ohlm == "OHLM") { 27 //Se llama a función para validar estructura correcta 28 if (!ValidateTagOHML(e, ohlm)) { 29 return false; 30 } 31 } 32 //Si el usuario ingresa números es para tag 099 o número de cuenta 33 else if (OnlyNumbers.test(TextBox1)) { 34 //Valida que el usuario no ingrese letras, espacios o sÃmbolos 35 if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) { 36 return false; 37 } 38 else { 39 //valida estructura de tag 099 o número de cuenta asà como su longitud 40 if (TagAccountKey.test(TextBox1)) { 41 $("#errorcontrolAccount").hide(); 42 $("#Entrar_FormularioBoton").removeAttr('disabled') 43 } 44 else { 45 $("#errorcontrolAccount").css("display", "block"); 46 $("#errorcontrolAccount").text('Debes ingresar cuenta a 10 digitos o tag con 099 más 8 dÃgitos'); 47 } 48 } 49 } 50 else { 51 //Si no se sigue la estructura correcta del tag OHML no permite continuar escribiendo 52 var Dig1 = document.getElementById("EntrarUserName").value; 53 document.getElementById('EntrarUserName').value = Dig1.substring(0, Dig1.length - 1); 54 } 55}); 56 57//Validación de campo de cuenta o Tag cuando se pierde el foco 58$("#EntrarUserName").blur(function () { 59 input = $(this).val(); 60 var value = $("#EntrarUserName").val().toUpperCase(); 61 if (OnlyNumbersBlur.test(input) || input == "") { 62 var cadcero = ''; 63 for (var i = 0; i < (10 - value.length); i++) { 64 cadcero += '0'; 65 } 66 67 $("#EntrarUserName").val(cadcero + value); 68 var valtag = jQuery('#EntrarUserName').val(); 69 70 if (TagOHLM.test(valtag) || Tag099.test(valtag) || Account.test(valtag)) { 71 $("#errorcontrolAccount").hide(); 72 $("#Entrar_FormularioBoton").removeAttr('disabled'); 73 } 74 else { 75 $("#errorcontrolAccount").css("display", "block"); 76 $("#errorcontrolAccount").text('Debes ingresar cuenta a 10 digitos, tag con 099 más 8 dÃgitos o tag OHLM más 8 dÃgitos'); 77 } 78 79 80 } 81 else { 82 $("#errorcontrolAccount").css("display", "block"); 83 $("#errorcontrolAccount").text('Debes ingresar cuenta a 10 digitos, tag con 099 más 8 dÃgitos o tag OHLM más 8 dÃgitos'); 84 } 85 return false; 86}); 87 88$("#EntrarPass").keyup(function () { 89 90 var input2 = $(this).val(); 91 if (!regexpass.exec(input2)) { 92 93 $("#errorcontrolPass").css("display", "none"); 94 $("#Entrar_FormularioBoton").removeAttr('disabled'); 95 96 } else { 97 $("#errorcontrolPass").css("display", "block"); 98 $("#errorcontrolPass").text('Caracteres invalidos'); 99 $("#Entrar_FormularioBoton").attr('disabled', 'disabled'); 100 } 101 return false; 102}); 103 104$("#EntrarPass").blur(function () { 105 var input2 = $(this).val(); 106 107 if (input2 == "") { 108 $("#errorcontrolPass").css("display", "block"); 109 $("#errorcontrolPass").text('Por favor ingrese su contraseña') 110 $("#Entrar_FormularioBoton").removeAttr('disabled'); 111 } 112 else { 113 $("#errorcontrolPass").css("display", "none"); 114 $("#errorcontrolPass").text(''); 115 } 116 return false; 117}); 118 119$("#entrarTAG").keyup(function () { 120 var input4 = $(this).val(); 121 122 123 if (TagAccount.test(input4)) { 124 125 $("#EntrarTAGErrors").css("display", "none"); 126 $("#entrarTAG").css("border-color", "#00a65a"); 127 $("#Entrar_Btn").removeAttr('disabled'); 128 129 } else { 130 $("#EntrarTAGErrors").css("display", "block"); 131 $("#EntrarTAGErrors").text('Campo alfanumérico, tag con 099 más 8 dÃgitos y tag OHLM más 8 dÃgitos'); 132 $("#entrarTAG").css("border-color", "#dd4b39"); 133 $("#Entrar_Btn").attr('disabled', 'disabled'); 134 135 } 136 return false; 137}); 138 139$("#entrarTAG").blur(function () { 140 var input4 = $(this).val().toUpperCase(); 141 142 143 if ((input4.length == 12 && (input4.substring(0, 4) == "OHLM" || input4.substring(0, 4) == "ohlm")) || (input4.length == 11 && input4.substring(0, 3) == "099")) { 144 145 $("#EntrarTAGErrors").css("display", "none"); 146 $("#entrarTAG").css("border-color", "#00a65a"); 147 $("#Entrar_Btn").removeAttr('disabled'); 148 149 } else { 150 $("#EntrarTAGErrors").css("display", "block"); 151 $("#EntrarTAGErrors").text('Campo alfanumérico, tag con 099 más 8 dÃgitos y tag OHLM más 8 dÃgitos'); 152 $("#entrarTAG").css("border-color", "#dd4b39"); 153 $("#Entrar_Btn").attr('disabled', 'disabled'); 154 155 } 156 return false; 157}); 158 159 160 161$("#entrarCorreo").keyup(function () { 162 var input3 = $(this).val(); 163 164 165 if (emailRegex.test(input3)) { 166 167 $("#EntrarEmailErrors").css("display", "none"); 168 $("#entrarCorreo").css("border-color", "#00a65a"); 169 $("#Entrar_Btn").removeAttr('disabled'); 170 171 } else { 172 $("#EntrarEmailErrors").css("display", "block"); 173 $("#EntrarEmailErrors").text('Correo électronico incorrecto'); 174 $("#entrarCorreo").css("border-color", "#dd4b39"); 175 $("#Entrar_Btn").attr('disabled', 'disabled'); 176 177 } 178 return false; 179}); 180 181//Bandera que dependiendo de su valor le dará una funcionalidad al bot
181ón Entrar_FormularioBoton u otra 182$("#Entrar_FormularioBoton").data("save", false); 183 184$("#Entrar_FormularioBoton").click(function () { 185 $("#errorcontrolAccountText").hide(); 186 $("#errorcontrolAccount").css("display", "none"); 187 $("#errorcontrolAccount").text(''); 188 var value = $("#EntrarUserName").val().toUpperCase(); 189 190 //Rellena con ceros el campo "EntrarUserName" 191 if (value.substring(0, 4) != "OHLM" && value.substring(0, 4) != "ohlm" && value.substring(0, 3) != "099") { 192 var cadcero = ''; 193 for (var i = 0; i < (10 - value.length); i++) { 194 cadcero += '0'; 195 } 196 $("#EntrarUserName").val(cadcero + value); 197 } 198 199 var valtag = jQuery('#EntrarUserName').val(); 200 if (TagOHLM.test(valtag) || Tag099.test(valtag) || Account.test(valtag)) { 201 //Se valida el valor de la bandera para darle funcionalidad al botón 202 if ($(this).data("save")) { 203 var password = $("#EntrarPass").val(); 204 205 if (valtag == "0000000000") { 206 $("#errorcontrolAccount").css("display", "block"); 207 $("#errorcontrolAccount").text('Debes ingresar cuenta a 10 digitos, tag con 099 más 8 dÃgitos o tag OHLM más 8 dÃgitos'); 208 } 209 else if (password == "") { 210 $("#errorcontrolPass").css("display", "block"); 211 $("#errorcontrolPass").text('Por favor ingrese su contraseña') 212 } 213 else { 214 $("#errorcontrolAccount").css("display", "none"); 215 //$("#EntrarUserName").css("border-color", "#00a65a"); 216 sessionStorage.clear(); 217 var vale = false; 218 var avi_priv = $("#Entraraviso_priv").is(':checked'); 219 if (grecaptcha.getResponse() === "" && IsDebug == false) { 220 //alert("faltó Recaptcha"); 221 //location.reload(); 222 $('#errorcontrolCaptcha').css("display", "block"); 223 return vale; 224 } else { 225 if (avi_priv) { 226 227 var toCreate = {}; 228 toCreate.cuenta = jQuery('#EntrarUserName').val(); 229 toCreate.Tag = null; 230 231 var dataRegister = JSON.stringify(toCreate); 232 var dataResponse = ""; 233 $("#Entrar_FormularioBoton").attr('disabled', 'disabled'); 234 235 $.ajax({
236 type: 'post', 237 url: cmsServiceUrlBase + cmsServiceUrlAvisoPrivacidad, // URL aviso de privacidad 238 data: dataRegister, 239 crossDomain: true, 240 contentType: "application/json", 241 success: function (data) { 242 console.log(data); // 243 $("#Entrar_FormularioBoton").removeAttr('disabled'); 244 Sendlogin(); 245 $('input[name="Entraraviso_priv"]').attr('checked', false); 246 }, 247 error: function (XMLHttpRequest, textStatus, errorThrown) { 248 console.log(XMLHttpRequest); 249 console.log(textStatus); 250 console.log(errorThrown); 251 $("#Entrar_FormularioBoton").removeAttr('disabled'); 252 } 253 }); 254 } else { 255 //alert("Favor de leer y aceptar el aviso de privacidad"); 256 $('#errorcontrolAviso').css("display", "block"); 257 return vale; 258 } 259 } 260 } 261 262 } 263 else { 264 if (valtag == "0000000000") { 265 $("#errorcontrolAccount").css("display", "block"); 266 $("#errorcontrolAccount").text('Debes ingresar cuenta a 10 digitos, tag con 099 más 8 dÃgitos o tag OHLM más 8 dÃgitos'); 267 } 268 else { 269 $("#errorcontrolAccount").css("display", "none"); 270 //$("#EntrarUserName").css("border-color", "#00a65a"); 271 sessionStorage.clear(); 272 $("#modalProcesando").show(); 273 //Llamada a función para obtener token para consumo de servicio RedirectIndraOrCoreTV 274 GetTokenToRedirect(valtag, function (ResponseToken) { 275 if (ResponseToken != null) { 276 if (ResponseToken.Token != null || ResponseToken.Token != "") { 277 var Request = new Object(); 278 Request.Token = ResponseToken.Token; 279 Request.TagOrAccount = valtag; 280 if (Account.test(valtag)) { 281 Request.IsAccount = true; 282 } else { 283 Request.IsAccount = false; 284 } 285 //Llamada a función para saber si el usuario está registrado en Indra o Inetum 286 RedirectIndraOrCoreTV(Request, function (ResponseRedirect) { 287 if (ResponseRedirect != null) { 288 if (!ResponseRedirect.exist) { 289 if (ResponseRedirect.Response_code == 0) { 290 $("#EntrarUserName").val(valtag); 291 $("#EntrarUserName").attr('disabled', 'disabled'); 292 $("#Entrar_FormularioBoton").val("INICIAR SESIÃN"); 293 $("#EntrarPass").show(); 294 $("#PrivacyNoticeLink").show(); 295 $("#divCaptcha").show(); 296 $("#divForgetPassword").show(); 297 $("#Entrar_FormularioBoton").data("save", true); 298 $("#modalProcesando").hide(); 299 } 300 else if (ResponseRedirect.Response_code == 1) { 301 $("#modalProcesando").hide(); 302 $("#errorcontrolAccount").css("display", "block"); 303 $("#errorcontrolAccount").text(ResponseRedirect.Re
303sponse_message); 304 } 305 } 306 else { 307 $("#modalProcesando").hide(); 308 location.href = "https://online.televia.com.mx/login?mail=" + ResponseRedirect.email; s 309 } 310 } 311 else { 312 //Error genérico 313 $("#modalProcesando").hide(); 314 $("#errorcontrolAccount").css("display", "block"); 315 $("#errorcontrolAccount").text('Se ha generado un error de forma inesperada.'); 316 } 317 }); 318 } 319 else { 320 //Error genérico 321 $("#modalProcesando").hide(); 322 $("#errorcontrolAccount").css("display", "block"); 323 $("#errorcontrolAccount").text('Se ha generado un error de forma inesperada.'); 324 } 325 } 326 else { 327 //Error genérico 328 $("#modalProcesando").hide(); 329 $("#errorcontrolAccount").css("display", "block"); 330 $("#errorcontrolAccount").text('Se ha generado un error de forma inesperada.'); 331 } 332 }); 333 } 334 } 335 } 336 else { 337 $("#errorcontrolAccount").css("display", "block"); 338 $("#errorcontrolAccount").text('Debes ingresar cuenta a 10 digitos, tag con 099 más 8 dÃgitos o tag OHLM más 8 dÃgitos'); 339 } 340}); 341 342//Llamada a servicio para obtener token para servicio de redireccionamiento 343function GetTokenToRedirect(Request, Callback) { 344 try { 345 $.ajax({
346 type: 'post', 347 url: cmsServiceUrlBase + cmsServiceUrlGetTokenToRedirect, 348 data: JSON.stringify(Request), 349 crossDomain: true, 350 contentType: "application/json", 351 success: function (ResponseToken) { 352 return Callback(ResponseToken); 353 }, 354 error: function (XMLHttpRequest, textStatus, errorThrown) { 355 console.log(XMLHttpRequest); 356 console.log(textStatus); 357 console.log(errorThrown); 358 return Callback(null); 359 } 360 }); 361 } catch (e) { 362 console.log(e); 363 return Callback(null); 364 } 365} 366 367//Llamada a servicio para determinar si el usuario es de Indra o Inetum 368function RedirectIndraOrCoreTV(Request, Callback) { 369 try { 370 $.ajax({ 371 type: 'post', 372 url: cmsServiceUrlBase + cmsServiceUrlRedirectIndraOrCoreTV, 373 data: JSON.stringify(Request), 374 crossDomain: true, 375 contentType: "application/json", 376 success: function (ResponseRedirect) { 377 return Callback(ResponseRedirect); 378 }, 379 error: function (XMLHttpRequest, textStatus, errorThrown) { 380 console.log(XMLHttpRequest); 381 console.log(textStatus); 382 console.log(errorThrown); 383 return Callback(null); 384 } 385 }); 386 } catch (e) { 387 console.log(e); 388 return Callback(null); 389 } 390} 391 392function Sendlogin() { 393 var toCreate = {}; 394 toCreate.User = jQuery('#EntrarUserName').val().toUpperCase(); 395 toCreate.Password = jQuery('#EntrarPass').val(); 396 var valtag = jQuery('#EntrarUserName').val(); 397 if (Account.test(valtag)) { 398 toCreate.IsAccount = true; 399 } else { 400 toCreate.IsAccount = false; 401 } 402 403 var datalogin = JSON.stringify(toCreate); 404 //$("#EntrarDivInitial").css('display', 'none'); 405 $("#modalProcesando").css('display', 'block'); 406 $("#Entrar_FormularioBoton").attr('disabled', 'disabled'); 407 408 $.ajax({
409 type: "POST", 410 url: cmsServiceUrlBase + cmsServiceUrlLoginEntrar, 411 crossDomain: true, 412 data: datalogin, 413 dataType: "json", 414 contentType: "application/json", 415 success: function (data) { 416 417 //$("#EntrarDivInitial").css('display', 'block'); 418 $("#modalProcesando").css('display', 'none'); 419 $("#Entrar_FormularioBoton").removeAttr('disabled'); 420 if (data === null) { 421 $("#errorcontrolSession").css("display", "block"); 422 } else if (data.Data === null) { 423 $("#errorcontrolSession").css("display", "block"); 424 } 425 else if (data.Response_code === 99) { 426 $("#errorcontrolSession").css("display", "block"); 427 $("#errorcontrolSession").text(data.Response_message); 428 } else if (data.Response_code === 1) { 429 $('#EntrarPass').val(''); 430 $("#errorcontrolPass").css("display", "block"); 431 $("#errorcontrolPass").text(data.Response_message); 432 $("#errorcontrolPassText").show(); 433 } 434 else if (data.Response_code === 0) { 435 if (data.Data.Token !== "") { 436 var result = data.Data.Token; 437 TKN = data.Data.Token; 438 439 EncryptToken(result, function (datatkn) { 440 441 sessionStorage.setItem('TKN', datatkn); 442 //ValidRegisteredTaxInformation(TKN, function (DataRegistered) { 443 // if (DataRegistered != null) { 444 445 // if (DataRegistered.Response_code == 1 || DataRegistered.Response_code == 99) { 446 // $("#errorcontrolSession").css("display", "block"); 447 // $("#errorcontrolSession").text(DataRegistered.Response_message); 448 // } else { 449 // if (DataRegistered.Data != null) { 450 // sessionStorage.setItem('HasRF', DataRegistered.Data); 451 452 //if (DataRegistered.Data) { 453 // location.href = cmsWeUrlBase + tvUrlComplementMisViajes; 454 //} else { 455 //location.href = tvUrlComplementInfoCuenta; 456 location.href = tvUrlComplementMisViajes; 457 //} 458 // } else { 459 // $("#errorcontrolSession").css("display", "block"); 460 // $("#errorcontrolSession").text("Ocurrio un error, intenta de nuevo."); 461 // } 462 // } 463 // } else { 464 // $("#errorcontrolSession").css("display", "block"); 465 // $("#errorcontrolSession").text("Ocurrio un error, intenta de nuevo."); 466 // } 467 //}); 468 }); 469 } else { 470 $("#errorcontrolSession").css("display", "block"); 471 472 } 473 474 } 475 }, 476 error: function (XMLHttpRequest, textStatus, errorThrown) { 477 console.log(XMLHttpRequest); 478 console.log(textStatus); 479 console.log(errorThrown); 480 } 481 482 }); 483} 484 485$("#Entrar_Btn").click(function () { 486 var valtag = jQuery("#entrarTAG").val().toUpperCase(); 487 if ((valtag.substring(0, 4) == "OHLM" && valtag.length != 12) || (valtag.substring(0, 3) == "099" && valtag.length != 11)) { 488 $("#EntrarTAGErrors").css("display", "block"); 489 $("#EntrarTAGErrors").text('Campo alfanumérico, tag con 099 más 8 dÃgitos o tag OHLM más 8 dÃgitos'); 490 } else { 491 $("#EntrarTAGErrors").css("display", "none"); 492 } 493 if ($("#entrarCorreo").val() == "") { $("#EntrarEmailErrors").css("display", "block"); $("#EntrarEmailErrors").text("El campo 'Correo Electr\u00f3nico' es obligatorio."); } else { $("#EntrarEmailErrors").css("display", "none"); } 494 495 if (valtag != "" && $("#entrarCorreo").val() != "") { 496 var toCreate = {}; 497 toCreate.TAG = valtag; 498 toCreate.EMAIL = jQuery("#entrarCorreo").val(); 499 var dataRecovery = JSON.stringify(toCreate); 500 $(".EntrarLoader").css('display', 'inline-block'); 501 $.ajax({
502 type: 'post', 503 url: cmsServiceUrlBase + cmsServiceUrlRecoveryPass, // URL de recoovery pass 504 data: dataRecovery, 505 crossDomain: true, 506 contentType: "application/json", 507 success: function (dataResponse) { 508 $("#Entrar_Btn").attr('disabled', 'disabled'); 509 $(".EntrarLoader").css('display', 'none'); 510 //console.log(dataResponse); // 511 var id = dataResponse.split(",")[0]; 512 513 if (id === "0") { 514 515 var info = dataResponse.split(",")[1]; 516 $("#EntrarEmailErrors").css('display', 'block'); 517 $("#EntrarEmailErrors").text("El correo que tenemos registrado para tu tag es: " + info); 518 } else if (id === "2") { 519 alert("Se enviaron tus datos de acceso al correo proporcionado"); 520 $("#modalbanmisEntrar").css('display', 'none'); 521 } else { 522 $("#EntrarEmailErrors").css('display', 'block'); 523 $("#EntrarEmailErrors").text("No existe información"); 524 } 525 }, 526 error: function (XMLHttpRequest, textStatus, errorThrown) { 527 console.log(XMLHttpRequest); 528 console.log(textStatus); 529 console.log(errorThrown); 530 }, 531 complete: function () { 532 $("#Entrar_Btn").removeAttr('disabled'); 533 $('#entrarCorreo').val(''); 534 535 } 536 }); 537 } 538}); 539 540 541function EncryptToken(pTKN_ENCRIPT, callback) { 542 $.ajax({
543 type: "POST", 544 url: cmsServiceUrlBase + cmsServiceUrlEncryptToken, 545 data: { "Token": pTKN_ENCRIPT }, 546 cache: false, 547 dataType: "json", 548 crossDomain: true, 549 success: function (decryptToken) { 550 return callback(decryptToken); 551 }, 552 error: function (XMLHttpRequest, textStatus, errorThrown) { 553 console.log(XMLHttpRequest); 554 console.log(textStatus); 555 console.log(errorThrown); 556 return callback(null); 557 } 558 }); 559} 560 561 562function DecryptToken(pTKN_ENCRIPT, callback) { 563 $.ajax({ 564 type: "POST", 565 url: cmsServiceUrlBase + cmsServiceUrlDecryptToken, 566 data: { "Token": pTKN_ENCRIPT }, 567 cache: false, 568 dataType: "json", 569 crossDomain: true, 570 success: function (decryptToken) { 571 return callback(decryptToken); 572 573 }, 574 error: function (XMLHttpRequest, textStatus, errorThrown) { 575 console.log(XMLHttpRequest); 576 console.log(textStatus); 577 console.log(errorThrown); 578 return callback(null); 579 } 580 }); 581} 582//Función para determinar longitud de tag OHML y validar su estructura 583function ValidateTagOHML(e, ohlm) { 584 $("input[name='EntrarUserName']").attr('maxlength', '12'); 585 $("input[name='EntrarUserName']").attr('minlength', '12'); 586 $("#errorcontrolAccount").css('display', 'block'); 587 $("#errorcontrolAccount").text("Campo Alfanúmerico, tag con OHLM a 12 digitos"); 588 589 if ($('#EntrarUserName').val().length >= 11) { 590 $("#errorcontrolAccount").css('display', 'none'); 591 $('#Entrar_FormularioBoton').removeAttr("disabled"); 592 } 593 //Valida que después de OHLM solo se escriban números 594 if (ohlm == "OHLM") { 595 //Vaida si se intentan escribir letras o sÃmbolos para no permitirlo 596 if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) { 597 return false; 598 } 599 else { 600 return true; 601 } 602 } 603 else { 604 return true; 605 } 606}
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.