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OP,cAIb1G,EAAWa,UAAU,8EACxB,uDACR,CAGkCqG,CAA4CD,GACtEA,EAAOP,YAEPzG,EAAGmC,4BAA4B,CAAC6E,SAAQE,kBAAmBlH,EAAG8G,aAG9D9G,EAAG8G,YAEX,CACJ,CAtQAnH,EAAUgC,aAAe,KAwQzBoB,EAAwClB,QAAU,CAC9C,UACA,aACA,yBACA,cAEJlC,EAAUmC,WAAaiB,EAChB,MAAMoE,EAAyCxH,iDCzS/C,MAAMyH,EAAmC,CAC5CC,8BAA+B,CAC3BC,iBAAkB,EAClBxE,IAAK,EACLD,MAAO,EACPD,QAAS,eCLjB2E,EAAAC,QAAA,0fCAAD,EAAAC,QAAA","names":["component","RevealPasswordController","$scope","$element","BdLocalize","vm","this","isShowingPassword","showPasswordText","hidePasswordText","isPasswordManagerIconVisible","isRevealEnabled","togglePassword","input","attr","$postLink","find","getString","observer","MutationObserver","style","backgroundImage","disconnect","$safeApply","observe","attributes","childList","characterData","$on","template","templateHtml","bindings","controllerAs","transclude","$inject","controller","RevealPasswordComponent","twoFactorAuthenticationConfiguration","showRememberDevice","onVerifyCode","onAlternativeOptionSelected","useSingleTextBox","onRedirectWhenTokenExpired","isTwilioServiceEnabled","isSmsServiceEnabled","isVoiceServiceEnabled","isVerifyApiServiceEnabled","isSmsVoiceServiceEnabled","AuthenticationMethod","AuthApp","Voice","SMS","VerifyTwoFactorAuthenticationController","$window","RedirectToLoginService","ALERT_TYPE","AuthenticationMethods","enterCodeDescriptionText","showVerificationModal","showHavingTroubleModal","showHavingTroubleLink","isCodeExpiredOrIncorrect","isCodeExpired","codeNotEntered","isTooManyAttempts","twoFactorAuthenticationOptions","rememberMyDevice","twoFactorUserSettings","AuthAppVerificationCode","isAllPhoneServicesDown","isSmsServiceDown","isVoiceServiceDown","showSmsServiceDown","DefaultAuthorizationMethod","showVoiceServiceDown","showAllPhoneServicesDown","codeExpiredOrIncorrectMsg","codeExpiredMsg","codeNotEnteredMsg","codeTooManyAttemptsMsg","$onInit","getCodeSentDescriptionText","PrimaryPhoneExtension","PrimaryPhone","areAlternativeOptionsForTwoFactorAuthenticationAvailable","SecondaryPhone","onOverlayClick","onCancelClick","redirectToLoginPage","redirect","twoFactorAuthCodeEnterPressed","verifyCode","twoFactorAuthCodeChanged","evalCodeValidity","isCodeValid","isToManyAttempts","verificationCode","rememberDevice","onCodeVerifiedCallback","tryAgain","onHavingTroubleClick","loadAuthenticationOptions","phoneCallText","textMessageText","detailsForVoiceCall","push","title","provider","details","iconClass","phoneNumber","phoneExtension","primaryPhoneNumber","IsAuthAppEnabled","SecondaryPhoneExtension","askForCode","onClickAlternativeOption","option","getCodeSentDescriptionTextForSelectedOption","onSuccessCallback","VerifyTwoFactorAuthenticationComponent","TwoFactorAuthenticationConstants","TwoFactorAuthenticationMethod","NotYetRegistered","module","exports"],"sourceRoot":"webpack:///","sources":["./manager-base/components/reveal-password/reveal-password.js","./public/shared/components/verify-two-factor-authentication/verify-two-factor-authentication.js","./public/shared/constants/two-factor-authentication.js","./manager-base/components/reveal-password/reveal-password.html","./public/shared/components/verify-two-factor-authentication/verify-two-factor-authentication.html"],"sourcesContent":["/**\r\n * @ngdoc directive\r\n * @name bdRevealPassword\r\n * @restrict E\r\n * \r\n */\r\nimport templateHtml from './reveal-password.html';\r\n\r\nimport { $safeApply } from '@buildium/angularjs-core/dist/utilities/angularjs';\r\n\r\nconst component = {};\r\n\r\ncomponent.template = templateHtml;\r\n\r\ncomponent.bindings = {\r\n};\r\n\r\ncomponent.controllerAs = 'vm';\r\ncomponent.transclude = true;\r\n\r\nfunction RevealPasswordController($scope, $element, BdLocalize) {\r\n const vm = this;\r\n \r\n vm.isShowingPassword = false;\r\n vm.showPasswordText = null;\r\n vm.hidePasswordText = null;\r\n vm.isPasswordManagerIconVisible = false;\r\n vm.isRevealEnabled = true;\r\n \r\n vm.togglePassword = function togglePassword() {\r\n vm.isShowingPassword = !vm.isShowingPassword;\r\n vm.input.attr('type', vm.isShowingPassword ? 'text' : 'password');\r\n };\r\n\r\n // $postLink is needed because of the transclusion\r\n vm.$postLink = function postLink() {\r\n vm.input = $element.find('input');\r\n \r\n vm.showPasswordText = BdLocalize.getString(\r\n 'Global.Component.RevealPassword.Tooltip.Show', 'Show'\r\n );\r\n\r\n vm.hidePasswordText = BdLocalize.getString(\r\n 'Global.Component.RevealPassword.Tooltip.Hide', 'Hide'\r\n );\r\n\r\n let observer = new MutationObserver(function onInputMutated() {\r\n //mutations.forEach((mutation) => console.log(mutation));\r\n vm.isPasswordManagerIconVisible = vm.input[0].style.backgroundImage !== '';\r\n if (vm.isPasswordManagerIconVisible) { // Stop watching once this is set to true\r\n observer.disconnect();\r\n observer = null;\r\n $safeApply($scope);\r\n }\r\n });\r\n\r\n observer.observe(vm.input[0], {\r\n attributes: true,\r\n childList: true,\r\n characterData: true\r\n });\r\n };\r\n\r\n // set the input back to a password field when the form is submitted\r\n $scope.$on('form-submit-started', () => {\r\n vm.isShowingPassword = false;\r\n vm.input.attr('type', 'password');\r\n });\r\n}\r\n\r\nRevealPasswordController.$inject = ['$scope', '$element', 'BdLocalize'];\r\ncomponent.controller = RevealPasswordController;\r\nexport const RevealPasswordComponent = component;\r\n","import templateHtml from './verify-two-factor-authentication.html';\r\n\r\nconst component = {};\r\n\r\ncomponent.template = templateHtml;\r\n\r\ncomponent.bindings = {\r\n twoFactorAuthenticationConfiguration: '<',\r\n showRememberDevice: '<',\r\n onVerifyCode: '&',\r\n onAlternativeOptionSelected: '&',\r\n useSingleTextBox: '<',\r\n onRedirectWhenTokenExpired: '&',\r\n isTwilioServiceEnabled: '<',\r\n isSmsServiceEnabled: '<',\r\n isVoiceServiceEnabled: '<',\r\n isVerifyApiServiceEnabled: '<',\r\n isSmsVoiceServiceEnabled: '<',\r\n};\r\n\r\nconst AuthenticationMethod = {\r\n AuthApp: 3,\r\n Voice: 2,\r\n SMS: 1,\r\n};\r\n\r\ncomponent.controllerAs = 'vm';\r\n\r\nfunction VerifyTwoFactorAuthenticationController(\r\n $window,\r\n BdLocalize,\r\n RedirectToLoginService,\r\n ALERT_TYPE\r\n) {\r\n const vm = this;\r\n\r\n vm.AuthenticationMethods = AuthenticationMethod;\r\n vm.enterCodeDescriptionText = '';\r\n vm.showVerificationModal = true;\r\n vm.showHavingTroubleModal = false;\r\n vm.showHavingTroubleLink = true;\r\n vm.isCodeExpiredOrIncorrect = false;\r\n vm.isCodeExpired = false;\r\n vm.codeNotEntered = false;\r\n vm.isTooManyAttempts = false;\r\n vm.twoFactorAuthenticationOptions = [];\r\n vm.rememberMyDevice = false;\r\n vm.twoFactorUserSettings = {\r\n AuthAppVerificationCode: null\r\n };\r\n \r\n vm.isAllPhoneServicesDown = !vm.isSmsServiceEnabled && !vm.isVoiceServiceEnabled && !vm.isVerifyApiServiceEnabled;\r\n vm.isSmsServiceDown = !vm.isSmsServiceEnabled && !vm.isVerifyApiServiceEnabled;\r\n vm.isVoiceServiceDown = !vm.isVoiceServiceEnabled && !vm.isVerifyApiServiceEnabled;\r\n \r\n vm.showSmsServiceDown = vm.isSmsServiceDown && !vm.isVoiceServiceDown && vm.twoFactorAuthenticationConfiguration.DefaultAuthorizationMethod === 1 && !vm.isSmsVoiceServiceEnabled;\r\n vm.showVoiceServiceDown = vm.isVoiceServiceDown && !vm.isSmsServiceDown && vm.twoFactorAuthenticationConfiguration.DefaultAuthorizationMethod === 2 && !vm.isSmsVoiceServiceEnabled;\r\n vm.showAllPhoneServicesDown = vm.isSmsServiceDown && vm.isVoiceServiceDown && vm.twoFactorAuthenticationConfiguration.DefaultAuthorizationMethod !== 3 && !vm.isSmsVoiceServiceEnabled;\r\n\r\n vm.ALERT_TYPE = ALERT_TYPE;\r\n vm.codeExpiredOrIncorrectMsg = BdLocalize.getString('Public.Login.TwoFactorAuthentication.VerificationCodeErrorMessage', 'Your authentication code expired or was incorrect.');\r\n vm.codeExpiredMsg = BdLocalize.getString('Public.Login.TwoFactorAuthentication.ResetLinkHasExpired', 'Oops, two-factor authentication has been interrupted. Please try again.');\r\n vm.codeNotEnteredMsg = BdLocalize.getString('Public.Login.TwoFactorAuthentication.VerificationCodeRequiredErrorMessage', 'You must enter an authentication code.');\r\n vm.codeTooManyAttemptsMsg = BdLocalize.getString('Public.Login.Login.TooManyMfaAttempts', 'Sorry, we couldn\\'t verify your identity. Please try again later.');\r\n \r\n function getCodeSentDescriptionText() {\r\n if (vm.twoFactorAuthenticationConfiguration.DefaultAuthorizationMethod === AuthenticationMethod.AuthApp) {\r\n // The user has an authenticator app as default authorization method.\r\n return BdLocalize.getString('Public.Login.TwoFactorAuthentication.AuthAppVerifyIdentityActionDescription',\r\n 'Check your authentication app for a code to sign in.');\r\n }\r\n\r\n if (vm.twoFactorAuthenticationConfiguration.DefaultAuthorizationMethod === AuthenticationMethod.Voice) {\r\n // The user has voice call as default authorization method.\r\n if (vm.twoFactorAuthenticationConfiguration.PrimaryPhoneExtension) {\r\n // A phone extension has been configured.\r\n return BdLocalize.getString('Public.Login.TwoFactorAuthentication.ExtensionDetails',\r\n `We called ${vm.twoFactorAuthenticationConfiguration.PrimaryPhone}, \r\n Ext.${vm.twoFactorAuthenticationConfiguration.PrimaryPhoneExtension} to provide you with an authentication code.`,\r\n [vm.twoFactorAuthenticationConfiguration.PrimaryPhone, vm.twoFactorAuthenticationConfiguration.PrimaryPhoneExtension]);\r\n } else {\r\n // No phone extension has been configured.\r\n return BdLocalize.getString('Public.Login.TwoFactorAuthentication.PhoneCallVerifyIdentityActionDescription',\r\n `We called ${vm.twoFactorAuthenticationConfiguration.PrimaryPhone} to provide you with an authentication code.`,\r\n [vm.twoFactorAuthenticationConfiguration.PrimaryPhone]);\r\n }\r\n }\r\n\r\n // If we reach this point then the user has text message as default authorization method.\r\n return BdLocalize.getString('Public.Login.TwoFactorAuthentication.TextMessageIdentityActionDescription',\r\n `We sent a text message with an authentication code to ${vm.twoFactorAuthenticationConfiguration.PrimaryPhone}`,\r\n [vm.twoFactorAuthenticationConfiguration.PrimaryPhone]);\r\n }\r\n\r\n function areAlternativeOptionsForTwoFactorAuthenticationAvailable() {\r\n // If the user has either a primary phone number or a secondary phone number configured\r\n // then we can provide alternative options for two factor authentication.\r\n return vm.twoFactorAuthenticationConfiguration\r\n && (vm.twoFactorAuthenticationConfiguration.PrimaryPhone || vm.twoFactorAuthenticationConfiguration.SecondaryPhone);\r\n }\r\n\r\n vm.$onInit = function onInit() {\r\n vm.enterCodeDescriptionText = getCodeSentDescriptionText();\r\n vm.showHavingTroubleLink = areAlternativeOptionsForTwoFactorAuthenticationAvailable();\r\n };\r\n\r\n vm.onOverlayClick = function onOverlayClick() {\r\n // Do nothing here. We don't want users to be able to close the modals when clicking outside them.\r\n };\r\n\r\n function redirectToLoginPage() {\r\n RedirectToLoginService.redirect();\r\n }\r\n\r\n vm.onCancelClick = function onCancelClick() {\r\n redirectToLoginPage();\r\n };\r\n\r\n vm.twoFactorAuthCodeEnterPressed = function twoFactorAuthCodeEnterPressed() {\r\n if (!vm.isCodeExpired) {\r\n vm.verifyCode();\r\n }\r\n };\r\n\r\n vm.twoFactorAuthCodeChanged = function twoFactorAuthCodeChanged() {\r\n vm.isCodeExpiredOrIncorrect = false;\r\n };\r\n\r\n vm.evalCodeValidity = function evalCodeValidity(isCodeValid, isCodeExpired, isToManyAttempts) {\r\n if (isCodeExpired) {\r\n vm.isCodeExpired = true;\r\n vm.isCodeExpiredOrIncorrect = false;\r\n } else if (isToManyAttempts) {\r\n vm.isCodeExpired = false;\r\n vm.isCodeExpiredOrIncorrect = false;\r\n vm.isTooManyAttempts = true;\r\n } else {\r\n vm.isCodeExpiredOrIncorrect = isCodeValid === false;\r\n vm.isCodeExpired = false;\r\n vm.isTooManyAttempts = false;\r\n }\r\n };\r\n\r\n vm.verifyCode = function verifyCode() {\r\n if (vm.twoFactorUserSettings.AuthAppVerificationCode) {\r\n vm.codeNotEntered = false;\r\n\r\n vm.onVerifyCode(\r\n {\r\n verificationCode: vm.twoFactorUserSettings.AuthAppVerificationCode,\r\n rememberDevice: vm.rememberMyDevice,\r\n onCodeVerifiedCallback: vm.evalCodeValidity\r\n });\r\n } else {\r\n vm.codeNotEntered = true;\r\n }\r\n };\r\n\r\n vm.tryAgain = function tryAgain() {\r\n vm.codeNotEntered = false;\r\n vm.onRedirectWhenTokenExpired();\r\n };\r\n\r\n function loadAuthenticationOptions() {\r\n vm.twoFactorAuthenticationOptions = [];\r\n\r\n const phoneCallText = BdLocalize.getString('Public.Login.TwoFactorAuthentication.PhoneCallLabel', 'Phone call');\r\n const textMessageText = BdLocalize.getString('Public.Login.TwoFactorAuthentication.TextMessageLabel', 'Text message');\r\n\r\n if (vm.twoFactorAuthenticationConfiguration.PrimaryPhone) {\r\n // The user has a primary phone number configured. We must add the primary phone options.\r\n let detailsForVoiceCall = vm.twoFactorAuthenticationConfiguration.PrimaryPhone;\r\n\r\n if (vm.twoFactorAuthenticationConfiguration.PrimaryPhoneExtension) {\r\n detailsForVoiceCall = BdLocalize.getString('Global.Component.Settings.Security.TwoFactorAuthentication.DeliveryMethod.ShortPhoneExtension',\r\n `${vm.twoFactorAuthenticationConfiguration.PrimaryPhone}, Ext. ${vm.twoFactorAuthenticationConfiguration.PrimaryPhoneExtension}`,\r\n [vm.twoFactorAuthenticationConfiguration.PrimaryPhone, vm.twoFactorAuthenticationConfiguration.PrimaryPhoneExtension]);\r\n }\r\n\r\n if (vm.isVoiceServiceEnabled || vm.isVerifyApiServiceEnabled || vm.isSmsVoiceServiceEnabled) {\r\n vm.twoFactorAuthenticationOptions.push({\r\n title: phoneCallText,\r\n provider: 'Voice',\r\n details: detailsForVoiceCall,\r\n iconClass: 'verify-two-factor-authentication__having-trouble-image--phone-call',\r\n phoneNumber: vm.twoFactorAuthenticationConfiguration.PrimaryPhone,\r\n phoneExtension: vm.twoFactorAuthenticationConfiguration.PrimaryPhoneExtension,\r\n primaryPhoneNumber: true\r\n });\r\n }\r\n\r\n if (vm.isSmsServiceEnabled || vm.isVerifyApiServiceEnabled || vm.isSmsVoiceServiceEnabled) {\r\n vm.twoFactorAuthenticationOptions.push({\r\n title: textMessageText,\r\n provider: 'SMS',\r\n details: vm.twoFactorAuthenticationConfiguration.PrimaryPhone,\r\n iconClass: 'verify-two-factor-authentication__having-trouble-image--text-message',\r\n phoneNumber: vm.twoFactorAuthenticationConfiguration.PrimaryPhone,\r\n primaryPhoneNumber: true\r\n });\r\n }\r\n }\r\n\r\n if (vm.twoFactorAuthenticationConfiguration.IsAuthAppEnabled) {\r\n // The user has an authenticator app configured. We must add the option.\r\n vm.twoFactorAuthenticationOptions.push({\r\n title: BdLocalize.getString('Public.Login.TwoFactorAuthentication.AuthenticationAppLabel', 'Authentication app'),\r\n provider: 'AuthApp',\r\n details: 'Check your authentication app for a code to sign in.',\r\n iconClass: 'verify-two-factor-authentication__having-trouble-image--auth-app'\r\n });\r\n }\r\n\r\n if (vm.twoFactorAuthenticationConfiguration.SecondaryPhone) {\r\n // The user has a secondary phone number configured. We must add the secondary phone options.\r\n let detailsForVoiceCall = vm.twoFactorAuthenticationConfiguration.SecondaryPhone;\r\n\r\n if (vm.twoFactorAuthenticationConfiguration.SecondaryPhoneExtension) {\r\n detailsForVoiceCall = BdLocalize.getString('Global.Component.Settings.Security.TwoFactorAuthentication.DeliveryMethod.ShortPhoneExtension',\r\n `${vm.twoFactorAuthenticationConfiguration.SecondaryPhone}, Ext. ${vm.twoFactorAuthenticationConfiguration.SecondaryPhoneExtension}`,\r\n [vm.twoFactorAuthenticationConfiguration.SecondaryPhone, vm.twoFactorAuthenticationConfiguration.SecondaryPhoneExtension]);\r\n }\r\n\r\n vm.twoFactorAuthenticationOptions.push({\r\n title: phoneCallText,\r\n provider: 'Voice',\r\n details: detailsForVoiceCall,\r\n iconClass: 'verify-two-factor-authentication__having-trouble-image--phone-call',\r\n phoneNumber: vm.twoFactorAuthenticationConfiguration.SecondaryPhone,\r\n phoneExtension: vm.twoFactorAuthenticationConfiguration.SecondaryPhoneExtension,\r\n primaryPhoneNumber: false\r\n });\r\n\r\n vm.twoFactorAuthenticationOptions.push({\r\n title: textMessageText,\r\n provider: 'SMS',\r\n details: vm.twoFactorAuthenticationConfiguration.SecondaryPhone,\r\n iconClass: 'verify-two-factor-authentication__having-trouble-image--text-message',\r\n phoneNumber: vm.twoFactorAuthenticationConfiguration.SecondaryPhone,\r\n primaryPhoneNumber: false\r\n });\r\n }\r\n }\r\n\r\n vm.onHavingTroubleClick = function onHavingTroubleClick() {\r\n loadAuthenticationOptions();\r\n vm.showVerificationModal = false;\r\n vm.showHavingTroubleModal = true;\r\n };\r\n\r\n vm.askForCode = function askForCode() {\r\n vm.showVerificationModal = true;\r\n vm.showHavingTroubleModal = false;\r\n };\r\n\r\n function getCodeSentDescriptionTextForSelectedOption(option) {\r\n if (option.phoneNumber) {\r\n // An option with a phone number was selected.\r\n if (option.provider === 'SMS') {\r\n return BdLocalize.getString('Public.Login.TwoFactorAuthentication.TextMessageIdentityActionDescription',\r\n `We sent a text message with an authentication code to ${option.phoneNumber}`,\r\n [option.phoneNumber]);\r\n } else if (option.phoneExtension) {\r\n return BdLocalize.getString('Public.Login.TwoFactorAuthentication.ExtensionDetails',\r\n `We called ${option.phoneNumber}, \r\n Ext.${option.phoneExtension} to provide you with an authentication code.`,\r\n [option.phoneNumber, option.phoneExtension]);\r\n } else {\r\n return BdLocalize.getString('Public.Login.TwoFactorAuthentication.PhoneCallVerifyIdentityActionDescription',\r\n `We called ${option.phoneNumber} to provide you with an authentication code.`,\r\n [option.phoneNumber]);\r\n }\r\n }\r\n\r\n return BdLocalize.getString('Public.Login.TwoFactorAuthentication.AuthAppVerifyIdentityActionDescription',\r\n 'Check your authentication app for a code to sign in.');\r\n }\r\n\r\n vm.onClickAlternativeOption = function onClickAlternativeOption(option) {\r\n vm.enterCodeDescriptionText = getCodeSentDescriptionTextForSelectedOption(option);\r\n if (option.phoneNumber) {\r\n // We only send a code when a phone option is selected.\r\n vm.onAlternativeOptionSelected({option, onSuccessCallback: vm.askForCode});\r\n } else {\r\n // An authenticator app was selected.\r\n vm.askForCode();\r\n }\r\n };\r\n}\r\n\r\nVerifyTwoFactorAuthenticationController.$inject = [\r\n '$window',\r\n 'BdLocalize',\r\n 'RedirectToLoginService',\r\n 'ALERT_TYPE'\r\n];\r\ncomponent.controller = VerifyTwoFactorAuthenticationController;\r\nexport const VerifyTwoFactorAuthenticationComponent = component;\r\n","export const TwoFactorAuthenticationConstants = {\r\n TwoFactorAuthenticationMethod: {\r\n NotYetRegistered: 0,\r\n SMS: 1,\r\n Voice: 2,\r\n AuthApp: 3\r\n }\r\n};\r\n","module.exports = \"