1/*! 2 * bca-login.js v1.1, 11-15-2016 3 * By Scott Shefler, http://www.bcacademe.com 4 * 1.1 Changelog: updated some commenting to be more clear, re-arranged js ordering for better grouping clarity, 5 added overriding and redirecting current page redirect to account page detect if on http or https protocol 6 */ 7 8var ajax_login = function () { 9 10 // Login form 11 var $login_form = $(".js-login-form"), 12 $login_error_message = $login_form.find(".js-login-alert"); 13 14 // Disable button 15 $login_form.find('button[type="submit"]').attr("disabled", "disabled"); 16 17 // Append loading animation 18 $("body").append('<div class="spinner"></div'); 19 20 // Set loading animation variable 21 var $spinner = $(".spinner"); 22 23 // Remove previous error message 24 $login_error_message.removeClass("alert-danger animate-flicker").html(""); 25 26 // Get domain data and account url 27 var $domain_data = $(".js-domain-data"), 28 domain_secure = $domain_data.attr("data-secure-domain"), 29 domain_non_secure = $domain_data.attr("data-non-secure-domain"), 30 account_url = $domain_data.attr("data-account-url"); 31 32 // Ajax post 33 $.ajax({ 34 type: "POST", 35 url: "/ZoneProcess.aspx?ZoneID=-1", 36 data: $login_form.serialize() 37 }).done(function (response) { 38 // Make sure secure zone access denied page has suppressed template and "Secure zone access denied" text 39 if (response.indexOf("Secure Zone Access Denied") !== -1) { 40 $login_form.find('button[type="submit"]').removeAttr("disabled"); // Remove disabled attribute 41 $login_form.find('[name="Password"]').val(""); // Clear Password Value 42 $login_error_message.addClass("alert-danger animate-flicker").html('<p>Incorrect email address and/or password</p>'); // Alert 43 $spinner.remove(); // Remove loading indicator 44 } else { 45 // Get login data to login over both secure and non secure urls 46 $.get("/_ajax/zone-login", function (login_data) { 47 var $login_data = $(login_data).filter(".js-login-data"), 48 vid = $login_data.attr("data-vid"), 49 vsv = $login_data.attr("data-vsv"), 50 eid = vid; 51 // Add BC secure domain for zone login relay 52 var redirectDomain = "https://" + domain_secure; 53 // If on secure domain switch to non secure domain for zone login relay 54 if (window.location.hostname === domain_secure) { 55 redirectDomain = "http://" + domain_non_secure; // make sure domain data is on every page 56 } 57 // Array of URLs to override login to current page and redirect to my account 58 var redirectOverride = ["/", "/login", "/logoutprocess.aspx", "/_System/SystemPages/PasswordReset", "/_System/SystemPages/PasswordResetSuccess"]; 59 // Current page user is on 60 var currentUrl = window.location.pathname; 61 // Standard redirect URL to current page 62 var redirectUrl = encodeURIComponent(window.location.href); 63 // If current page is in string array of overrides redirect to account area 64 if ($.inArray(currentUrl, redirectOverride) !== -1) { 65 var redirectProtocol = "http://"; 66 if (window.location.hostname === domain_secure) { 67 redirectProtocol = "https://"; 68 } 69 redirectUrl = redirectProtocol + window.location.hostname + account_url; // Replace with url to account landing page 70 } 71 // Redirect 72 window.location = redirectDomain + "/ZoneLoginRelay.aspx?&VID=" + vid + "&VSV=" + vsv + "&URL=" + redirectUrl + "&KeepLoggedIn=True&EID=" + eid; 73 }); 74 } 75 }).fail(function () { 76 $login_form.find('button[type="submit"]').removeAttr("disabled"); 77 $spinner.remove(); 78 79 }); 80 81}; 82 83// For Magnific Popup Login Form Usage Only 84/*$(function () { 85 $('.js-login-popup').magnificPopup({ 86 type: 'ajax', 87 preloader: false, 88 callbacks: { 89 parseAjax: function (mfpResponse) { 90 mfpResponse.data = $(mfpResponse.data).filter('.popup-login-form'); // Ajax Container Element 91 } 92 } 93 }); 94});*/
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.