{"version":3,"sources":["../logon.js",".././app/logon/index.js",".././app/logon/logOn.js"],"names":["webpackJsonp","0","module","exports","__webpack_require__","734","$","pli","reloadPageIfObsolete","$logon","$name","$pswd","$pswdLabel","$mail","$message","$info","$recovery","$formTitle","$uiElements","add","emptyTest","logonTexts","data","state","currentCall","findFocus","errorClass","$ignore","$toFocus","test","value","toggleClass","setState","newState","errorMessage","text","RecoveryTitle","html","RecoveryHelpReady","removeClass","fadeIn","RecoveryLinkDeactivate","EmailLabel","addClass","find","RecoverySubmitLabel","attr","hide","show","prop","focus","RecoveryHelpSuccess","RecoveryBackLabel","LogOnTitle","stop","RecoveryLinkActivate","PasswordLabel","LogOnSubmitLabel","CancelLabel","InitInProgress","LogOnInProgress","RecoveryInProgress","callFailed","response","clientStatus","window","console","error","concat","result","exception","message","RecoveryFailed","RecoveryHelpFailure","LogOnFailed","LogOnHelpFailure","callSucceeded","location","replace","url","onSubmit","event","logon","preventDefault","Error","xhr","abort","ErrorEmptyFields","call","name","ignoreUnauthenticated","pswd","mail","then","onFormClick","$anchor","target","closest","command","separator","indexOf","slice","selectText","select","submit","click","logonFormLoaded","logonFormFailedToLoad"],"mappings":";AAAAA,cAAc,KAERC,EACA,SAAUC,OAAQC,QAASC,qBCHjCA,oBAAA,MDUMC,IACA,SAAUH,OAAQC,QAASC,qBETjC,YAEA,IAAAE,GAAAF,oBAAA,EACA,IAAAG,KAAAH,oBAAA,EACA,IAAAI,sBAAAJ,oBAAA,IAEA,IAAAK,QAAAH,EAAA,wBACAI,MAAAJ,EAAA,cACAK,MAAAL,EAAA,cACAM,WAAAN,EAAA,cACAO,MAAAP,EAAA,cACAQ,SAAAR,EAAA,YACAS,MAAAT,EAAA,SACAU,UAAAV,EAAA,aACAW,WAAAX,EAAA,cACAY,YAAAR,MAAAS,IAAAb,EAAA,eAAAa,IAAAR,OAAAQ,IAAAP,YAAAO,IAAAN,OAAAM,IAAAH,WACAI,UAAA,QACAC,WAAAf,EAAA,QAAAgB,KAAA,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ourcesContent":["webpackJsonp([18],{\n\n/***/ 0:\n/***/ (function(module, exports, __webpack_require__) {\n\n\t__webpack_require__(734);\r\n\n\n/***/ }),\n\n/***/ 734:\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/*jslint browser: true */\r\n\t\r\n\t\"use strict\";\r\n\t\r\n\tvar $ = __webpack_require__(1);\r\n\tvar pli = __webpack_require__(5);\r\n\tvar reloadPageIfObsolete = __webpack_require__(467);\r\n\t\r\n\tvar $logon = $(\"#login_action_submit\"),\r\n\t $name = $(\"#NameValue\"),\r\n\t $pswd = $(\"#PswdValue\"),\r\n\t $pswdLabel = $(\"#PswdLabel\"),\r\n\t $mail = $(\"#MailValue\"),\r\n\t $message = $(\"#Message\"),\r\n\t $info = $(\"#Info\"),\r\n\t $recovery = $(\"#Recovery\"),\r\n\t $formTitle = $(\"#FormTitle\"),\r\n\t $uiElements = $name.add($(\"#NameLabel\")).add($pswd).add($pswdLabel).add($mail).add($recovery),\r\n\t emptyTest = /^\\s*$/,\r\n\t logonTexts = $(\"form\").data(\"pliLogonTexts\"),\r\n\t state,\r\n\t currentCall;\r\n\t\r\n\t//-------------------------------------------\r\n\tfunction findFocus(errorClass, $ignore) {\r\n\t /// \r\n\t /// Find first empty input control (optionally\r\n\t /// ignoring the specified $ignore control).\r\n\t /// If errorClass is specified, all controls\r\n\t /// that are empty will have this class added\r\n\t /// to their class attribute.\r\n\t /// \r\n\t var $toFocus = null, test;\r\n\t\r\n\t if ($ignore !== $name) {\r\n\t test = emptyTest.test($name[0].value);\r\n\t if (errorClass) {\r\n\t $name.toggleClass(errorClass, test);\r\n\t }\r\n\t $toFocus = $toFocus || (test ? $name : null);\r\n\t }\r\n\t\r\n\t if ($ignore !== $pswd) {\r\n\t test = emptyTest.test($pswd[0].value);\r\n\t if (errorClass) {\r\n\t $pswd.toggleClass(errorClass, test);\r\n\t }\r\n\t $toFocus = $toFocus || (test ? $pswd : null);\r\n\t }\r\n\t\r\n\t if ($ignore !== $mail) {\r\n\t test = emptyTest.test($mail[0].value);\r\n\t if (errorClass) {\r\n\t $mail.toggleClass(errorClass, test);\r\n\t }\r\n\t $toFocus = $toFocus || (test ? $mail : null);\r\n\t }\r\n\t\r\n\t return $toFocus;\r\n\t}\r\n\t\r\n\t\r\n\t//-------------------------------------------\r\n\tfunction setState(newState, errorMessage) {\r\n\t /// \r\n\t /// Update UI state to reflect specified state\r\n\t /// and update the \"state\" variable.\r\n\t /// \r\n\t\r\n\t switch (newState) {\r\n\t case \"recoveryReady\":\r\n\t $formTitle.text(logonTexts.RecoveryTitle);\r\n\t $info.html(logonTexts.RecoveryHelpReady).removeClass(\"error\").fadeIn();\r\n\t $recovery.html(logonTexts.RecoveryLinkDeactivate);\r\n\t $pswdLabel.text(logonTexts.EmailLabel);\r\n\t $message.addClass(\"error\").text(errorMessage || \"\");\r\n\t $logon.find(\"span\").text(logonTexts.RecoverySubmitLabel);\r\n\t $pswd.attr(\"value\", \"\").hide();\r\n\t $mail.show();\r\n\t $uiElements.prop(\"disabled\", false).removeClass(\"disabled error\");\r\n\t (findFocus(null, $pswd) || $mail).focus();\r\n\t break;\r\n\t\r\n\t case \"recoveryFinished\":\r\n\t $message.text(\"\");\r\n\t $info.html(logonTexts.RecoveryHelpSuccess).removeClass(\"error\").fadeIn();\r\n\t $logon.find(\"span\").text(logonTexts.RecoveryBackLabel);\r\n\t $recovery.prop(\"disabled\", false).removeClass(\"disabled\");\r\n\t break;\r\n\t\r\n\t case \"logonReady\":\r\n\t $formTitle.text(logonTexts.LogOnTitle);\r\n\t $info.stop(true, true).hide();\r\n\t $recovery.html(logonTexts.RecoveryLinkActivate);\r\n\t $pswdLabel.text(logonTexts.PasswordLabel);\r\n\t $message.addClass(\"error\").text(errorMessage || \"\");\r\n\t $logon.find(\"span\").text(logonTexts.LogOnSubmitLabel);\r\n\t $pswd.show();\r\n\t $mail.hide();\r\n\t $uiElements.prop(\"disabled\", false).removeClass(\"disabled error\");\r\n\t (findFocus(null, $mail) || $pswd).focus();\r\n\t break;\r\n\t\r\n\t case \"init\":\r\n\t case \"recovery\":\r\n\t case \"logon\":\r\n\t $uiElements.prop(\"disabled\", true).addClass(\"disabled\");\r\n\t if (!$logon.prop(\"disabled\")) { $logon.focus(); }\r\n\t $logon.find(\"span\").text(logonTexts.CancelLabel);\r\n\t $info.stop(true, true).hide();\r\n\t $message.removeClass(\"error\").text(newState === \"init\" ? logonTexts.InitInProgress : newState === \"logon\" ? logonTexts.LogOnInProgress : logonTexts.RecoveryInProgress).show();\r\n\t break;\r\n\t }\r\n\t\r\n\t state = newState;\r\n\t}\r\n\t\r\n\t\r\n\t//-------------------------------------------\r\n\tfunction callFailed(response) {\r\n\t /// \r\n\t if (response.clientStatus !== \"abort\") { // ignore failures caused by currentCall.xhr.abort() (see function \"onSubmit\" for details on when abort is being used)\r\n\t\r\n\t if (window.console && typeof window.console.error === \"function\") {\r\n\t window.console.error(\"Pli call error: \".concat((response.result.exception && response.result.exception.message) || response.result.message), response);\r\n\t }\r\n\t\r\n\t if (state === \"recovery\") {\r\n\t setState(\"recoveryReady\", logonTexts.RecoveryFailed);\r\n\t $info.html(logonTexts.RecoveryHelpFailure).addClass(\"error\").fadeIn();\r\n\t } else {\r\n\t setState(\"logonReady\", logonTexts.LogOnFailed);\r\n\t $info.html(logonTexts.LogOnHelpFailure).addClass(\"error\").fadeIn();\r\n\t }\r\n\t }\r\n\t currentCall = null;\r\n\t}\r\n\t\r\n\t\r\n\t//-------------------------------------------\r\n\tfunction callSucceeded(response) {\r\n\t /// \r\n\t /// \r\n\t if (state === \"recovery\") {\r\n\t setState(\"recoveryFinished\");\r\n\t } else {\r\n\t $logon.prop(\"disabled\", true).addClass(\"disabled\");\r\n\t location.replace(response.result.url);\r\n\t }\r\n\t currentCall = null;\r\n\t return null;\r\n\t}\r\n\t\r\n\t\r\n\t//-------------------------------------------\r\n\tfunction onSubmit(event) {\r\n\t /// \r\n\t /// \r\n\t var $toFocus, logon = false;\r\n\t\r\n\t event.preventDefault();\r\n\t\r\n\t switch (state) {\r\n\t case \"init\":\r\n\t throw new Error(\"Submit can't be called during form initialization\");\r\n\t\r\n\t case \"logon\": // cancel ongoing logon\r\n\t currentCall.xhr.abort();\r\n\t setState(\"logonReady\");\r\n\t return;\r\n\t\r\n\t case \"recovery\": // cancel ongoing recovery\r\n\t currentCall.xhr.abort();\r\n\t setState(\"recoveryReady\");\r\n\t return;\r\n\t\r\n\t case \"recoveryFinished\":\r\n\t setState(\"logonReady\");\r\n\t return;\r\n\t\r\n\t case \"logonReady\":\r\n\t logon = true;\r\n\t break;\r\n\t\r\n\t case \"recoveryReady\":\r\n\t break;\r\n\t }\r\n\t\r\n\t $toFocus = findFocus(\"error\", logon ? $mail : $pswd);\r\n\t if ($toFocus) {\r\n\t $message.addClass(\"error\").text(logonTexts.ErrorEmptyFields).show();\r\n\t $toFocus.focus();\r\n\t } else {\r\n\t setState(logon ? \"logon\" : \"recovery\");\r\n\t currentCall = pli.call({\r\n\t name: logon ? \"Pli-Authentication-LogOn\" : \"Pli-Authentication-ResetPassword\",\r\n\t ignoreUnauthenticated: true,\r\n\t data: { name: $name[0].value, pswd: $pswd[0].value, mail: $mail[0].value }\r\n\t }).then(callSucceeded, callFailed);\r\n\t }\r\n\t}\r\n\t\r\n\t\r\n\t//-------------------------------------------\r\n\tfunction onFormClick(event) {\r\n\t var $anchor = $(event.target).closest(\"a\"), command = $anchor.attr(\"href\"), separator;\r\n\t if (command) {\r\n\t separator = command.indexOf(\"#\");\r\n\t if (separator >= 0) {\r\n\t command = command.slice(separator + 1);\r\n\t switch (command) {\r\n\t case \"userName\":\r\n\t event.preventDefault();\r\n\t $name.focus();\r\n\t break;\r\n\t case \"email\":\r\n\t event.preventDefault();\r\n\t $mail.focus();\r\n\t break;\r\n\t case \"recover\":\r\n\t event.preventDefault();\r\n\t setState(state === \"recoveryReady\" || state === \"recoveryFinished\" ? \"logonReady\" : \"recoveryReady\");\r\n\t break;\r\n\t case \"submit\":\r\n\t onSubmit(event); // will call event.preventDefault()\r\n\t break;\r\n\t }\r\n\t }\r\n\t }\r\n\t}\r\n\t\r\n\t\r\n\t//-------------------------------------------\r\n\tfunction selectText(event) {\r\n\t /// \r\n\t /// Select all the text in the event target.\r\n\t /// \r\n\t event.target.select();\r\n\t}\r\n\t\r\n\t\r\n\t$(\"form\").submit(onSubmit).click(onFormClick);\r\n\t$name.focus(selectText); // add focus event handler that will also select the text in that field\r\n\t$pswd.focus(selectText);\r\n\t$mail.focus(selectText);\r\n\t\r\n\tsetState(\"init\");\r\n\tpli.call({ name: \"Pli-Authentication-LogOnFormInit\" }).then(\r\n\t function logonFormLoaded(response) {\r\n\t if (reloadPageIfObsolete(response)) { return; }\r\n\t $logon.prop(\"disabled\", false).closest(\"li\").removeClass(\"disabled\");\r\n\t setState(\"logonReady\");\r\n\t },\r\n\t function logonFormFailedToLoad() {\r\n\t $message.addClass(\"error\").text(\"Initialization failed\");\r\n\t }\r\n\t);\r\n\n\n/***/ })\n\n});\n\n\n// WEBPACK FOOTER //\n// logon.js","require(\"./logOn\");\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./app/logon/index.js\n// module id = 0\n// module chunks = 18","/*jslint browser: true */\r\n\r\n\"use strict\";\r\n\r\nvar $ = require(\"pli/jquery\");\r\nvar pli = require(\"pli/core\");\r\nvar reloadPageIfObsolete = require(\"pli/util/reloadPageIfObsolete\");\r\n\r\nvar $logon = $(\"#login_action_submit\"),\r\n $name = $(\"#NameValue\"),\r\n $pswd = $(\"#PswdValue\"),\r\n $pswdLabel = $(\"#PswdLabel\"),\r\n $mail = $(\"#MailValue\"),\r\n $message = $(\"#Message\"),\r\n $info = $(\"#Info\"),\r\n $recovery = $(\"#Recovery\"),\r\n $formTitle = $(\"#FormTitle\"),\r\n $uiElements = $name.add($(\"#NameLabel\")).add($pswd).add($pswdLabel).add($mail).add($recovery),\r\n emptyTest = /^\\s*$/,\r\n logonTexts = $(\"form\").data(\"pliLogonTexts\"),\r\n state,\r\n currentCall;\r\n\r\n//-------------------------------------------\r\nfunction findFocus(errorClass, $ignore) {\r\n /// \r\n /// Find first empty input control (optionally\r\n /// ignoring the specified $ignore control).\r\n /// If errorClass is specified, all controls\r\n /// that are empty will have this class added\r\n /// to their class attribute.\r\n /// \r\n var $toFocus = null, test;\r\n\r\n if ($ignore !== $name) {\r\n test = emptyTest.test($name[0].value);\r\n if (errorClass) {\r\n $name.toggleClass(errorClass, test);\r\n }\r\n $toFocus = $toFocus || (test ? $name : null);\r\n }\r\n\r\n if ($ignore !== $pswd) {\r\n test = emptyTest.test($pswd[0].value);\r\n if (errorClass) {\r\n $pswd.toggleClass(errorClass, test);\r\n }\r\n $toFocus = $toFocus || (test ? $pswd : null);\r\n }\r\n\r\n if ($ignore !== $mail) {\r\n test = emptyTest.test($mail[0].value);\r\n if (errorClass) {\r\n $mail.toggleClass(errorClass, test);\r\n }\r\n $toFocus = $toFocus || (test ? $mail : null);\r\n }\r\n\r\n return $toFocus;\r\n}\r\n\r\n\r\n//-------------------------------------------\r\nfunction setState(newState, errorMessage) {\r\n /// \r\n /// Update UI state to reflect specified state\r\n /// and update the \"state\" variable.\r\n /// \r\n\r\n switch (newState) {\r\n case \"recoveryReady\":\r\n $formTitle.text(logonTexts.RecoveryTitle);\r\n $info.html(logonTexts.RecoveryHelpReady).removeClass(\"error\").fadeIn();\r\n $recovery.html(logonTexts.RecoveryLinkDeactivate);\r\n $pswdLabel.text(logonTexts.EmailLabel);\r\n $message.addClass(\"error\").text(errorMessage || \"\");\r\n $logon.find(\"span\").text(logonTexts.RecoverySubmitLabel);\r\n $pswd.attr(\"value\", \"\").hide();\r\n $mail.show();\r\n $uiElements.prop(\"disabled\", false).removeClass(\"disabled error\");\r\n (findFocus(null, $pswd) || $mail).focus();\r\n break;\r\n\r\n case \"recoveryFinished\":\r\n $message.text(\"\");\r\n $info.html(logonTexts.RecoveryHelpSuccess).removeClass(\"error\").fadeIn();\r\n $logon.find(\"span\").text(logonTexts.RecoveryBackLabel);\r\n $recovery.prop(\"disabled\", false).removeClass(\"disabled\");\r\n break;\r\n\r\n case \"logonReady\":\r\n $formTitle.text(logonTexts.LogOnTitle);\r\n $info.stop(true, true).hide();\r\n $recovery.html(logonTexts.RecoveryLinkActivate);\r\n $pswdLabel.text(logonTexts.PasswordLabel);\r\n $message.addClass(\"error\").text(errorMessage || \"\");\r\n $logon.find(\"span\").text(logonTexts.LogOnSubmitLabel);\r\n $pswd.show();\r\n $mail.hide();\r\n $uiElements.prop(\"disabled\", false).removeClass(\"disabled error\");\r\n (findFocus(null, $mail) || $pswd).focus();\r\n break;\r\n\r\n case \"init\":\r\n case \"recovery\":\r\n case \"logon\":\r\n $uiElements.prop(\"disabled\", true).addClass(\"disabled\");\r\n if (!$logon.prop(\"disabled\")) { $logon.focus(); }\r\n $logon.find(\"span\").text(logonTexts.CancelLabel);\r\n $info.stop(true, true).hide();\r\n $message.removeClass(\"error\").text(newState === \"init\" ? logonTexts.InitInProgress : newState === \"logon\" ? logonTexts.LogOnInProgress : logonTexts.RecoveryInProgress).show();\r\n break;\r\n }\r\n\r\n state = newState;\r\n}\r\n\r\n\r\n//-------------------------------------------\r\nfunction callFailed(response) {\r\n /// \r\n if (response.clientStatus !== \"abort\") { // ignore failures caused by currentCall.xhr.abort() (see function \"onSubmit\" for details on when abort is being used)\r\n\r\n if (window.console && typeof window.console.error === \"function\") {\r\n window.console.error(\"Pli call error: \".concat((response.result.exception && response.result.exception.message) || response.result.message), response);\r\n }\r\n\r\n if (state === \"recovery\") {\r\n setState(\"recoveryReady\", logonTexts.RecoveryFailed);\r\n $info.html(logonTexts.RecoveryHelpFailure).addClass(\"error\").fadeIn();\r\n } else {\r\n setState(\"logonReady\", logonTexts.LogOnFailed);\r\n $info.html(logonTexts.LogOnHelpFailure).addClass(\"error\").fadeIn();\r\n }\r\n }\r\n currentCall = null;\r\n}\r\n\r\n\r\n//-------------------------------------------\r\nfunction callSucceeded(response) {\r\n /// \r\n /// \r\n if (state === \"recovery\") {\r\n setState(\"recoveryFinished\");\r\n } else {\r\n $logon.prop(\"disabled\", true).addClass(\"disabled\");\r\n location.replace(response.result.url);\r\n }\r\n currentCall = null;\r\n return null;\r\n}\r\n\r\n\r\n//-------------------------------------------\r\nfunction onSubmit(event) {\r\n /// \r\n /// \r\n var $toFocus, logon = false;\r\n\r\n event.preventDefault();\r\n\r\n switch (state) {\r\n case \"init\":\r\n throw new Error(\"Submit can't be called during form initialization\");\r\n\r\n case \"logon\": // cancel ongoing logon\r\n currentCall.xhr.abort();\r\n setState(\"logonReady\");\r\n return;\r\n\r\n case \"recovery\": // cancel ongoing recovery\r\n currentCall.xhr.abort();\r\n setState(\"recoveryReady\");\r\n return;\r\n\r\n case \"recoveryFinished\":\r\n setState(\"logonReady\");\r\n return;\r\n\r\n case \"logonReady\":\r\n logon = true;\r\n break;\r\n\r\n case \"recoveryReady\":\r\n break;\r\n }\r\n\r\n $toFocus = findFocus(\"error\", logon ? $mail : $pswd);\r\n if ($toFocus) {\r\n $message.addClass(\"error\").text(logonTexts.ErrorEmptyFields).show();\r\n $toFocus.focus();\r\n } else {\r\n setState(logon ? \"logon\" : \"recovery\");\r\n currentCall = pli.call({\r\n name: logon ? \"Pli-Authentication-LogOn\" : \"Pli-Authentication-ResetPassword\",\r\n ignoreUnauthenticated: true,\r\n data: { name: $name[0].value, pswd: $pswd[0].value, mail: $mail[0].value }\r\n }).then(callSucceeded, callFailed);\r\n }\r\n}\r\n\r\n\r\n//-------------------------------------------\r\nfunction onFormClick(event) {\r\n var $anchor = $(event.target).closest(\"a\"), command = $anchor.attr(\"href\"), separator;\r\n if (command) {\r\n separator = command.indexOf(\"#\");\r\n if (separator >= 0) {\r\n command = command.slice(separator + 1);\r\n switch (command) {\r\n case \"userName\":\r\n event.preventDefault();\r\n $name.focus();\r\n break;\r\n case \"email\":\r\n event.preventDefault();\r\n $mail.focus();\r\n break;\r\n case \"recover\":\r\n event.preventDefault();\r\n setState(state === \"recoveryReady\" || state === \"recoveryFinished\" ? \"logonReady\" : \"recoveryReady\");\r\n break;\r\n case \"submit\":\r\n onSubmit(event); // will call event.preventDefault()\r\n break;\r\n }\r\n }\r\n }\r\n}\r\n\r\n\r\n//-------------------------------------------\r\nfunction selectText(event) {\r\n /// \r\n /// Select all the text in the event target.\r\n /// \r\n event.target.select();\r\n}\r\n\r\n\r\n$(\"form\").submit(onSubmit).click(onFormClick);\r\n$name.focus(selectText); // add focus event handler that will also select the text in that field\r\n$pswd.focus(selectText);\r\n$mail.focus(selectText);\r\n\r\nsetState(\"init\");\r\npli.call({ name: \"Pli-Authentication-LogOnFormInit\" }).then(\r\n function logonFormLoaded(response) {\r\n if (reloadPageIfObsolete(response)) { return; }\r\n $logon.prop(\"disabled\", false).closest(\"li\").removeClass(\"disabled\");\r\n setState(\"logonReady\");\r\n },\r\n function logonFormFailedToLoad() {\r\n $message.addClass(\"error\").text(\"Initialization failed\");\r\n }\r\n);\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./app/logon/logOn.js\n// module id = 734\n// module chunks = 18"],"sourceRoot":""}