1 2var loginFormSelector = "#loginForm"; 3 4var toggleBusyButton = function(elm, flag) { 5 var $elm = $(elm); 6 if (flag) { 7 $elm 8 .prop("disabled", false) 9 .css("cursor", "") 10 .find(".fa").removeClass("fa-refresh fa-spin").addClass("fa-sign-in"); 11 } 12 else { 13 $elm 14 .prop("disabled", true) 15 .css("cursor", "progress") 16 .find(".fa").removeClass("fa-sign-in").addClass("fa-refresh fa-spin"); 17 } 18}; 19 20var login = function() { 21 var loginFormSelector = "#loginForm"; 22 var $elm = $(loginFormSelector); 23 $.ajax({ 24 "cache": false, 25 "method": $elm.prop("method"), 26 "url": $elm.prop("action"), 27 "data": $elm.serialize() 28 }).done(function(data, textStatus, xhr) { 29 switch (data.status) { 30 case 200: 31 loginDone(data, textStatus, xhr); 32 break; 33 default: 34 loginFail(xhr, textStatus, "Unknown Response"); 35 break; 36 } 37 }).fail(function(xhr, textStatus, errorThrown) { 38 switch (xhr.status) { 39 case 401: 40 errorThrown = (xhr.responseJSON.details || xhr.responseJSON.DETAILS || "An unknown error occurred.") + "\n\nPlease try again!"; 41 break; 42 case 500: 43 errorThrown = "Flag On the Play!.\n\nDo not worry, we are now checking this."; 44 break; 45 case 501: 46 errorThrown = "Please request an account with a new role from the Athletic Director. If you need further assistance please contact customer support at BigTeams."; 47 break; 48 } 49 loginFail(xhr, textStatus, errorThrown); 50 }); 51 return false; 52}; 53 54var loginDone = function(data, textStatus, xhr) { 55 var loginFormSelector = "#loginForm"; 56 $(loginFormSelector).data("redirectTo", data.redirectTo); 57 58 if(data.forceupdate == 1){ 59 window.location = "/auth/reset"; 60 return; 61 } 62 63 var isAdmin = (data.roles.indexOf("admin") > -1); 64 if (isAdmin) { 65 if (data.note.length && data.mode) { 66 $("#adminNoteBody").html(data.note); 67 $("#adminNoteModal").modal("show"); 68 $("#adminNoteModal").appendTo("body"); 69 } 70 else { 71 adminLogin(); 72 } 73 } 74 else { 75 fanLogin(data.redirectTo); 76 } 77}; 78 79var loginFail = function(xhr, textStatus, errorThrown) { 80 stopSpinner(); 81 if(xhr.responseJSON.details == "Incorrect login details"){ 82 swal("Login Failed", "Either your username and/or password is not correct \n \n please try again or select forgot password.", "error"); 83 } 84 else if(xhr.responseJSON.details == "Role is no longer supported"){ 85 swal("Role Not Supported!", errorThrown , "error"); 86 }else{ 87 swal("Login Failed", errorThrown , "error"); 88 } 89 toggleBusyButton("#loginButton", true); 90}; 91 92var adminLogin = function() { 93 // if (handleRedirect()) return; 94 window.location = "/admin"; 95}; 96 97var fanLogin = function(redirectTo) { 98 //if (handleRedirect()) return; 99 window.location = redirectTo ? redirectTo : "/fans/fanDashboard"; 100}; 101 102var handleRedirect = function() { 103 var redirectTo = $.trim($(loginFormSelector).data("redirectTo")); 104 if (redirectTo.length > 0) { 105 window.location = redirectTo; 106 return true; 107 } 108 return false; 109}; 110 111function loginsubmit(event){ 112 startSpinner(); 113 event.preventDefault(); 114 if (!event.target.checkValidity()){ 115 stopSpinner(); 116 event.target.classList.add('was-validated'); 117 }else{ 118 return login(); 119 } 120} 121 122function togglePass(span) 123{ 124 var passwordInput = $('#password'); 125 var type = passwordInput.attr('type') === 'password' ? 'text' : 'password'; 126 passwordInput.attr('type', type); 127 $(span).find('i').toggleClass('fa-eye fa-eye-slash'); 128} 129 130$(document).ready(function () { 131 $('#forgetPassword_link').click(function(event) { 132 $("#forgotpasswordModal").modal("show"); 133 }); 134 135 $('#forgotpasswordModal').appendTo('body'); 136});
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.