{"version":3,"sources":["webpack:///./node_modules/Ceres/resources/js/src/app/mixins/buttonSizeProperty.mixin.js","webpack:///./node_modules/Ceres/resources/js/src/app/components/customer/login/Login.vue","webpack:///./node_modules/Ceres/resources/js/src/app/components/customer/login/Login.vue?ac71","webpack:///node_modules/Ceres/resources/js/src/app/components/customer/login/Login.vue","webpack:///./node_modules/Ceres/resources/js/src/app/components/customer/login/Login.vue?e6a6"],"names":["BUTTON_SIZES","LEGACY_CLASS_MAP","ButtonSizePropertyMixin","props","buttonSize","type","String","default","validator","value","Object","keys","indexOf","computed","buttonSizeClass","hasOwnProperty","this","render","_vm","_c","_self","staticClass","ref","attrs","id","_uid","method","class","modalElement","directives","name","rawName","username","expression","autocomplete","domProps","on","input","$event","target","composing","_v","for","_s","$translate","password","row","href","click","showResetPwdView","_t","disabled","isDisabled","preventDefault","validateLogin","apply","arguments","icon","loading","_withStripped","mixins","backlink","hasToForward","data","loginFields","mounted","AutoFocusService","watch","methods","showLogin","ModalService","ValidationService","done","fail","sendLogin","ApiService","email","supressNotifications","NotificationService","location","translationKey","Vue","modalVue","findModal","hide","then","showModal","resetError","component"],"mappings":"28BAAA,IAAMA,EAAe,CAAC,SAAU,UAE1BC,EAAmB,CACrB,GAAM,SACN,GAAM,GACN,GAAM,UAGGC,EACb,CACIC,MAAO,CACHC,WACA,CACIC,KAAM,CAACC,OAAQ,MACfC,QAAS,KACTC,UAAW,SAAAC,GAEP,OAIsB,IAJf,CACH,IAAE,OACCT,EAAY,EACZU,OAAOC,KAAKV,KACjBW,QAAQH,MAKtBI,SAAU,CACNC,gBAAe,WAEX,OAAIb,EAAiBc,eAAeC,KAAKZ,YAE9BH,EAAiBe,KAAKZ,YAG1BY,KAAKZ,e,wCClCxB,IAAIa,EAAS,WACX,IAAIC,EAAMF,KACRG,EAAKD,EAAIE,MAAMD,GACjB,OAAOA,EAAG,MAAO,CAAEE,YAAa,mBAAqB,CACnDF,EACE,OACA,CACEG,IAAK,YACLC,MAAO,CAAEC,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E,wEC9LwK,EC+ChL,CACfC,aAEAzD,OACA0D,UACAxD,aAEAuB,cACAvB,aAEAyD,aACA,CACAzD,aACAE,aAIAwD,gBAEA,OACAlB,YACAb,YACAgC,eACAZ,gBAIAa,mBACA,WACA,2BAEA,gEAEAC,iCAIAC,MACA,CACAtB,uBAEA,mBAGAb,uBAEA,oBAIAoC,QACA,CAIAC,qBAEAC,wEAGAhB,yBACA,WACAiB,gDACAC,iBAEA,iBAEAC,kBAEAF,2CAOAG,qBACA,WACA,mBAEAC,0CAAAC,oBAAA/B,wBAAA,CAAAgC,0BACAL,kBAEAG,sBAEAG,kBACA,iDACA,gBAEA,8BAEAC,gDAEA,eAEAA,iCAIAA,qBAGAN,kBAIA,OAFA,gBAEA,cAEA,SACA,gFAEA,oCAEA,gEAEAO,kCAEAF,gBACA,iBACA,gBACA,MACA,QACA,YAKA7B,4BACA,WACA,kBAEA,8DAEAgC,yBAEA,0CACA,eAEAC,0BAEA,uDAEA,eAEAZ,UACAa,mDACAC,OACAC,QAIAC,QAKAC,sBAEA,sFACAhB,uD,OCvMIiB,EAAY,YACd,EACAvE,EHoLoB,IGlLpB,EACA,KACA,KACA,MAIa,UAAAuE,E","file":"chunks/ceres-10.min.js","sourcesContent":["const BUTTON_SIZES = [\"btn-sm\", \"btn-lg\"];\n\nconst LEGACY_CLASS_MAP = {\n    \"sm\": \"btn-sm\",\n    \"md\": \"\",\n    \"lg\": \"btn-lg\"\n};\n\nexport const ButtonSizePropertyMixin =\n{\n    props: {\n        buttonSize:\n        {\n            type: [String, null],\n            default: null,\n            validator: value =>\n            {\n                return [\n                    \"\",\n                    ...BUTTON_SIZES,\n                    ...Object.keys(LEGACY_CLASS_MAP)\n                ].indexOf(value) !== -1;\n            }\n        }\n    },\n\n    computed: {\n        buttonSizeClass()\n        {\n            if (LEGACY_CLASS_MAP.hasOwnProperty(this.buttonSize))\n            {\n                return LEGACY_CLASS_MAP[this.buttonSize];\n            }\n\n            return this.buttonSize;\n        }\n    }\n};\n","var render = function render() {\n  var _vm = this,\n    _c = _vm._self._c\n  return _c(\"div\", { staticClass: \"login-pwd-reset\" }, [\n    _c(\n      \"form\",\n      {\n        ref: \"loginForm\",\n        attrs: { id: \"login-form-\" + _vm._uid, method: \"post\" },\n      },\n      [\n        _c(\"div\", { class: { \"modal-body\": _vm.modalElement } }, [\n          _c(\"div\", { staticClass: \"row\" }, [\n            _c(\"div\", { staticClass: \"col-12\" }, [\n              _c(\n                \"div\",\n                {\n                  staticClass: \"input-unit\",\n                  attrs: { \"data-validate\": \"mail\" },\n                },\n                [\n                  _c(\"input\", {\n                    directives: [\n                      {\n                        name: \"model\",\n                        rawName: \"v-model\",\n                        value: _vm.username,\n                        expression: \"username\",\n                      },\n                    ],\n                    attrs: {\n                      \"data-testing\": \"email-login\",\n                      type: \"email\",\n                      name: \"email\",\n                      autocomplete: \"email\",\n                      id: \"email\" + _vm._uid,\n                      \"data-autofocus\": \"\",\n                    },\n                    domProps: { value: _vm.username },\n                    on: {\n                      input: function ($event) {\n                        if ($event.target.composing) return\n                        _vm.username = $event.target.value\n                      },\n                    },\n                  }),\n                  _vm._v(\" \"),\n                  _c(\"label\", { attrs: { for: \"email\" + _vm._uid } }, [\n                    _vm._v(\n                      _vm._s(_vm.$translate(\"Ceres::Template.loginEmail\")) + \"*\"\n                    ),\n                  ]),\n                ]\n              ),\n              _vm._v(\" \"),\n              _c(\"span\", { staticClass: \"error-msg\" }, [\n                _vm._v(\n                  _vm._s(\n                    _vm.$translate(\"Ceres::Template.loginEnterConfirmEmail\")\n                  )\n                ),\n              ]),\n            ]),\n            _vm._v(\" \"),\n            _c(\"div\", { staticClass: \"col-12\" }, [\n              _c(\n                \"div\",\n                {\n                  staticClass: \"input-unit\",\n                  class: { \"no-bottom\": _vm.modalElement },\n                  attrs: { \"data-validate\": \"text\" },\n                },\n                [\n                  _c(\"input\", {\n                    directives: [\n                      {\n                        name: \"model\",\n                        rawName: \"v-model\",\n                        value: _vm.password,\n                        expression: \"password\",\n                      },\n                    ],\n                    attrs: {\n                      \"data-testing\": \"password-login\",\n                      type: \"password\",\n                      name: \"password\",\n                      autocomplete: \"current-password\",\n                      id: \"password\" + _vm._uid,\n                    },\n                    domProps: { value: _vm.password },\n                    on: {\n                      input: function ($event) {\n                        if ($event.target.composing) return\n                        _vm.password = $event.target.value\n                      },\n                    },\n                  }),\n                  _vm._v(\" \"),\n                  _c(\"label\", { attrs: { for: \"password\" + _vm._uid } }, [\n                    _vm._v(\n                      _vm._s(_vm.$translate(\"Ceres::Template.loginPassword\")) +\n                        \"*\"\n                    ),\n                  ]),\n                ]\n              ),\n              _vm._v(\" \"),\n              _c(\"span\", { staticClass: \"error-msg\" }, [\n                _vm._v(\n                  _vm._s(_vm.$translate(\"Ceres::Template.loginEmptyPassword\"))\n                ),\n              ]),\n            ]),\n          ]),\n        ]),\n        _vm._v(\" \"),\n        _c(\n          \"div\",\n          {\n            class: {\n              \"modal-footer justify-content-between\": _vm.modalElement,\n              row: !_vm.modalElement,\n            },\n          },\n          [\n            _c(\"div\", { class: { \"col-7 col-sm-4\": !_vm.modalElement } }, [\n              _c(\n                \"a\",\n                {\n                  staticClass: \"small text-appearance\",\n                  attrs: { href: \"javascript:void(0)\" },\n                  on: { click: _vm.showResetPwdView },\n                },\n                [\n                  _vm._v(\n                    _vm._s(\n                      _vm.$translate(\"Ceres::Template.loginForgotPassword\")\n                    ) + \"?\"\n                  ),\n                ]\n              ),\n            ]),\n            _vm._v(\" \"),\n            _c(\n              \"div\",\n              { class: { \"col-5 col-sm-8 text-sm-right\": !_vm.modalElement } },\n              [\n                _vm._t(\"extend-overlay-buttons\"),\n                _vm._v(\" \"),\n                _c(\n                  \"button\",\n                  {\n                    staticClass: \"btn btn-primary btn-appearance btn-medium\",\n                    class: [\n                      { \"float-right\": !_vm.modalElement },\n                      _vm.buttonSizeClass,\n                    ],\n                    attrs: {\n                      \"data-testing\": \"submit-login\",\n                      disabled: _vm.isDisabled,\n                    },\n                    on: {\n                      click: function ($event) {\n                        $event.preventDefault()\n                        return _vm.validateLogin.apply(null, arguments)\n                      },\n                    },\n                  },\n                  [\n                    _vm._v(\n                      \"\\n                    \" +\n                        _vm._s(_vm.$translate(\"Ceres::Template.login\")) +\n                        \"\\n                    \"\n                    ),\n                    _c(\"icon\", {\n                      attrs: { icon: \"user\", loading: _vm.isDisabled },\n                    }),\n                  ],\n                  1\n                ),\n              ],\n              2\n            ),\n          ]\n        ),\n      ]\n    ),\n  ])\n}\nvar staticRenderFns = []\nrender._withStripped = true\n\nexport { render, staticRenderFns }","import mod from \"-!../../../../../../../../babel-loader/lib/index.js!../../../../../../../../vue-loader/lib/index.js??vue-loader-options!./Login.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../../../../../../babel-loader/lib/index.js!../../../../../../../../vue-loader/lib/index.js??vue-loader-options!./Login.vue?vue&type=script&lang=js&\"","<template>\n    <div class=\"login-pwd-reset\">\n        <form ref=\"loginForm\" :id=\"'login-form-' + _uid\" method=\"post\">\n            <div :class=\"{'modal-body': modalElement}\">\n                <div class=\"row\">\n                    <div class=\"col-12\">\n                        <div class=\"input-unit\" data-validate=\"mail\">\n                            <input data-testing=\"email-login\" type=\"email\" name=\"email\" autocomplete=\"email\" :id=\"'email' + _uid\" v-model=\"username\" data-autofocus>\n                            <label :for=\"'email' + _uid\">{{ $translate(\"Ceres::Template.loginEmail\") }}*</label>\n                        </div>\n                        <span class=\"error-msg\">{{ $translate(\"Ceres::Template.loginEnterConfirmEmail\") }}</span>\n                    </div>\n                    <div class=\"col-12\">\n                        <div class=\"input-unit\" :class=\"{'no-bottom': modalElement}\" data-validate=\"text\">\n                            <input data-testing=\"password-login\" type=\"password\" name=\"password\" autocomplete=\"current-password\" :id=\"'password' + _uid\" v-model=\"password\">\n                            <label :for=\"'password' + _uid\">{{ $translate(\"Ceres::Template.loginPassword\") }}*</label>\n                        </div>\n                        <span class=\"error-msg\">{{ $translate(\"Ceres::Template.loginEmptyPassword\") }}</span>\n                    </div>\n                </div>\n            </div>\n            <div :class=\"{'modal-footer justify-content-between': modalElement, 'row': !modalElement}\">\n                <div :class=\"{'col-7 col-sm-4': !modalElement}\">\n                    <a href=\"javascript:void(0)\" @click=\"showResetPwdView\" class=\"small text-appearance\">{{ $translate(\"Ceres::Template.loginForgotPassword\") }}?</a>\n                </div>\n                <div :class=\"{'col-5 col-sm-8 text-sm-right': !modalElement}\">\n                    <slot name=\"extend-overlay-buttons\"></slot>\n                    <button data-testing=\"submit-login\" @click.prevent=\"validateLogin\" :disabled=\"isDisabled\" class=\"btn btn-primary btn-appearance btn-medium\" :class=\"[{'float-right': !modalElement}, buttonSizeClass]\">\n                        {{ $translate(\"Ceres::Template.login\") }}\n                        <icon icon=\"user\" :loading=\"isDisabled\"></icon>\n                    </button>\n                </div>\n            </div>\n        </form>\n    </div>\n</template>\n\n<script>\nimport { ButtonSizePropertyMixin } from \"../../../mixins/buttonSizeProperty.mixin\";\n\nimport ApiService from \"../../../services/ApiService\";\nimport NotificationService from \"../../../services/NotificationService\";\nimport ModalService from \"../../../services/ModalService\";\nimport AutoFocusService from \"../../../services/AutoFocusService\";\nimport ValidationService from \"../../../services/ValidationService\";\nimport {getContainingComponent, isNullOrUndefined} from \"../../../helper/utils\";\n\nexport default {\n    mixins: [ButtonSizePropertyMixin],\n\n    props: {\n        backlink: {\n            type: String\n        },\n        modalElement: {\n            type: String\n        },\n        hasToForward:\n        {\n            type: Boolean,\n            default: false\n        }\n    },\n\n    data()\n    {\n        return {\n            password: \"\",\n            username: \"\",\n            loginFields: [],\n            isDisabled: false\n        };\n    },\n\n    mounted()\n    {\n        this.$nextTick(() =>\n        {\n            this.loginFields = this.$refs.loginForm.querySelectorAll(\".input-unit\");\n\n            AutoFocusService.triggerAutoFocus();\n        });\n    },\n\n    watch:\n    {\n        password(val, oldVal)\n        {\n            this.resetError();\n        },\n\n        username(val, oldVal)\n        {\n            this.resetError();\n        }\n    },\n\n    methods:\n    {\n        /**\n         * Open the login modal\n         */\n        showLogin()\n        {\n            ModalService.findModal(document.getElementById(this.modalElement)).show();\n        },\n\n        validateLogin()\n        {\n            ValidationService.validate($(\"#login-form-\" + this._uid))\n                .done(() =>\n                {\n                    this.sendLogin();\n                })\n                .fail(invalidFields =>\n                {\n                    ValidationService.markInvalidFields(invalidFields, \"error\");\n                });\n        },\n\n        /**\n         * Send the login data\n         */\n        sendLogin()\n        {\n            this.isDisabled = true;\n\n            ApiService.post(\"/rest/io/customer/login\", { email: this.username, password: this.password }, { supressNotifications: true })\n                .done(response =>\n                {\n                    ApiService.setToken(response);\n\n                    NotificationService.success(\n                        this.$translate(\"Ceres::Template.loginSuccessful\")\n                    ).closeAfter(3000);\n\n                    if (this.backlink !== null && this.backlink)\n                    {\n                        location.assign(decodeURIComponent(this.backlink));\n                    }\n                    else if (this.hasToForward)\n                    {\n                        location.assign(location.origin);\n                    }\n                    else\n                    {\n                        location.reload();\n                    }\n                })\n                .fail(response =>\n                {\n                    this.isDisabled = false;\n\n                    switch (response.error.code)\n                    {\n                        case 401:\n                            this.loginFields.forEach(element => element.classList.add(\"has-login-error\"));\n\n                            let translationKey = \"Ceres::Template.loginFailed\";\n\n                            if (response.error.message.length > 0 && response.error.message === \"user is blocked\")\n                            {\n                                translationKey = \"Ceres::Template.loginBlocked\";\n                            }\n                            NotificationService.error(\n                                this.$translate(translationKey)\n                            ).closeAfter(10000);\n                            break;\n                        default:\n                            return;\n                    }\n                });\n        },\n\n        showResetPwdView()\n        {\n            this.resetError();\n\n            this.$store.dispatch(\"loadComponent\", \"forgot-password-modal\");\n\n            Vue.nextTick(() =>\n            {\n                let modalDOM = document.querySelector('#resetPwd');\n                let modalVue = getContainingComponent(modalDOM);\n\n                modalVue.$data.username = this.username;\n\n                let showModal = () => ModalService.findModal(modalDOM).show();\n\n                if(this.modalElement)\n                {\n                    ModalService\n                        .findModal(document.getElementById(this.modalElement))\n                        .hide()\n                        .then(showModal);\n                }\n                else\n                {\n                    showModal();\n                }\n            });\n        },\n\n        resetError()\n        {\n            this.loginFields.forEach( element => element.classList.remove(\"has-login-error\"));\n            ValidationService.unmarkAllFields(\"#login-form-\" + this._uid);\n        }\n    }\n}\n</script>\n","import { render, staticRenderFns } from \"./Login.vue?vue&type=template&id=6a8641e0&\"\nimport script from \"./Login.vue?vue&type=script&lang=js&\"\nexport * from \"./Login.vue?vue&type=script&lang=js&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../../../../../vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n  script,\n  render,\n  staticRenderFns,\n  false,\n  null,\n  null,\n  null\n  \n)\n\nexport default component.exports"],"sourceRoot":""}