nm3clol-archived-russellcou.../mirror/www.russellcountyva.us/-2034742758.js

10 lines
4.7 KiB
JavaScript

var Authentication=function(){var a=this;a.externalAuthenticationType={Facebook:0,Google:1,LinkedIn:2};var d=$("#popupBasedAuthentication"),e=$("#socialButtonPresent");a.hostUrl=window.location.origin;a.isPopupBased=function(){return d.length?!0:!1};a.anySocialButtonPresent=function(){return e.length?!0:!1};a.resizeAndCenter=function(a,b){window.resizeTo(a,b);window.moveTo((screen.availWidth-a)/2,(screen.availHeight-b)/2)};a.resizeIfPopupBased=function(){a.isPopupBased()&&a.resizeAndCenter(1E3,600)};
a.bindExternalButtons=function(){$(".social").keypress(function(){$(this).click()});$(".social").click(function(c){c.preventDefault();var b;$(this).hasClass("google")&&(b=a.externalAuthenticationType.Google,a.resizeIfPopupBased());$(this).hasClass("facebook")&&(b=a.externalAuthenticationType.Facebook,a.resizeIfPopupBased());$(this).hasClass("linkedin")&&(b=a.externalAuthenticationType.LinkedIn);window.location.href=a.hostUrl+"/Authentication/AuthenticateExternal?pathName\x3d"+window.location.pathname+
"\x26type\x3d"+b})};a.bindButton=function(a,b){$(a).unbind("keypress").bind("keypress",function(){$(this).click();return!1});$(a).unbind("click").bind("click",function(a){a.preventDefault();b();return!1})};a.IndexBehaviorTypeEnum={Normal:-1,Redirect:0,Error:1,AcceptTerms:2};a.termsAccepted=function(){closeCpModal();$.ajax({type:"post",dataType:"json",url:a.hostUrl+"/Authentication/UserAcceptedTerms",data:{},success:function(c){a.handleRedirect(c.Message)}})};a.termsNotAccepted=function(){window.close()};
a.acceptTerms=function(){openCpModal({title:$("#PrivacyPolicyWarning").val(),className:"legalUpdate",isFrontEnd:!0,url:a.hostUrl+"/MyAccount/Terms"});a.bindButton(".legalUpdate .button.accept",a.termsAccepted);a.bindButton(".legalUpdate .button.cancel",a.termsNotAccepted)};a.IndexBehavior=function(c,b){switch(c){case a.IndexBehaviorTypeEnum.Redirect:a.handleRedirect(b);break;case a.IndexBehaviorTypeEnum.AcceptTerms:a.acceptTerms();break;case a.IndexBehaviorTypeEnum.Error:alert(b)}};a.handleRedirect=
function(c){a.isPopupBased()?a.sendMessageToParent({Type:"Redirect",Url:c}):window.location.href=c};a.sendMessageToParent=function(c){void 0==internetExplorerVersion?(window.opener.postMessage(c,d.val()),window.close()):window.location.href=a.hostUrl+"/Authentication/InternetExplorerMessagingHandlerForPopup?redirectUri\x3d"+encodeURIComponent(c.Url)};$(document).ready(function(){a.isPopupBased()&&(a.anySocialButtonPresent()?a.resizeAndCenter(520,500):a.resizeAndCenter(400,400));a.bindExternalButtons()})},
LoginBox=function(){var a=this,d=$("#UserName"),e=$("#Password"),c=$("#SignInButton");a.hostUrl=window.location.origin;var b;a.setPrePopulatedUsername=function(a){b=a};a.authenticationResultType={Error:-1,Success:0,UserNeedsToAcceptTerms:1,UserCancelled:2};a.validateCredentialsPopupulated=function(){return""==d.val()?(alert($("#UsernameEmptyMessage").val()),!1):""==e.val()?(alert($("#PasswordEmptyMessage").val()),!1):!0};a.getDataForSubmission=function(){return{username:d.val(),password:e.val(),setCookie:$("#RememberMe2").is(":checked")}};
a.forgotPassword=function(){""==d.val()?alert($("#UsernameEmptyMessage").val()):$.getScript(a.hostUrl+"/Common/GlobalJSFunctionsDetail.js",function(){$.getScript(a.hostUrl+"/Areas/MyAccount/Assets/Scripts/HomeIndex.js",function(){recover(d.val())})})};a.submit=function(){var f=a.getDataForSubmission();a.validateCredentialsPopupulated()&&$.ajax({type:"post",dataType:"json",url:a.hostUrl+"/Authentication/AuthenticateInternal",data:f,success:a.handleResponse})};a.handleResponse=function(f){var b;f.ResultType==
a.authenticationResultType.Error?alert(f.Message):f.ResultType==a.authenticationResultType.UserNeedsToAcceptTerms?(b=new Authentication,b.acceptTerms()):(b=new Authentication,b.handleRedirect(f.Message))};a.bindControlClick=function(a,b){$(a).unbind("click").bind("click",function(a){b(a);return!1})};a.bindControlKeypress=function(a,b){$(a).unbind("keypress").bind("keypress",function(a){b(a)})};a.bindControl=function(b,c){a.bindControlKeypress(b,function(a){a.target.click()});a.bindControlClick(b,
c)};a.initialize=function(){a.bindControl(c,a.submit);a.bindControl("#ForgotPasswordButton",a.forgotPassword);a.bindControl("#createProfileButton",a.createProfile);a.bindControlKeypress(d,a.onUserNameKeypress);a.bindControlKeypress(e,a.onPasswordEnter);a.setUsernameAndInitialFocus()};a.setUsernameAndInitialFocus=function(){d.val(b);""!=d.val()?e.focus():d.focus()};a.onUserNameKeypress=function(a){if(13==a.which)return $(e).focus(),!1};a.onPasswordEnter=function(a){13==a.which&&$(c).click()};a.createProfile=
function(){$.ajax({type:"get",dataType:"json",url:a.hostUrl+"/Authentication/GetCreateProfileUrl",success:a.createProfileResponse})};a.createProfileResponse=function(a){(new Authentication).handleRedirect(a.url)}};