{"version":3,"sources":["webpack:///./js/LoginPage/LoginPaginatedPasswordViewModel.js","webpack:///./js/Core/GetRecoveryCredentialTypeHelpers.js","webpack:///./html/LoginPage/ConvergedLoginPaginatedPasswordViewHtml.html"],"names":["ko","require","Constants","Browser","ComponentEvent","GetRecoveryCredentialTypeRequestHelper","Helpers","KnockoutExtenders","PlaceholderTextbox","ClientTracingHelper","getInstance","window","ServerData","ClientTracingConstants","LoginConstants","BrandingHelpers","Promise","PromiseHelpers","Otc","GetOneTimeCodeHelper","TelemetryFactory","w","StringHelpers","String","PaginatedState","LoginMode","CredentialType","EstsError","BrowserHelper","Helper","GrctResultAction","LoginPasswordViewModel","params","_this","this","_serverData","serverData","_serverError","serverError","_isInitialView","isInitialView","_username","username","_displayName","displayName","_hipRequiredForUsername","hipRequiredForUsername","_passwordBrowserPrefill","passwordBrowserPrefill","_availableCreds","availableCreds","_evictedCreds","evictedCreds","_defaultKmsiValue","defaultKmsiValue","_userTenantBranding","userTenantBranding","_sessions","sessions","_callMetadata","callMetadata","_flowToken","flowToken","_useEvictedCredentials","useEvictedCredentials","_showCredViewBrandingDesc","showCredViewBrandingDesc","_supportsNativeCredentialRecovery","supportsNativeCredentialRecovery","_forgotPasswordText","forgotPasswordText","_accessRecoveryLink","accessRecoveryLink","_boilerPlateText","boilerPlateText","_hideAccountResetCredentials","hideAccountResetCredentials","_telemetry","_directedRecoveryContinuationToken","directedRecoveryContinuationToken","_directedRecoveryUrl","directedRecoveryUrl","_isEligibleForV2Recovery","isEligibleForV2Recovery","_strings","str","_loginMode","iLoginMode","_urlHIPScript","urlHIPScript","_appName","sRemoteConnectAppName","_allowCancel","fAllowCancel","_switchUrl","urlSwitch","_skipZtdUrl","urlSkipZtd","_lockUsername","fLockUsername","_showSwitchUser","fShowSwitchUser","_isForceSigninPost","fPOST_ForceSignin","_ztdFriendlyName","sZtdFriendlyName","_ztdTenantName","sZtdTenantName","_ztdUpnHint","sZtdUpnHint","_showButtons","fShowButtons","_errorCode","sErrorCode","_showHipOnNewView","fShowHipOnNewView","_unauthSessionId","fLogSkipToOfflineAccountAction","fHideOfflineAccountWithNoSkipString","sUnauthSessionID","_lcid","iRequestLCID","_siteId","sSiteId","_clientId","sClientId","_forwardedClientId","sForwardedClientId","_noPaBubbleVersion","sNoPaBubbleVersion","_shouldSupportTargetCredentialForRecovery","fShouldSupportTargetCredentialForRecovery","_resetPasswordUrl","urlResetPassword","_fixUrlResetPassword","fFixUrlResetPassword","_enableLivePreview","fEnableLivePreview","_deprecateHipLockout","fDeprecateHipLockout","_blockSubmit","_nextOtcCredential","_isEvictedAccountClicked","_isHipRequired","_getOneTimeCodeState","_grctRequestHelper","_grctResultSharedData","_nativeRecoveryCredentialsLoaded","_validationEnabled","observable","_getCredentialRecoveryTypeError","_submit","onSubmitReady","_setBackButtonVisible","visible","isBackButtonVisible","onSetBackButtonState","_handleGetOneTimeCodeSuccess","result","getResponseJson","success","userCode","UserCode","deviceCode","SessionLookupKey","_handleGetOneTimeCodeError","setDefaultFocus","onSwitchView","create","onResetPassword","getDefaultEventTracingOptions","ClientTracingEventIds","ComponentEvent_LoginPaginatedPasswordView_onResetPassword","onRedirect","onSetPendingRequest","onUpdateFlowToken","onRestoreIsRecoveryAttemptPost","passwordTextbox","pureComputed","error","value","extend","logValue","getPasswordTextBoxPropertyLogOption","eventId","PropertyValue_LoginPaginatedPasswordView_Password","getPropertyLogOption","PropertyValue_LoginPaginatedPasswordView_ClientError","hipInterface","isKmsiChecked","PropertyValue_LoginPaginatedPasswordView_KMSI","isRequestPending","unsafe_username","showTileLogo","secondaryButtonText","showPassword","shouldHipInit","tenantBranding","unsafe_displayName","unsafe_passwordAriaLabel","hasRemoteNgc","allowPhoneDisambiguation","unsafe_pageDescription","unsafe_pageTitle","unsafe_skipZTDLinkText","showHipOnPasswordView","showChangeUserLink","hideForgotMyPassword","unsafe_forgotPasswordText","hidePasswordReset","resetPasswordUrl","attachViewLoadClientTracingOptions","Event_LoginPaginatedPasswordView_onLoad","saveSharedData","sharedData","getOneTimeCodeResult","remoteNgcParams","requestSent","password","remoteLoginUserCode","remoteLoginDeviceCode","targetCredentialForRecovery","Password","None","isRecoveryAttemptPost","otcCredential","recoveryCredentialsData","getState","grctRequestHelperState","restoreState","state","focused","primaryButton_onClick","enableValidation","set","viewId","post","getError","focus","verify","Hip","secondaryButton_onClick","Previous","phoneDisambiguation_onClick","PhoneDisambiguation","resetPassword_onClick","continuationToken","htmlUnescape","throwUnhandledExceptionOnRejection","sendAsync","then","grctResult","action","ShowError","SwitchView","utils","viewParams","selectAccount_onClick","url","eventOptions","EventIds","Redriect_SwitchUser","length","Tiles","Username","hip_onHipLoad","skip_onClick","switchToRemoteNGC_onClick","RemoteNGC","skipZtd_onClick","Redirect_SkipZeroTouch","privacy_onClick","ViewAgreement","tileLogo_onLoad","desktopSso_onSuccess","switchToEvictedCredPicker_onClick","CredentialPicker","credSwitchLink_onSwitchView","replaceHistory","credSwitchLink_onSetPendingRequest","pending","credSwitchLink_onUpdateFlowToken","token","remoteLogin_onClick","purpose","Purpose","XboxRemoteConnect","resolve","reject","unauthSessionId","lcid","siteId","clientId","forwardedClientId","noPaBubbleVersion","successCallback","failureCallback","sendRequest","_getOneTimeCodeOtcHelperAsync","RemoteLoginPolling","preventExternalWrite","isEmailAddress","isSkypeName","isPhoneNumber","arrayFirst","credential","credType","format","ForceSignin","ForceSigninMobile","ForceSigninHost","errorCode","SsoArtifactExpiredDueToConditionalAccess","SsoArtifactExpiredDueToConditionalAccessReAuth","_getUnsafePageDescriptionByEstsError","unsafe_tenantName","subscribe","setTimeout","layoutTemplateConfig","getLayoutTemplateConfig","ForgotPasswordText","AccessRecoveryLink","applyExtenders","components","register","viewModel","template","synchronous","iMaxStackForKnockoutAsyncComponents","isStackSizeGreaterThan","enableExtensions","module","exports","ApiRequest","ObjectHelpers","Object","ApiErrorCodes","GrctRequestHelperFlags","DisableAutoSend","flags","_cache","_disableAutoSend","_checkApiCanary","fCheckApiCanary","_getRecoveryCredentialTypeUrl","urlGetRecoveryCredentialType","_userProofData","arrProofData","_isRestrictedWsi","fIsRestrictedWsi","_buildOtcProofStrings","proof","type","_handleGetRecoveryCredentialTypeError","response","code","AuthFailure","_getGrctResultShowErrorAction","TenantDoesNotSupportNativeCredentialRecovery","UserDoesNotSupportNativeCredentialRecovery","CredentialDoesNotSupportNativeRecovery","FlowToken","_getPreferredCredential","credentials","Credentials","preferredCredential","PrefCredential","_getGrctResultSwitchViewAction","isBlockingError","bypassCache","targetCredential","unsafe_cleansedUsername","cleanseUsername","cachedResponse","grctPromise","checkApiCanary","Json","Api_GetRecoveryCredentialType","DefaultRequestTimeout","_callGetRecoveryCredentialTypeAsync","all","results","getGrctSharedData","HasPassword","HasGoogleFed","HasCertAuth","HasFido","HasRemoteNGC","HasPhone","HasFacebookFed","AccessPass","MoreInfo","OneTimeCode","paginatedState","OneTimeCodeRecovery","ConfirmSend","_getUsernameFoundGrctResult","_parseGetRecoveryCredentialTypeResponse","cache","availableRecoveryCreds","PROOF","Type","Email","otcCredentials","display","data","otcSent","isEncrypted","isDefault","isNopa","push","_buildOtcCredentials","Array","forEach","concat","_getAvailableCreds","first","otcParams","PostType","PasswordInline","LoginOption","RememberPWD","NothingChecked"],"mappings":";;;;;;;;;;;;;8EAEA,IAAIA,EAAKC,EAAQ,GACbC,EAAYD,EAAQ,GACpBE,EAAUF,EAAQ,GAClBG,EAAiBH,EAAQ,GACzBI,EAAyCJ,EAAQ,KACjDK,EAAUL,EAAQ,GAClBM,EAAoBN,EAAQ,IAC5BO,EAAqBP,EAAQ,IAC7BQ,EAAsBR,EAAQ,IAA+BS,YAAYC,OAAOC,YAChFC,EAAyBZ,EAAQ,GACjCa,EAAiBb,EAAQ,GACzBc,EAAkBd,EAAQ,IAC1Be,EAAUf,EAAQ,GAClBgB,EAAiBhB,EAAQ,IACzBiB,EAAMjB,EAAQ,IACdkB,EAAuBlB,EAAQ,IAC/BmB,EAAmBnB,EAAQ,GAgB/B,IAAIoB,EAAI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AAQ,GAA+BsM,YAAYC,YAAc,MAAQ,EAAQ,GAA+BD,YAAYE,eAAiB,+vSAAipS,EAAQ,GAAqB5Y,eAAeoM,SAAW,u5E","file":"content/js/asyncchunk/convergedlogin_ppassword_f3050edc08586da986cf.js","sourcesContent":["\r\n\r\nvar ko = require(\"knockout\");\r\nvar Constants = require(\"../Core/Constants\");\r\nvar Browser = require(\"../Core/BrowserControl\");\r\nvar ComponentEvent = require(\"../Core/ComponentEvent\");\r\nvar GetRecoveryCredentialTypeRequestHelper = require(\"../Core/GetRecoveryCredentialTypeHelpers\");\r\nvar Helpers = require(\"../Core/Helpers\");\r\nvar KnockoutExtenders = require(\"../Core/KnockoutExtenders\");\r\nvar PlaceholderTextbox = require(\"../Core/PlaceholderTextbox\");\r\nvar ClientTracingHelper = require(\"../Core/ClientTracingHelper\").getInstance(window.ServerData);\r\nvar ClientTracingConstants = require(\"../Core/ClientTracingConstants\");\r\nvar LoginConstants = require(\"./LoginConstants\");\r\nvar BrandingHelpers = require(\"../Core/BrandingHelpers\");\r\nvar Promise = require(\"../Core/Promise\");\r\nvar PromiseHelpers = require(\"../Core/PromiseHelpers\");\r\nvar Otc = require(\"../Core/OtcRequestControl\");\r\nvar GetOneTimeCodeHelper = require(\"../Core/GetOneTimeCodeHelper\");\r\nvar TelemetryFactory = require(\"../Core/TelemetryFactory\");\r\nvar Host = null;\r\n\r\nif (__IS_CXH_ENABLED__)\r\n{\r\n Host = require(\"./Win10LoginHost\");\r\n}\r\nelse if (__IS_INCLUSIVE_OOBE__)\r\n{\r\n Host = require(\"./InclusiveWin10LoginHost\");\r\n}\r\nelse if (__IS_XBOX__)\r\n{\r\n Host = require(\"../Core/XboxHost\");\r\n}\r\n\r\nvar w = window;\r\nvar StringHelpers = Helpers.String;\r\nvar PaginatedState = Constants.PaginatedState;\r\nvar LoginMode = Constants.LoginMode;\r\nvar CredentialType = Constants.CredentialType;\r\nvar EstsError = Constants.EstsError;\r\nvar BrowserHelper = Browser.Helper;\r\nvar GrctResultAction = GetRecoveryCredentialTypeRequestHelper.GrctResultAction;\r\n\r\nKnockoutExtenders.applyExtenders(ko);\r\n\r\n\r\nfunction LoginPasswordViewModel(params)\r\n{\r\n var _this = this;\r\n\r\n \r\n var _serverData = params.serverData;\r\n var _serverError = params.serverError;\r\n var _isInitialView = params.isInitialView;\r\n var _username = params.username;\r\n var _displayName = params.displayName || \"\";\r\n var _hipRequiredForUsername = params.hipRequiredForUsername;\r\n var _passwordBrowserPrefill = params.passwordBrowserPrefill;\r\n var _availableCreds = params.availableCreds || [];\r\n var _evictedCreds = params.evictedCreds || [];\r\n var _defaultKmsiValue = params.defaultKmsiValue;\r\n var _userTenantBranding = params.userTenantBranding;\r\n var _sessions = params.sessions;\r\n var _callMetadata = params.callMetadata;\r\n var _flowToken = params.flowToken;\r\n var _useEvictedCredentials = params.useEvictedCredentials;\r\n var _showCredViewBrandingDesc = params.showCredViewBrandingDesc;\r\n var _supportsNativeCredentialRecovery = params.supportsNativeCredentialRecovery;\r\n var _forgotPasswordText = params.forgotPasswordText;\r\n var _accessRecoveryLink = params.accessRecoveryLink;\r\n var _boilerPlateText = params.boilerPlateText;\r\n var _hideAccountResetCredentials = params.hideAccountResetCredentials;\r\n var _telemetry = TelemetryFactory.getInstance(_serverData);\r\n var _directedRecoveryContinuationToken = params.directedRecoveryContinuationToken;\r\n var _directedRecoveryUrl = params.directedRecoveryUrl;\r\n var _isEligibleForV2Recovery = params.isEligibleForV2Recovery;\r\n\r\n \r\n var _strings = _serverData.str;\r\n var _loginMode = _serverData.iLoginMode;\r\n var _urlHIPScript = _serverData.urlHIPScript;\r\n var _appName = _serverData.sRemoteConnectAppName;\r\n var _allowCancel = _serverData.fAllowCancel;\r\n var _switchUrl = _serverData.urlSwitch;\r\n var _skipZtdUrl = _serverData.urlSkipZtd;\r\n var _lockUsername = _serverData.fLockUsername;\r\n var _showSwitchUser = _serverData.fShowSwitchUser;\r\n var _isForceSigninPost = _serverData.fPOST_ForceSignin;\r\n var _ztdFriendlyName = _serverData.sZtdFriendlyName;\r\n var _ztdTenantName = _serverData.sZtdTenantName;\r\n var _ztdUpnHint = _serverData.sZtdUpnHint;\r\n var _showButtons = _serverData.fShowButtons;\r\n var _errorCode = _serverData.sErrorCode;\r\n var _showHipOnNewView = _serverData.fShowHipOnNewView;\r\n var _logSkipToOfflineAccountAction = _serverData.fLogSkipToOfflineAccountAction;\r\n var _hideOfflineAccountWithNoSkipString = !!_serverData.fHideOfflineAccountWithNoSkipString;\r\n var _unauthSessionId = _serverData.sUnauthSessionID;\r\n var _lcid = _serverData.iRequestLCID;\r\n var _siteId = _serverData.sSiteId;\r\n var _clientId = _serverData.sClientId;\r\n var _forwardedClientId = _serverData.sForwardedClientId;\r\n var _noPaBubbleVersion = _serverData.sNoPaBubbleVersion;\r\n var _shouldSupportTargetCredentialForRecovery = _serverData.fShouldSupportTargetCredentialForRecovery;\r\n var _resetPasswordUrl = _serverData.urlResetPassword;\r\n var _fixUrlResetPassword = _serverData.fFixUrlResetPassword;\r\n var _enableLivePreview = _serverData.fEnableLivePreview;\r\n var _deprecateHipLockout = !!_serverData.fDeprecateHipLockout;\r\n\r\n \r\n var _blockSubmit = false;\r\n var _nextOtcCredential = null;\r\n var _isEvictedAccountClicked = false;\r\n var _isHipRequired = false;\r\n var _getOneTimeCodeState = {};\r\n var _grctRequestHelper = null;\r\n var _grctResultSharedData = {};\r\n var _nativeRecoveryCredentialsLoaded = false;\r\n\r\n var _validationEnabled = ko.observable(false);\r\n var _getCredentialRecoveryTypeError = ko.observable();\r\n\r\n \r\n _this.onSwitchView = ComponentEvent.create();\r\n _this.onSubmitReady = ComponentEvent.create();\r\n _this.onResetPassword = ComponentEvent.create(ClientTracingHelper.getDefaultEventTracingOptions(LoginConstants.ClientTracingEventIds.ComponentEvent_LoginPaginatedPasswordView_onResetPassword, true));\r\n _this.onRedirect = ComponentEvent.create();\r\n _this.onSetBackButtonState = ComponentEvent.create();\r\n _this.onSetPendingRequest = ComponentEvent.create();\r\n _this.onUpdateFlowToken = ComponentEvent.create();\r\n _this.onRestoreIsRecoveryAttemptPost = ComponentEvent.create();\r\n\r\n \r\n _this.passwordTextbox = new PlaceholderTextbox(ko.pureComputed(_getError), _passwordBrowserPrefill);\r\n _this.passwordTextbox.value.extend({ logValue: ClientTracingHelper.getPasswordTextBoxPropertyLogOption(_this, { eventId: LoginConstants.ClientTracingEventIds.PropertyValue_LoginPaginatedPasswordView_Password }) });\r\n _this.passwordTextbox.error.extend({ logValue: ClientTracingHelper.getPropertyLogOption(_this, { eventId: LoginConstants.ClientTracingEventIds.PropertyValue_LoginPaginatedPasswordView_ClientError }) });\r\n _this.hipInterface = ko.observable();\r\n _this.isKmsiChecked = ko.observable(_defaultKmsiValue).extend({ logValue: ClientTracingHelper.getPropertyLogOption(_this, { eventId: LoginConstants.ClientTracingEventIds.PropertyValue_LoginPaginatedPasswordView_KMSI }) });\r\n _this.isRequestPending = ko.observable(false);\r\n _this.unsafe_username = ko.observable();\r\n _this.showTileLogo = ko.observable(false);\r\n _this.isBackButtonVisible = ko.observable(false);\r\n _this.secondaryButtonText = ko.observable();\r\n _this.useEvictedCredentials = ko.observable(_useEvictedCredentials);\r\n _this.showPassword = ko.observable(false);\r\n _this.shouldHipInit = ko.observable(false);\r\n\r\n _this.tenantBranding = null;\r\n _this.unsafe_displayName = null;\r\n _this.username = _username;\r\n _this.unsafe_passwordAriaLabel = null;\r\n _this.hasRemoteNgc = false;\r\n _this.availableCreds = _availableCreds;\r\n _this.evictedCreds = _evictedCreds;\r\n _this.allowPhoneDisambiguation = false;\r\n _this.unsafe_pageDescription = null;\r\n _this.unsafe_pageTitle = null;\r\n _this.unsafe_skipZTDLinkText = null;\r\n _this.isInitialView = _isInitialView;\r\n _this.showHipOnPasswordView = false;\r\n _this.showChangeUserLink = false;\r\n _this.callMetadata = _callMetadata;\r\n _this.flowToken = _flowToken;\r\n _this.showCredViewBrandingDesc = _showCredViewBrandingDesc;\r\n _this.supportsNativeCredentialRecovery = _supportsNativeCredentialRecovery;\r\n _this.hideForgotMyPassword = false;\r\n _this.unsafe_forgotPasswordText = _strings[\"STR_SSSU_ForgotPassword\"] || _strings[\"CT_PWD_STR_ForgotPwdLink_Text\"];\r\n _this.hidePasswordReset = false;\r\n _this.accessRecoveryLink = null;\r\n _this.resetPasswordUrl = null;\r\n _this.boilerPlateText = null;\r\n ClientTracingHelper.attachViewLoadClientTracingOptions(_this, { eventId: LoginConstants.ClientTracingEventIds.Event_LoginPaginatedPasswordView_onLoad });\r\n\r\n \r\n _this.saveSharedData = function (sharedData)\r\n {\r\n var getOneTimeCodeResult = _getOneTimeCodeState.result;\r\n\r\n sharedData.remoteNgcParams.requestSent = false;\r\n sharedData.useEvictedCredentials = _isEvictedAccountClicked || _this.useEvictedCredentials();\r\n sharedData.password = _this.passwordTextbox.value();\r\n sharedData.showCredViewBrandingDesc = false;\r\n sharedData.remoteLoginUserCode = getOneTimeCodeResult ? getOneTimeCodeResult.userCode : null;\r\n sharedData.remoteLoginDeviceCode = getOneTimeCodeResult ? getOneTimeCodeResult.deviceCode : null;\r\n\r\n if (_shouldSupportTargetCredentialForRecovery)\r\n {\r\n sharedData.targetCredentialForRecovery = _nativeRecoveryCredentialsLoaded ? CredentialType.Password : CredentialType.None;\r\n }\r\n else\r\n {\r\n sharedData.isRecoveryAttemptPost = _nativeRecoveryCredentialsLoaded;\r\n }\r\n\r\n if (_nextOtcCredential)\r\n {\r\n sharedData.otcCredential = _nextOtcCredential;\r\n }\r\n\r\n if (_nativeRecoveryCredentialsLoaded)\r\n {\r\n sharedData.recoveryCredentialsData = _grctResultSharedData;\r\n }\r\n };\r\n\r\n _this.getState = function ()\r\n {\r\n var state =\r\n {\r\n isKmsiChecked: _this.isKmsiChecked(),\r\n useEvictedCredentials: _this.useEvictedCredentials(),\r\n grctRequestHelperState: _supportsNativeCredentialRecovery ? _grctRequestHelper.getState() : null\r\n };\r\n\r\n return state;\r\n };\r\n\r\n _this.restoreState = function (state)\r\n {\r\n if (state)\r\n {\r\n _this.isKmsiChecked(state.isKmsiChecked);\r\n _this.useEvictedCredentials(state.useEvictedCredentials);\r\n\r\n if (_supportsNativeCredentialRecovery)\r\n {\r\n _grctRequestHelper.restoreState(state.grctRequestHelperState);\r\n }\r\n }\r\n };\r\n\r\n _this.setDefaultFocus = function ()\r\n {\r\n _this.passwordTextbox.focused(true);\r\n };\r\n\r\n \r\n _this.primaryButton_onClick = function ()\r\n {\r\n var hipInterface = _this.hipInterface();\r\n\r\n if (_blockSubmit || _this.isRequestPending())\r\n {\r\n return;\r\n }\r\n\r\n _validationEnabled(true);\r\n\r\n if (hipInterface)\r\n {\r\n hipInterface.enableValidation();\r\n }\r\n\r\n if (_this.passwordTextbox.error() !== null)\r\n {\r\n _this.setDefaultFocus();\r\n return;\r\n }\r\n\r\n if (_telemetry)\r\n {\r\n _telemetry.set(\"LoginNextSubmit\", { viewId: \"Password\" });\r\n _telemetry.post(true);\r\n }\r\n\r\n if (hipInterface)\r\n {\r\n if (hipInterface.getError() !== null)\r\n {\r\n hipInterface.focus();\r\n return;\r\n }\r\n\r\n _blockSubmit = true;\r\n\r\n hipInterface.verify(\r\n function ()\r\n {\r\n _blockSubmit = false;\r\n _submit();\r\n });\r\n }\r\n else if (_isHipRequired && _showHipOnNewView)\r\n {\r\n _this.onSwitchView(PaginatedState.Hip);\r\n }\r\n else\r\n {\r\n _submit();\r\n }\r\n };\r\n\r\n _this.secondaryButton_onClick = function ()\r\n {\r\n _this.onSwitchView(PaginatedState.Previous);\r\n };\r\n\r\n _this.phoneDisambiguation_onClick = function ()\r\n {\r\n if (_telemetry)\r\n {\r\n _telemetry.set(\"LoginSwitchToPhoneDisambiguationClicked\", { viewId: \"Password\" });\r\n _telemetry.post(true);\r\n }\r\n\r\n _this.onSwitchView(PaginatedState.PhoneDisambiguation);\r\n };\r\n\r\n _this.resetPassword_onClick = function ()\r\n {\r\n if (_telemetry)\r\n {\r\n _telemetry.set(\"LoginForgotPasswordClicked\", { viewId: \"Password\" });\r\n _telemetry.post(true);\r\n }\r\n\r\n if (_isEligibleForV2Recovery)\r\n {\r\n _this.onRedirect(_directedRecoveryUrl, { continuationToken: _directedRecoveryContinuationToken });\r\n }\r\n\r\n else if (_supportsNativeCredentialRecovery)\r\n {\r\n var unsafe_displayName = BrowserHelper.htmlUnescape(_displayName);\r\n\r\n _this.isRequestPending(true);\r\n _this.onSetPendingRequest(true);\r\n\r\n PromiseHelpers.throwUnhandledExceptionOnRejection(\r\n _grctRequestHelper.sendAsync(unsafe_displayName, _flowToken, CredentialType.Password).then(\r\n function (grctResult)\r\n {\r\n _this.isRequestPending(false);\r\n _this.onSetPendingRequest(false);\r\n\r\n if (grctResult.flowToken)\r\n {\r\n _flowToken = grctResult.flowToken;\r\n _this.onUpdateFlowToken(grctResult.flowToken);\r\n }\r\n\r\n switch (grctResult.action)\r\n {\r\n case GrctResultAction.ShowError:\r\n _getCredentialRecoveryTypeError(grctResult.error);\r\n _this.setDefaultFocus();\r\n break;\r\n\r\n case GrctResultAction.SwitchView:\r\n _grctResultSharedData = ko.utils.extend(grctResult.sharedData, grctResult.viewParams || {});\r\n _nativeRecoveryCredentialsLoaded = true;\r\n _this.onSwitchView(grctResult.viewId);\r\n break;\r\n }\r\n }));\r\n }\r\n else\r\n {\r\n \r\n \r\n \r\n \r\n _this.onResetPassword(_displayName);\r\n }\r\n };\r\n\r\n _this.selectAccount_onClick = function ()\r\n {\r\n if (_telemetry)\r\n {\r\n _telemetry.set(\"LoginChangeUserClicked\", { viewId: \"Password\" });\r\n _telemetry.post(true);\r\n }\r\n\r\n if (_lockUsername && _switchUrl)\r\n {\r\n _this.onRedirect({ url: _switchUrl, eventOptions: { eventId: ClientTracingConstants.EventIds.Redriect_SwitchUser } });\r\n }\r\n else\r\n {\r\n _this.onSwitchView(_sessions.length ? PaginatedState.Tiles : PaginatedState.Username);\r\n }\r\n };\r\n\r\n _this.hip_onHipLoad = function ()\r\n {\r\n _this.isRequestPending(false);\r\n\r\n if (_this.passwordTextbox.error() !== null)\r\n {\r\n _this.setDefaultFocus();\r\n }\r\n };\r\n\r\n _this.skip_onClick = function ()\r\n {\r\n if (Host && Host.handleOnSkip)\r\n {\r\n Host.handleOnSkip(_serverData);\r\n _this.isRequestPending(true);\r\n }\r\n };\r\n\r\n \r\n _this.switchToRemoteNGC_onClick = function ()\r\n {\r\n _this.onSwitchView(PaginatedState.RemoteNGC);\r\n };\r\n\r\n \r\n _this.skipZtd_onClick = function ()\r\n {\r\n _this.onRedirect(\r\n {\r\n url: _skipZtdUrl,\r\n eventOptions:\r\n {\r\n eventId: ClientTracingConstants.EventIds.Redirect_SkipZeroTouch\r\n }\r\n });\r\n };\r\n\r\n _this.privacy_onClick = function ()\r\n {\r\n _this.onSwitchView(PaginatedState.ViewAgreement);\r\n };\r\n\r\n _this.tileLogo_onLoad = function ()\r\n {\r\n _this.showTileLogo(true);\r\n\r\n if (Host && Host.logEvent)\r\n {\r\n Host.logEvent(\"Identity.PasswordView.Branding.TileLogoLoaded\");\r\n }\r\n };\r\n\r\n _this.desktopSso_onSuccess = function ()\r\n {\r\n \r\n _this.onSubmitReady();\r\n };\r\n\r\n _this.switchToEvictedCredPicker_onClick = function ()\r\n {\r\n if (_telemetry)\r\n {\r\n _telemetry.set(\"LoginEvictedAccountClicked\", { viewId: \"Password\" });\r\n _telemetry.post(true);\r\n }\r\n\r\n _isEvictedAccountClicked = true;\r\n _this.onSwitchView(PaginatedState.CredentialPicker);\r\n };\r\n\r\n _this.credSwitchLink_onSwitchView = function (viewId, replaceHistory, otcCredential)\r\n {\r\n \r\n \r\n \r\n if (otcCredential)\r\n {\r\n _nextOtcCredential = otcCredential;\r\n }\r\n\r\n _this.onSwitchView(viewId, replaceHistory);\r\n };\r\n\r\n _this.credSwitchLink_onSetPendingRequest = function (pending)\r\n {\r\n _this.onSetPendingRequest(pending);\r\n _this.isRequestPending(pending);\r\n };\r\n\r\n _this.credSwitchLink_onUpdateFlowToken = function (token)\r\n {\r\n if (token)\r\n {\r\n _flowToken = token;\r\n _this.onUpdateFlowToken(token);\r\n }\r\n };\r\n\r\n _this.remoteLogin_onClick = function ()\r\n {\r\n PromiseHelpers.throwUnhandledExceptionOnRejection(\r\n _getOneTimeCodeAsync(Otc.Purpose.XboxRemoteConnect).then(\r\n function (result)\r\n {\r\n if (result.success)\r\n {\r\n _getOneTimeCodeState.result = result;\r\n _this.onSwitchView(PaginatedState.RemoteLoginPolling);\r\n }\r\n }));\r\n };\r\n\r\n \r\n function _getError()\r\n {\r\n var error;\r\n\r\n if (_getCredentialRecoveryTypeError())\r\n {\r\n return _getCredentialRecoveryTypeError();\r\n }\r\n\r\n if (!_validationEnabled())\r\n {\r\n error = _serverError || null;\r\n _serverError = null;\r\n return error;\r\n }\r\n\r\n return _this.passwordTextbox.value() ? null : _strings[\"CT_PWD_STR_Error_MissingPassword\"];\r\n }\r\n\r\n function _submit()\r\n {\r\n if (Host && Host.handleOnPasswordUpdate)\r\n {\r\n \r\n Host.handleOnPasswordUpdate(_this.passwordTextbox.value(), _serverData, _this.onSubmitReady);\r\n }\r\n else\r\n {\r\n _this.onSubmitReady();\r\n }\r\n }\r\n\r\n function _setBackButtonVisible(visible)\r\n {\r\n _this.isBackButtonVisible(visible);\r\n _this.onSetBackButtonState(_showButtons && visible );\r\n }\r\n\r\n function _getOneTimeCodeAsync(purpose)\r\n {\r\n var getOtcPromise = _getOneTimeCodeOtcHelperAsync(purpose);\r\n\r\n return getOtcPromise.then(_handleGetOneTimeCodeSuccess, _handleGetOneTimeCodeError);\r\n }\r\n\r\n function _getOneTimeCodeOtcHelperAsync(purpose)\r\n {\r\n return new Promise(\r\n function (resolve, reject)\r\n {\r\n var otcParams =\r\n {\r\n purpose: purpose,\r\n flowToken: _flowToken,\r\n unauthSessionId: _unauthSessionId,\r\n lcid: _lcid,\r\n siteId: _siteId,\r\n clientId: _clientId,\r\n forwardedClientId: _forwardedClientId,\r\n noPaBubbleVersion: _noPaBubbleVersion,\r\n successCallback: resolve,\r\n failureCallback: reject\r\n };\r\n\r\n var getOneTimeCodeHelper = new GetOneTimeCodeHelper(otcParams);\r\n getOneTimeCodeHelper.sendRequest();\r\n });\r\n }\r\n\r\n function _handleGetOneTimeCodeSuccess(result)\r\n {\r\n if (result.getResponseJson)\r\n {\r\n result = result.getResponseJson();\r\n }\r\n\r\n var getOtcResult =\r\n {\r\n success: true,\r\n userCode: result.UserCode,\r\n deviceCode: result.SessionLookupKey\r\n };\r\n\r\n return getOtcResult;\r\n }\r\n\r\n function _handleGetOneTimeCodeError()\r\n {\r\n _this.setDefaultFocus();\r\n\r\n return { success: false };\r\n }\r\n\r\n function _getUnsafePageDescriptionByEstsError(errorCode, unsafe_displayName)\r\n {\r\n switch (errorCode)\r\n {\r\n case EstsError.SsoArtifactExpiredDueToConditionalAccess:\r\n return _strings[\"WF_STR_ASLP_Info\"];\r\n case EstsError.SsoArtifactExpiredDueToConditionalAccessReAuth:\r\n return _strings[\"WF_STR_ReAuth_Info\"];\r\n default:\r\n return StringHelpers.format(_strings[\"WF_STR_ForceSI_Info\"], unsafe_displayName);\r\n }\r\n }\r\n\r\n (function _initialize()\r\n {\r\n \r\n \r\n var unsafe_displayName = BrowserHelper.htmlUnescape(_displayName);\r\n\r\n _this.unsafe_username(BrowserHelper.htmlUnescape(_username));\r\n\r\n \r\n \r\n \r\n _this.unsafe_displayName = ko.observable(unsafe_displayName).extend({ preventExternalWrite: null });\r\n\r\n _this.allowPhoneDisambiguation = !_lockUsername\r\n && !StringHelpers.isEmailAddress(_displayName)\r\n && !StringHelpers.isSkypeName(_displayName)\r\n && StringHelpers.isPhoneNumber(_displayName);\r\n\r\n _this.hasRemoteNgc = !!ko.utils.arrayFirst(\r\n _availableCreds,\r\n function (credential)\r\n {\r\n return credential.credType === CredentialType.RemoteNGC;\r\n });\r\n\r\n _isHipRequired = !!_urlHIPScript && (_username === _hipRequiredForUsername);\r\n _this.showHipOnPasswordView = _isHipRequired && !_showHipOnNewView && !_deprecateHipLockout;\r\n\r\n _this.showChangeUserLink = _showSwitchUser\r\n && ((_lockUsername && _switchUrl) || _isInitialView);\r\n\r\n _this.tenantBranding = _userTenantBranding;\r\n\r\n if (_appName && _isInitialView)\r\n {\r\n _this.unsafe_pageDescription = StringHelpers.format(_strings[\"CT_PWD_STR_RemoteConnect_PasswordPage_Desc\"], _appName, unsafe_displayName);\r\n }\r\n else if (_loginMode === LoginMode.ForceSignin\r\n || _loginMode === LoginMode.ForceSigninMobile\r\n || _loginMode === LoginMode.ForceSigninHost\r\n || _isForceSigninPost)\r\n {\r\n _this.unsafe_pageDescription = _getUnsafePageDescriptionByEstsError(_errorCode, unsafe_displayName);\r\n }\r\n else if (_strings[\"CT_PWD_STR_EnterPassword_Desc\"])\r\n {\r\n _this.unsafe_pageDescription = StringHelpers.format(_strings[\"CT_PWD_STR_EnterPassword_Desc\"], unsafe_displayName);\r\n }\r\n\r\n \r\n if (_ztdUpnHint && _ztdTenantName)\r\n {\r\n var unsafe_tenantName = BrowserHelper.htmlUnescape(_ztdTenantName);\r\n\r\n _this.unsafe_pageTitle = _ztdFriendlyName\r\n ? StringHelpers.format(_strings[\"CT_Win10_PwdWithOrgDomain_AndFriendlyName\"], BrowserHelper.htmlUnescape(_ztdFriendlyName), unsafe_tenantName)\r\n : StringHelpers.format(_strings[\"CT_Win10_STR_Pwd_Title_WithOrgDomain\"], unsafe_tenantName);\r\n\r\n _this.unsafe_skipZTDLinkText = StringHelpers.format(_strings[\"CT_Win10_STR_Pwd_StartOver_WithOrgDomain\"], unsafe_tenantName);\r\n }\r\n else\r\n {\r\n _this.unsafe_pageTitle = _strings[\"CT_PWD_STR_EnterYourPassword_Title\"];\r\n _this.unsafe_skipZTDLinkText = _strings[\"CT_Win10_STR_StartOver\"];\r\n }\r\n\r\n _this.unsafe_passwordAriaLabel = StringHelpers.format(_strings[\"CT_PWD_STR_PwdTB_AriaLabel\"], unsafe_displayName);\r\n\r\n if (_this.showHipOnPasswordView)\r\n {\r\n \r\n _this.isRequestPending(true);\r\n }\r\n\r\n if (Host)\r\n {\r\n if (Host.initializePasswordViewModel)\r\n {\r\n Host.initializePasswordViewModel(_this, _serverData);\r\n }\r\n\r\n if (Host.handleBackButton)\r\n {\r\n Host.handleBackButton(_this.secondaryButton_onClick.bind(_this));\r\n }\r\n\r\n if (Host.logEvent)\r\n {\r\n var hasBoilerPlateText = (_userTenantBranding && _userTenantBranding.BoilerPlateText) ? \"1\" : \"0\";\r\n Host.logEvent(\"Identity.PasswordView.Branding.HasBoilerPlateText\", hasBoilerPlateText);\r\n\r\n var hasTileLogo = (_userTenantBranding && _userTenantBranding.TileLogo) ? \"1\" : \"0\";\r\n Host.logEvent(\"Identity.PasswordView.Branding.HasTileLogo\", hasTileLogo);\r\n\r\n Host.logEvent(\"Identity.Flight.IsEnabledHideOfflineAccountWithNoSkipString\", _hideOfflineAccountWithNoSkipString);\r\n\r\n if (_logSkipToOfflineAccountAction)\r\n {\r\n \r\n var errorcode = _serverData.arrValErrs.length > 0 ? _serverData.arrValErrs[0] : \"\"; \r\n Host.logEvent(\"Identity.OOBE.Login.ErrorSkipToLocalVisible\", \"[ErrorCode] \" + errorcode);\r\n }\r\n }\r\n\r\n if (Host.showKeyboard)\r\n {\r\n Host.showKeyboard(true);\r\n }\r\n }\r\n\r\n _this.unsafe_displayName.subscribe(\r\n function ()\r\n {\r\n setTimeout(\r\n function ()\r\n {\r\n \r\n \r\n _this.passwordTextbox.value(null);\r\n }, 0);\r\n });\r\n\r\n \r\n \r\n if (_isInitialView)\r\n {\r\n if (Host && Host.isBackButtonSupportedOnInitialView)\r\n {\r\n Host.isBackButtonSupportedOnInitialView(_serverData,\r\n function (isSupported, useCancelText)\r\n {\r\n _setBackButtonVisible(isSupported);\r\n\r\n if (useCancelText)\r\n {\r\n _this.secondaryButtonText(_strings[\"CT_PWD_STR_Cancel_Button\"]);\r\n }\r\n });\r\n }\r\n else if (_allowCancel)\r\n {\r\n _setBackButtonVisible(true);\r\n }\r\n }\r\n else\r\n {\r\n _setBackButtonVisible(true);\r\n }\r\n\r\n if (_urlHIPScript && _this.showHipOnPasswordView)\r\n {\r\n if (__IS_OLD_WEBPACK__)\r\n {\r\n _this.shouldHipInit(true);\r\n return;\r\n }\r\n\r\n require.ensure([],\r\n function ()\r\n {\r\n require(\"js/Fields/HipFieldViewModel\");\r\n _this.shouldHipInit(true);\r\n },\r\n \"Alt\");\r\n }\r\n\r\n \r\n if (_userTenantBranding)\r\n {\r\n var layoutTemplateConfig = BrandingHelpers.getLayoutTemplateConfig(_userTenantBranding);\r\n\r\n if (_userTenantBranding.ForgotPasswordText)\r\n {\r\n _this.unsafe_forgotPasswordText = BrowserHelper.htmlUnescape(_userTenantBranding.ForgotPasswordText);\r\n }\r\n\r\n _this.accessRecoveryLink = _userTenantBranding.AccessRecoveryLink;\r\n\r\n _this.hideForgotMyPassword = layoutTemplateConfig.hideAccountResetCredentials;\r\n _this.hidePasswordReset = layoutTemplateConfig.hideAccountResetCredentials;\r\n }\r\n\r\n if (_supportsNativeCredentialRecovery)\r\n {\r\n _grctRequestHelper = new GetRecoveryCredentialTypeRequestHelper(_serverData);\r\n _this.onRestoreIsRecoveryAttemptPost();\r\n\r\n if (_fixUrlResetPassword)\r\n {\r\n _this.resetPasswordUrl = _this.accessRecoveryLink;\r\n }\r\n }\r\n else if (_fixUrlResetPassword)\r\n {\r\n _this.resetPasswordUrl = _this.accessRecoveryLink || _resetPasswordUrl;\r\n }\r\n\r\n if (_enableLivePreview)\r\n {\r\n _this.unsafe_forgotPasswordText = BrowserHelper.htmlUnescape(_forgotPasswordText());\r\n _this.accessRecoveryLink = _accessRecoveryLink;\r\n _this.hideForgotMyPassword = _hideAccountResetCredentials;\r\n _this.boilerPlateText = BrowserHelper.htmlUnescape(_boilerPlateText());\r\n }\r\n })();\r\n}\r\n\r\nko.components.register(\"login-paginated-password-view\",\r\n {\r\n viewModel: LoginPasswordViewModel,\r\n template: require(\"html/LoginPage/LoginPaginatedPasswordViewHtml.html\"),\r\n synchronous: !w.ServerData.iMaxStackForKnockoutAsyncComponents || Browser.Helper.isStackSizeGreaterThan(w.ServerData.iMaxStackForKnockoutAsyncComponents),\r\n enableExtensions: true\r\n });\r\n\r\nmodule.exports = LoginPasswordViewModel;","var Constants = require(\"./Constants\");\r\nvar Promise = require(\"./Promise\");\r\nvar Helpers = require(\"./Helpers\");\r\nvar ApiRequest = require(\"./ApiRequest\");\r\nvar ClientTracingConstants = require(\"./ClientTracingConstants\");\r\n\r\nvar StringHelpers = Helpers.String;\r\nvar ObjectHelpers = Helpers.Object;\r\nvar CredentialType = Constants.CredentialType;\r\nvar ApiErrorCodes = Constants.ApiErrorCodes;\r\nvar EstsError = Constants.EstsError;\r\nvar PaginatedState = Constants.PaginatedState;\r\n\r\n\r\nvar GrctResultAction = GetRecoveryCredentialTypeRequestHelper.GrctResultAction =\r\n{\r\n ShowError: 1,\r\n SwitchView: 2\r\n};\r\n\r\n\r\nvar GrctRequestHelperFlags = GetRecoveryCredentialTypeRequestHelper.GrctRequestHelperFlags =\r\n{\r\n DisableAutoSend: 1 << 0\r\n};\r\n\r\n\r\n\r\n\r\nfunction GetRecoveryCredentialTypeRequestHelper(serverData, flags)\r\n{\r\n \r\n var _this = this;\r\n\r\n var _cache = {};\r\n\r\n var _serverData = serverData;\r\n var _disableAutoSend = (flags & GrctRequestHelperFlags.DisableAutoSend) !== 0;\r\n \r\n\r\n \r\n var _strings = _serverData.str;\r\n var _checkApiCanary = _serverData.fCheckApiCanary;\r\n var _getRecoveryCredentialTypeUrl = _serverData.urlGetRecoveryCredentialType;\r\n var _userProofData = _serverData.arrProofData || {};\r\n var _isRestrictedWsi = _serverData.fIsRestrictedWsi;\r\n \r\n\r\n \r\n _this.sendAsync = function (unsafe_username, flowToken, targetCredential)\r\n {\r\n var unsafe_cleansedUsername = StringHelpers.cleanseUsername(unsafe_username, true );\r\n var cachedResponse = _cache[unsafe_cleansedUsername] ? _cache[unsafe_cleansedUsername] : null;\r\n\r\n \r\n var grctPromise = cachedResponse\r\n ? cachedResponse\r\n : _callGetRecoveryCredentialTypeAsync(targetCredential, flowToken);\r\n\r\n \r\n \r\n \r\n \r\n return Promise.all([grctPromise]).then(\r\n function (results)\r\n {\r\n var response = results[0];\r\n\r\n return _parseGetRecoveryCredentialTypeResponse(unsafe_cleansedUsername, response);\r\n },\r\n _handleGetRecoveryCredentialTypeError);\r\n };\r\n\r\n _this.getState = function ()\r\n {\r\n return { cache: _cache };\r\n };\r\n\r\n _this.restoreState = function (state)\r\n {\r\n if (state)\r\n {\r\n _cache = state.cache || {};\r\n }\r\n };\r\n\r\n _this.getGrctSharedData = function (unsafe_username, response)\r\n {\r\n var sharedData = {};\r\n var preferredCredential = _getPreferredCredential(response);\r\n sharedData.preferredCredential = preferredCredential;\r\n sharedData.availableRecoveryCreds = _getAvailableCreds(unsafe_username, response);\r\n\r\n if (preferredCredential === CredentialType.OneTimeCode)\r\n {\r\n sharedData.otcCredential = Helpers.Array.first(\r\n sharedData.availableRecoveryCreds,\r\n function (credential)\r\n {\r\n return credential.credType === CredentialType.OneTimeCode && credential.proof.otcSent;\r\n });\r\n }\r\n\r\n sharedData.otcParams =\r\n {\r\n requestSent: preferredCredential === CredentialType.OneTimeCode\r\n };\r\n\r\n return sharedData;\r\n };\r\n \r\n\r\n \r\n function _buildOtcCredentials(unsafe_username, response)\r\n {\r\n var otcCredentials = [];\r\n\r\n if (_getPreferredCredential(response) === CredentialType.OneTimeCode)\r\n {\r\n var otcCredential =\r\n {\r\n credType: CredentialType.OneTimeCode,\r\n proof:\r\n {\r\n display: unsafe_username,\r\n data: StringHelpers.cleanseUsername(unsafe_username),\r\n otcSent: true,\r\n isEncrypted: false,\r\n isDefault: true,\r\n isNopa: true,\r\n type: PROOF.Type.Email\r\n }\r\n };\r\n\r\n otcCredentials.push(otcCredential);\r\n }\r\n\r\n return otcCredentials;\r\n }\r\n\r\n function _buildOtcProofStrings(otcCredential)\r\n {\r\n \r\n \r\n otcCredential.proof.str = {};\r\n ObjectHelpers.extend(otcCredential.proof.str, _userProofData[otcCredential.proof.type] || {});\r\n }\r\n\r\n function _callGetRecoveryCredentialTypeAsync(targetCredential, flowToken)\r\n {\r\n return new Promise(\r\n function (resolve, reject)\r\n {\r\n var apiRequest = new ApiRequest({ checkApiCanary: _checkApiCanary });\r\n apiRequest.Json(\r\n { \r\n url: _getRecoveryCredentialTypeUrl,\r\n eventId: ClientTracingConstants.EventIds.Api_GetRecoveryCredentialType\r\n },\r\n { \r\n targetCredential: targetCredential,\r\n flowToken: flowToken\r\n },\r\n resolve,\r\n reject,\r\n Constants.DefaultRequestTimeout);\r\n });\r\n }\r\n\r\n function _parseGetRecoveryCredentialTypeResponse(unsafe_username, response)\r\n {\r\n var grctResult = {};\r\n var sharedData = _this.getGrctSharedData(unsafe_username, response);\r\n\r\n grctResult = _getUsernameFoundGrctResult(response);\r\n\r\n \r\n grctResult.flowToken = response.FlowToken || null;\r\n\r\n if (!grctResult.bypassCache)\r\n {\r\n _cache[unsafe_username] = response;\r\n\r\n \r\n _cache[unsafe_username].FlowToken = null;\r\n }\r\n\r\n grctResult.sharedData = sharedData;\r\n\r\n return grctResult;\r\n }\r\n\r\n function _handleGetRecoveryCredentialTypeError(response)\r\n {\r\n var grctResult = {};\r\n\r\n if (response && response.error)\r\n {\r\n switch (response.error.code)\r\n {\r\n case ApiErrorCodes.AuthFailure:\r\n grctResult = _getGrctResultShowErrorAction(_strings[\"CT_PWD_STR_Error_FlowTokenExpired\"]);\r\n break;\r\n\r\n case EstsError.TenantDoesNotSupportNativeCredentialRecovery:\r\n case EstsError.UserDoesNotSupportNativeCredentialRecovery:\r\n case EstsError.CredentialDoesNotSupportNativeRecovery:\r\n grctResult = _getGrctResultShowErrorAction(_strings[\"CT_PWD_STR_Error_CredentialDoesNotSupportNativeRecovery\"]);\r\n break;\r\n\r\n default:\r\n grctResult = _getGrctResultShowErrorAction(_strings[\"CT_PWD_STR_Error_GetRecoveryCredentialTypeError\"]);\r\n break;\r\n }\r\n }\r\n else\r\n {\r\n grctResult = _getGrctResultShowErrorAction(_strings[\"CT_PWD_STR_Error_GetRecoveryCredentialTypeError\"]);\r\n }\r\n\r\n grctResult.flowToken = response.FlowToken || null;\r\n\r\n return grctResult;\r\n }\r\n\r\n function _getPreferredCredential(response)\r\n {\r\n var credentials = response.Credentials;\r\n var preferredCredential = null;\r\n\r\n if (credentials)\r\n {\r\n preferredCredential = credentials.PrefCredential;\r\n }\r\n\r\n return preferredCredential;\r\n }\r\n\r\n function _getAvailableCreds(unsafe_username, response)\r\n {\r\n var credentials = [];\r\n\r\n \r\n if (_userProofData[PROOF.Type.Email])\r\n {\r\n var otcCredentials = _buildOtcCredentials(unsafe_username, response);\r\n\r\n if (otcCredentials.length > 0)\r\n {\r\n Helpers.Array.forEach(otcCredentials, _buildOtcProofStrings);\r\n credentials = credentials.concat(otcCredentials);\r\n }\r\n }\r\n\r\n return credentials;\r\n }\r\n\r\n function _getUsernameFoundGrctResult(response)\r\n {\r\n var preferredCredential = _getPreferredCredential(response);\r\n\r\n if (_isRestrictedWsi)\r\n {\r\n \r\n if (!response.Credentials.HasPassword\r\n && !response.Credentials.HasGoogleFed\r\n && !response.Credentials.HasCertAuth\r\n && !response.Credentials.HasFido\r\n && !response.Credentials.HasRemoteNGC\r\n && !response.Credentials.HasPhone\r\n && !response.Credentials.HasFacebookFed)\r\n {\r\n if (preferredCredential !== CredentialType.AccessPass)\r\n {\r\n return _getGrctResultSwitchViewAction(PaginatedState.MoreInfo);\r\n }\r\n }\r\n }\r\n\r\n switch (preferredCredential)\r\n {\r\n case CredentialType.OneTimeCode:\r\n var paginatedState = PaginatedState.OneTimeCodeRecovery;\r\n\r\n if (_disableAutoSend)\r\n {\r\n paginatedState = PaginatedState.ConfirmSend;\r\n }\r\n\r\n return _getGrctResultSwitchViewAction(paginatedState);\r\n\r\n \r\n default:\r\n return _getGrctResultShowErrorAction(_strings[\"CT_PWD_STR_Error_GetRecoveryCredentialTypeError\"], false , true );\r\n }\r\n }\r\n\r\n function _getGrctResultSwitchViewAction(viewId, viewParams)\r\n {\r\n return { action: GrctResultAction.SwitchView, viewId: viewId, viewParams: viewParams };\r\n }\r\n\r\n function _getGrctResultShowErrorAction(error, isBlockingError, bypassCache)\r\n {\r\n return { action: GrctResultAction.ShowError, error: error, isBlockingError: isBlockingError, bypassCache: bypassCache };\r\n }\r\n \r\n}\r\n\r\nmodule.exports = GetRecoveryCredentialTypeRequestHelper;","module.exports = \"\\n\\n\\n\\n