(function(){"use strict";function n(n,t,i,r,u,f,e,o,s,h){function l(){if(window.location.search.indexOf("login")>=0&&(n.showLogin=!1,signinAgent()),window.location.search.indexOf("refreshUser")>=0&&o.RefreshUser(),window.location.href.indexOf("#")>=0&&(n.showLogin=!1),!ct.utls.isHomePage()&&!ct.utls.isRedirectPage()&&window.location.href.indexOf("#")<0&&t.currentUser.userName===undefined){var i=o.InitSigninResponse();i||s.agentLogin()}window.location.search.indexOf("firstTimeUser")>=0&&(o.InitSigninResponse(),o.GetCustomClaims(function(n){if(ct.agent.utls.showAgentMessage(n),n.Data.ClaimList!=null&&n.Data.ClaimList.length>0){var t=window._.where(n.Data.ClaimList,{ClaimType:h.claimType.AgencyNo}),i=window._.where(n.Data.ClaimList,{ClaimType:h.claimType.StaffId}),r=window._.where(n.Data.ClaimList,{ClaimType:h.claimType.AgentMarketId});!t.length>0&&!i.length>0&&!r.length>0&&window.location.replace("/Error?error=noAccess")}else window.location.replace("/Error?error=noAccess")}))}var c=this;c.agentLogin=s.agentLogin;c.signOut=s.signOut;angular.extend(t,{showSignout:!1,showLogin:!0}),function(){u.log("init loginController");ct.utls.hideOverlay();l()}()}angular.module("ct.agentPortal").controller("loginController",n);n.$inject=["$scope","$rootScope","$location","$state","$log","$http","$cookies","headerService","authService","globalConstants"]})()