(function(n){"use strict";n.module("dlx.login",["ngCookies","dlx.common","ngSanitize"])})(window.angular),function(n,t){"use strict";function i(n){t.addToSet(n,"wcfHttpInterceptor")}i.$inject=["$httpProvider"];n.module("dlx.login").config(i)}(window.angular,window.dlx.ngInterceptorConfig),function(n){"use strict";function t(n,t,i,r,u,f){function c(){var r=document.getElementById("authServiceError"),t,n;r&&(e.error=r.value);t=i.get(o);t&&(e.credentials.username=t,e.rememberUsername=!0,s());n=u.getParameters();n.username&&(e.credentials.username=n.username);n.password&&(e.credentials.password=n.password);n.username&&n.password&&(e.credentials.enc=!0);n.login&&e.login()}function s(){if(e.useSSO=!e.credentials.username.match(/[a-zA-Z0-9]*\.[a-zA-Z0-9]*\.\b\d{5}\b|[a-zA-Z0-9]*\.[a-zA-Z0-9]*\.\bC\d{5}\b|[a-zA-Z0-9]*\.\b\d{5}\b|[a-zA-Z0-9]*\.\bC\d{5}\b/g),e.useSSO==!1){let i=Object.values(e.ssoFdics),r=Object.values(i[0]);var n=r[1];let t=e.credentials.username.trim().split(".");n&&n.includes(t[t.length-1])&&(e.useSSO=!0)}}function l(){if(e.processing=!0,e.error="",e.useSSO){let t=n.hasSSOEnabled(e.credentials);t.then(function(n){n?(h(e.rememberUsername),r.location.href=window.authServiceEndpoint+"/account/signon?username="+e.credentials.username):(e.error="Your username and/or password is incorrect.",e.processing=!1)}).catch(function(){e.error="An error has occurred during login.";e.processing=!1})}else{var t=n.requestLogin(e.credentials);t.then(function(n){var t=n.data;t.Code&&t.Message?(e.error=t.Message,e.processing=!1):a(t)||(h(e.rememberUsername),v(t.UseNewWindow))}).catch(function(){e.error="An error has occurred during login.";e.processing=!1})}}function h(n){if(n){var t=new Date;t.setFullYear(t.getFullYear()+1);i.put(o,e.credentials.username,{expires:t})}else i.remove(o)}function a(n){var t=n.HostUri!==r.location.host;return t&&(r.location.href="https://"+n.HostUri+"/login.aspx?username="+e.credentials.username),t}function v(n){var t="/",i;n?(i=r.open(t,"_blank","toolbar=no,status=no,menubar=no,location=no,scrollbars=no,resizable=yes,height="+(screen.availHeight-45).toString()+",width="+(screen.availWidth-20).toString()+",top=0,left=0"),r.location.href="http://www.bankersdashboard.com",f(function(){i.focus()},1e3)):r.location.href=t}var e=this,o="loginRememberUsername";e.template="/assets/templates/login.html";e.credentials={username:"",password:"",enc:!1};e.rememberUsername=!1;e.error="";e.processing=!1;e.useSSO=!1;e.login=l;e.checkLoginMethod=s;e.ssoFdics=n.getSSOFDICs();c()}t.$inject=["loginService","jwtService","$cookies","$window","queryStringService","$timeout"];n.module("dlx.login").controller("LoginController",t)}(window.angular,window.dlx.console),function(n,t){"use strict";function i(n,i,r){function u(r){var u=n.uris.ValidateUserLogin,f=n.post(u,r);return f.then(function(n){var r=n.data;t.info(["loginService.loginResponseSuccess: POST /BdPublicServices.svc/{0}","{1:J}"],[u,r]);r.Token&&i.setToken(r.Token,r.Refresh)}),f}function f(n){return r({url:window.authServiceEndpoint+"/account/sso",method:"GET",params:{username:n.username}}).then(function(n){return n.data}).catch(function(){return!1})}function e(){return r({url:window.authServiceEndpoint+"/account/ssofdics",method:"GET"}).then(function(n){return n.data}).catch(function(){return null})}function o(){let n=null,t=null;(window.forecastWindow||window.opener)&&(n=i.getToken(),t=i.getToken(!0));window.forecastWindow&&n&&t&&window.forecastWindow.postMessage(n+":"+t,"*");window.opener&&n&&t&&window.opener.dlx.jwt.setToken(n,t)}this.requestLogin=u;this.syncTokens=o;this.hasSSOEnabled=f;this.getSSOFDICs=e}i.$inject=["publicWcfService","jwtService","$http"];n.module("dlx.login").service("loginService",i)}(window.angular,window.dlx.console,window.forecastWindow,window.dlx.jwt)