{"version":3,"sources":["Scripts/Utilities/cartegraph-utilities.shim.js","Scripts/Utilities/string.js","Scripts/System/AjaxURL.shim.js","Scripts/Account/SignInViewModel.js","Scripts/ViewModels/Mixins/DisposableViewModel.js","Scripts/ViewModels/AlertViewModel.js","Scripts/Account/cartegraph-forgot-password.js"],"names":["Cartegraph","require","init","String","Format","stringValue","arguments","i","length","reg","RegExp","replace","prototype","endsWith","suffix","this","substr","endsWithIgnoreCase","toUpperCase","equalsIgnoreCase","otherString","trim","startsWith","prefix","trimNewline","isEmpty","contains","it","indexOf","escapeSingleQuote","ReplaceAll","searchString","replacer","caseSensitive","undefined","NotHTMLDoc","str","toString","hashCode","hash","chr","len","charCodeAt","AjaxURL","SignInViewModel","options","username","ko","observable","baseUrl","Utilities","getBaseURL","password","error","loading","isInternalRequest","buttonText","computed","signInButtonEnabled","formFilled","submit","signInAnon","self","post","API","userName","honorEsriLicensing","then","data","LogOnStatus","PendoService","trackLoginType","location","returnUrl","URLSearchParams","search","get","window","origin","responseJSON","Message","forgotPassword","Account","logInWithEsri","params","OAuth","uriEncodeValues","encodedParams","key","encodeURIComponent","DisposableViewModel","dispose","propertiesToIgnore","isNullOrUndefined","vmComputedContext","hasOwnProperty","_context","property","ignoreProp","subscription","isFunction","isObservable","subscriptionType","_subscriptions","subscriptionCount","index","isObservableArray","forEach","item","bind","AlertLevel","AlertViewModel","alertLevel","Error","title","message","okText","cancelText","onOk","dismiss","onCancel","defaultButton","buttonHasFocus","afterDismiss","getContext","alertType","alertTypeComputedEvaluator","subscribe","value","isNullUndefinedOrEmpty","call","ok","cancel","showError","opts","click","isDefault","warning","showWarning","Warning","prompt","showPrompt","Prompt","KOAlert","CGForgotPasswordViewModel","alert","resetButtonEnabled","userNameFilled","success","ResetPasswordFailed","AskYourSystemAdminForHelpPeriod","backToSignIn","CGResetPasswordViewModel","newPassword","confirmPassword","UserName","Password","ConfirmPassword"],"mappings":"AAAA,IAAIA,WAAaC,QAAQ,kCAAkCC;;;;;;;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WAAW2C,QAAQuC,QAAQ,aAAgB3B,CAAAA,kBAAuBO,EAACP,qBAI7F,SAASiG,yBAAyB3G,GAC9B9B,KAAK+B,SAAaC,GAACC,WAAWH,EAAQC,UACtC/B,KAAK0I,YAAgB1G,GAACC,WAAH,IACnBjC,KAAK2I,gBAAoB3G,GAACC,WAAH,IACvBjC,KAAKuC,QAAYP,GAACC,WAAW,OAC7BjC,KAAKsC,MAAUN,GAACC,WAAWH,EAAQQ,OACnCtC,KAAKyE,IAAM3C,EAAQ2C,IACnBzE,KAAKwC,kBAAoBV,EAAQU,kBAEjCxC,KAAKmI,mBAAuBnG,GAACU,UAAS,WAC9BH,IAAAA,EAAUvC,KAAKuC,UACfmG,IAAAA,EAAc1I,KAAK0I,cACnBC,IAAAA,EAAkB3I,KAAK2I,kBAE3B,OAAQpG,GAAWmG,EAAYjJ,OAAxB,GAAsCiJ,IAAgBC,IAC9D3I,MAEHA,KAAK6C,OAAS,WACNE,IAAIA,EAAR/C,KAEI,IAAK+C,EAACoF,qBACN,OAEJnI,KAAKuC,QAAL,MAEES,EAAFA,KAAO/D,WAAW2C,QAAQuC,QAAQ,iBAAkB,CAC3CpB,IAAK0B,EADsCA,IAEhDmE,SAAe7G,EAAAA,WACf8G,SAAeH,EAAAA,cACfI,gBAAsBH,EAAAA,oBAEhBvF,MAAA,SAAgBC,GACbmF,EAAAA,kBACN,SAAgBnF,GACVd,EAAQA,QAAb,OACAQ,EAAeT,MAAC0B,EAAAA,aAAhBoC,aAIZpG,KAAKwI,aAAe,WACZzF,IAAIA,EAAR/C,KACA8D,OAAOL,SAAWxE,WAAW2C,QAAQuC,QAAQ,aAAgB3B,CAAAA,kBAAuBO,EAACP","file":"login.js","sourcesContent":["var Cartegraph = require(\"Utilities/cartegraph-utilities\").init();","/*\n* string.js\n*\n* These are common methods used in C# which are handy to use in JavaScript\n* They provide a common interface for working with strings in JavaScript\n*/\n\n/* \n* String.Foramt\n*\n* Provides functionality to access localized strings. To use a string the code would look like:\n*\n*/\nString.Format = function () {\n var stringValue = arguments[0]; // The first argument is the string to format\n\n // loop through all of the additional arguments and replace {x} with the appropriate value\n for (var i = 0; i < arguments.length - 1; i++) {\n var reg = new RegExp(\"\\\\{\" + i + \"\\\\}\", \"gm\");\n stringValue = stringValue.replace(reg, arguments[i + 1]);\n }\n\n return stringValue;\n};\n\nString.prototype.endsWith = function (suffix) {\n return this.length >= suffix.length && this.substr(this.length - suffix.length) == suffix;\n};\n\nString.prototype.endsWithIgnoreCase = function (suffix) {\n return this.length >= suffix.length && this.toUpperCase().substr(this.length - suffix.length) == suffix.toUpperCase();\n};\n\nString.prototype.equalsIgnoreCase = function (otherString) {\n return this.toUpperCase().trim() === otherString.toUpperCase().trim();\n};\n\nString.prototype.startsWith = function (prefix) {\n return this.length >= prefix.length && this.substr(0, prefix.length) == prefix;\n};\n\nString.prototype.trimNewline = function () {\n return this.replace(/(\\r|\\n|\\r\\n)/gm, \"\");\n};\n\nString.prototype.trim = function () {\n return this.replace(/^\\s+|\\s+$/g, '');\n};\n\nString.prototype.isEmpty = function () {\n return this.trim() == \"\";\n};\n\nString.prototype.contains = function (it) {\n return this.indexOf(it) != -1;\n};\n\nString.prototype.escapeSingleQuote = function () {\n return this.replace(\"\\\"\", \"\\\"\\\"\");\n}; \n\n//Replaces all instances of searchString with replacers in this. if caseSensitive is true then\n// \"test\" != \"Test\" (default value of caseSensitive is true)\nString.prototype.ReplaceAll = function (searchString, replacer, caseSensitive) {\n if (caseSensitive === null || caseSensitive === undefined)\n caseSensitive = true;\n return this.replace(new RegExp(searchString, \"g\" + (caseSensitive ? \"\" : \"i\")), replacer);\n};\n\nString.prototype.NotHTMLDoc = function () {\n var str = this.toString();\n return !(str.toUpperCase().indexOf(\" 0 && this.password().length > 0);\n\n return !loading && formFilled;\n }, this);\n\n this.submit = function (signInAnon) {\n var self = this;\n if (!signInAnon && !self.signInButtonEnabled()) {\n return;\n }\n this.loading(true);\n\n if (signInAnon)\n {\n self.username(\"\");\n self.password(\"\");\n }\n\n $.post(Cartegraph.AjaxURL.API(\"authenticate\"), { userName: self.username(), password: self.password(), isInternalRequest: self.isInternalRequest, honorEsriLicensing: true })\n .then(function (data) {\n // Preserve the hash after the login to attempt to navigate to the intended location\n // This will not do anything for internal requests since the hash is replaced by #InternalRequest, but it also doesn't hurt\n if (data.LogOnStatus === 0) {\n if (self.isInternalRequest) {\n Cartegraph.PendoService.trackLoginType(\"Internal Request\");\n window.location = self.baseUrl + \"InternalRequest\";\n } else {\n let returnUrl = new URLSearchParams(window.location.search).get(\"ReturnUrl\");\n if (returnUrl)\n // If there is a return url, it will be a relative url (including the virtual directory)\n // So you have to tack the rest of the origin back on\n returnUrl = window.location.origin + returnUrl;\n else\n // Otherwise, navigate to the base url\n returnUrl = self.baseUrl;\n\n // Either way, preserve the hash\n if (window.location.hash)\n returnUrl += window.location.hash;\n\n Cartegraph.PendoService.trackLoginType(\"Cartegraph\");\n window.location = returnUrl;\n }\n }\n }, function (data) {\n self.loading(false);\n self.error(data.responseJSON.Message);\n });\n };\n\n this.forgotPassword = function () {\n var self = this;\n window.location = Cartegraph.AjaxURL.Account('ForgotPassword', { userName: self.username(), isInternalRequest: self.isInternalRequest });\n }\n\n this.logInWithEsri = function () {\n var self = this;\n const params = {\n userName: self.username(),\n isInternalRequest: self.isInternalRequest\n };\n\n const returnUrl = new URLSearchParams(window.location.search).get(\"ReturnUrl\");\n if (returnUrl)\n // The oAuth controller handles this as a relative URL, so no need to do anything more with it\n params.returnUrl = returnUrl;\n else\n // Even if there isn't a return url, there might still be a hash, so set it to something\n params.returnUrl = \"\";\n\n // Either way, preserve the hash\n if (window.location.hash)\n params.returnUrl += window.location.hash;\n\n Cartegraph.PendoService.trackLoginType(\"Esri\");\n window.location = Cartegraph.AjaxURL.OAuth('LoginWithEsri', this.uriEncodeValues(params));\n }\n\n /**\n * Manually encode every value of an object\n * Since we pulle the return url from the url, we need to re-encode it.\n * It could have have parameters already url encoded,\n * and our internal Ajax url function won't double encode\n */\n this.uriEncodeValues = function (params) {\n var self = this;\n const encodedParams = {};\n for (const key in params) {\n encodedParams[key] = encodeURIComponent(params[key]);\n }\n\n return encodedParams;\n }\n};","/* global ko, _ */\n\nvar DisposableViewModel = (function () {\n function dispose(propertiesToIgnore) {\n var self = this;\n\n if (!Cartegraph.Utilities.isNullOrUndefined(self.vmComputedContext) && self.vmComputedContext.hasOwnProperty(\"_context\"))\n self.vmComputedContext._context = null; // Clean-up potential VM memory leaks in ko.computed (evaluatorFunctionTarget reference to VM)\n\n for (var property in self) {\n var ignoreProp = propertiesToIgnore.indexOf(property) > -1;\n if (!ignoreProp && self.hasOwnProperty(property) && self[property] != null) {\n if (self[property] == undefined) {\n self[property] = null;\n continue;\n }\n\n if (self[property] instanceof ko.subscription || _.isFunction(self[property].dispose))\n self[property].dispose();\n if (ko.isObservable(self[property])) {\n for (var subscriptionType in self[property]._subscriptions) {\n // subscriptiontype = 'change' etc\n\n // each subscriptiontype has an array of subscriptions\n var subscriptionCount = self[property]._subscriptions[subscriptionType].length;\n\n for (var index = 0; index < subscriptionCount; index++) {\n self[property]._subscriptions[subscriptionType][0].dispose();\n }\n\n }\n\n if (self[property].isObservableArray)\n {\n self[property]().forEach(function (item) {\n if (item && _.isFunction(item.dispose)) {\n item.dispose();\n item = null;\n }\n });\n }\n }\n\n self[property] = null;\n }\n }\n }\n return function (propertiesToIgnore) {\n this.dispose = dispose.bind(this, propertiesToIgnore || []);\n return this;\n };\n})();","/* AlertLevel enum. Allows retrieving values with index or string. \n * \n * Example: \n * AlertLevel[2] // \"Error\"\n * AlertLevel[\"Error\"] // 2\n */\nvar AlertLevel;\n(function (AlertLevel) {\n AlertLevel[AlertLevel[\"Message\"] = 0] = \"Message\";\n AlertLevel[AlertLevel[\"Warning\"] = 1] = \"Warning\";\n AlertLevel[AlertLevel[\"Error\"] = 2] = \"Error\";\n AlertLevel[AlertLevel[\"Prompt\"] = 3] = \"Prompt\";\n})(AlertLevel || (AlertLevel = {}));\n\n\nvar AlertViewModel = function () {\n var self = this;\n\n self.alertLevel = ko.observable(AlertLevel.Error);\n self.title = ko.observable(\"\");\n self.message = ko.observable(\"\");\n self.okText = ko.observable(\"OK\");\n self.cancelText = ko.observable(\"Cancel\");\n self.onOk = self.dismiss;\n self.onCancel = self.dismiss;\n self.defaultButton = ko.observable(\"ok\");\n self.buttonHasFocus = ko.observable(true);\n self.afterDismiss = function () { };\n\n //#region Computed Observables\n\n // To prevent potential VM memory leaks in ko.computed (evaluatorFunctionTarget reference to VM), supply an evaluatorFunctionTarget to ko.computed \n // that has a VM reference internally that we can access in the computed's evaluator function and later null-out when we dispose of the computed observables.\n self.vmComputedContext = { _context: self, getContext: function () { return this._context; } };\n\n self.alertType = ko.computed(function alertTypeComputedEvaluator() {\n var vmComputedContext = this;\n var self = vmComputedContext.getContext();\n\n return AlertLevel[self.alertLevel()];\n\n }, self.vmComputedContext);\n\n //#endregion\n\n // Reset default button \n self.message.subscribe(function (value) {\n if (Cartegraph.Utilities.isNullUndefinedOrEmpty(value))\n this.defaultButton(\"ok\");\n }, self);\n\n DisposableViewModel.call(self);\n};\n\nAlertViewModel.prototype.dismiss = function () {\n this.message(\"\");\n this.onOk = this.dismiss;\n this.onCancel = this.dismiss;\n this.buttonHasFocus(true);\n this.defaultButton(\"ok\");\n if(this.afterDismiss)\n this.afterDismiss();\n};\n\nAlertViewModel.prototype.init = function (options) {\n this.title(options.title || \"\");\n this.okText(options.okText || \"\");\n this.cancelText(options.cancelText || \"\");\n this.message(options.message || \"\");\n this.onOk = options.onOk || this.dismiss;\n this.onCancel = options.onCancel || this.dismiss;\n this.defaultButton(options.defaultButton || \"ok\");\n};\n\nAlertViewModel.prototype.error = function (message, title, ok, cancel) {\n var self = this;\n\n ok = ok || { ok: \"\" };\n cancel = cancel || { cancel: \"\" };\n\n function showError(opts) {\n self.alertLevel(AlertLevel.Error);\n self.init({\n message: message,\n title: title,\n okText: ok.ok,\n cancelText: cancel.cancel,\n onOk: ok.click,\n onCancel: cancel.click,\n defaultButton: cancel.isDefault ? \"cancel\" : \"ok\"\n });\n self.afterDismiss = null;\n }\n\n if (this.message()) {\n this.afterDismiss = showError;\n } else {\n showError();\n }\n \n};\n\nAlertViewModel.prototype.warning = function (message, title, ok, cancel) {\n var self = this;\n\n ok = ok || { ok: \"\" };\n cancel = cancel || { cancel: \"\" };\n\n function showWarning(opts) {\n self.alertLevel(AlertLevel.Warning);\n self.init({\n message: message,\n title: title,\n okText: ok.ok,\n cancelText: cancel.cancel,\n onOk: ok.click,\n onCancel: cancel.click,\n defaultButton: cancel.isDefault ? \"cancel\" : \"ok\"\n });\n self.afterDismiss = null;\n }\n\n if (this.message()) //if we're already showing a message, queue this one.\n {\n this.afterDismiss = showWarning;\n } else {\n showWarning();\n }\n};\n\nAlertViewModel.prototype.prompt = function (message, title, ok, cancel) {\n var self = this;\n\n ok = ok || { ok: \"\" };\n cancel = cancel || { cancel: \"\" };\n\n function showPrompt(opts) {\n self.alertLevel(AlertLevel.Prompt);\n self.init({\n message: message,\n title: title,\n okText: ok.ok,\n cancelText: cancel.cancel,\n onOk: ok.click,\n onCancel: cancel.click,\n defaultButton: cancel.isDefault ? \"cancel\" : \"ok\"\n });\n self.afterDismiss = null;\n }\n\n if (this.message()) //if we're already showing a message, queue this one.\n {\n this.afterDismiss = showPrompt;\n\n } else {\n showPrompt();\n }\n};\n\nCartegraph.KOAlert = new AlertViewModel();","function CGForgotPasswordViewModel(options) {\n this.username = ko.observable(options.username);\n this.isInternalRequest = options.isInternalRequest;\n this.loading = ko.observable(false);\n this.alert = new AlertViewModel();\n\n this.resetButtonEnabled = ko.computed(function () {\n var loading = this.loading();\n var userNameFilled = this.username().length > 0;\n\n return !loading && userNameFilled;\n }, this);\n\n this.submit = function () {\n var self = this;\n if (!self.resetButtonEnabled())\n return;\n\n this.loading(true);\n\n $.post(Cartegraph.AjaxURL.Account(\"EmailResetLink\"), { userName: self.username(), isInternalRequest: self.isInternalRequest })\n .then(function (data) {\n self.loading(false);\n if (data.success)\n self.alert.warning(data.message, data.title, { ok: \"OK\" });\n else\n self.alert.error(data.message, data.title, { ok: \"OK\" });\n }, function (data) {\n self.loading(false);\n self.alert.error(Cartegraph.Resources.ResetPasswordFailed, Cartegraph.Resources.AskYourSystemAdminForHelpPeriod, { ok: \"OK\" });\n });\n };\n\n this.backToSignIn = function () {\n var self = this;\n window.location = Cartegraph.AjaxURL.Account(\"ShowSignIn\", { isInternalRequest: self.isInternalRequest });\n }\n};\n\nfunction CGResetPasswordViewModel(options) {\n this.username = ko.observable(options.username);\n this.newPassword = ko.observable(\"\");\n this.confirmPassword = ko.observable(\"\");\n this.loading = ko.observable(false);\n this.error = ko.observable(options.error);\n this.key = options.key;\n this.isInternalRequest = options.isInternalRequest;\n\n this.resetButtonEnabled = ko.computed(function () {\n var loading = this.loading();\n var newPassword = this.newPassword();\n var confirmPassword = this.confirmPassword();\n\n return !loading && newPassword.length > 0 && newPassword === confirmPassword;\n }, this);\n\n this.submit = function () {\n var self = this;\n\n if (!self.resetButtonEnabled()) {\n return;\n }\n this.loading(true);\n\n $.post(Cartegraph.AjaxURL.Account(\"ResetPassword\"), {\n Key: self.key,\n UserName: self.username(),\n Password: self.newPassword(),\n ConfirmPassword: self.confirmPassword()\n })\n .then(function (data) {\n self.backToSignIn();\n }, function (data) {\n self.loading(false);\n self.error(data.responseJSON.message);\n });\n };\n\n this.backToSignIn = function () {\n var self = this;\n window.location = Cartegraph.AjaxURL.Account(\"ShowSignIn\", { isInternalRequest: self.isInternalRequest });\n }\n};\n"]}