{"version":3,"sources":["webpack:///./resources/js/src/app/mixins/buttonSizeProperty.mixin.js","webpack:///./resources/js/src/app/components/customer/login/Login.vue?757e","webpack:///./resources/js/src/app/components/customer/login/Login.vue?01f7","webpack:///resources/js/src/app/components/customer/login/Login.vue","webpack:///./resources/js/src/app/components/customer/login/Login.vue"],"names":["BUTTON_SIZES","LEGACY_CLASS_MAP","ButtonSizePropertyMixin","props","buttonSize","type","String","default","validator","value","Object","keys","indexOf","computed","buttonSizeClass","hasOwnProperty","this","render","_vm","_h","$createElement","_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","icon","loading","_withStripped","component","options","__file"],"mappings":"26BAAA,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,IADG,OAEAT,EAFA,EAGAU,OAAOC,KAAKV,KACjBW,QAAQH,MAKtBI,SAAU,CACNC,gBADM,WAGF,OAAIb,EAAiBc,eAAeC,KAAKZ,YAE9BH,EAAiBe,KAAKZ,YAG1BY,KAAKZ,e,wCClCxB,IAAIa,EAAS,WACX,IAAIC,EAAMF,KACNG,EAAKD,EAAIE,eACTC,EAAKH,EAAII,MAAMD,IAAMF,EACzB,OAAOE,EAAG,MAAO,CAAEE,YAAa,mBAAqB,CACnDF,EACE,OACA,CACEG,IAAK,YACLC,MAAO,CAAEC,GAAI,cAAgBR,EAAIS,KAAMC,OAAQ,SAEjD,CACEP,EAAG,MAAO,CAAEQ,MAAO,CAAE,aAAcX,EAAIY,eAAkB,CACvDT,EAAG,MAAO,CAAEE,YAAa,OAAS,CAChCF,EAAG,MAAO,CAAEE,YAA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,GACM,YAAN,IAIE,QA3BF,WA4BI,IAAJ,OACI,KAAJ,sBAEM,EAAN,8DAEM,EAAN,+BAIE,MACF,CACI,SADJ,SACA,KAEM,KAAN,cAGI,SANJ,SAMA,KAEM,KAAN,eAIE,QACF,CAII,UAJJ,WAMM,EAAN,sEAGI,cATJ,WAUM,IAAN,OACM,EAAN,8CACA,iBAEQ,EAAR,eAEA,kBAEQ,EAAR,yCAOI,UAzBJ,WA0BM,IAAN,OACM,KAAN,cAEM,EAAN,wCAAQ,MAAR,cAAQ,SAAR,gBAAQ,sBAAR,IACA,kBAEQ,EAAR,oBAEQ,EAAR,gBACA,iDACA,gBAEA,8BAEU,SAAV,uCAEA,eAEU,SAAV,wBAIU,SAAV,YAGA,kBAIQ,OAFA,EAAR,cAEA,cAEU,KAAV,IACY,EAAZ,iCAAc,OAAd,sCAEY,IAAZ,gCAEA,gEAEc,EAAd,gCAEY,EAAZ,cACA,iBACA,gBACY,MACF,QACE,YAKR,iBA5EJ,WA6EM,IAAN,OACM,KAAN,aAEM,KAAN,yDAEM,IAAN,qBAEQ,IAAR,sCACA,eAEA,0BAEQ,IAAR,aAAU,OAAV,+BAEA,eAEU,EAAV,QACA,mDACA,OACA,QAIU,QAKN,WAzGJ,WA2GM,KAAN,iCAAQ,OAAR,yCACM,EAAN,qD,OCvMIC,EAAY,YACd,EACA3C,EHyLoB,IGvLpB,EACA,KACA,KACA,MAuBF2C,EAAUC,QAAQC,OAAS,2DACZ,UAAAF,E","file":"chunks/ceres-11.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() {\n  var _vm = this\n  var _h = _vm.$createElement\n  var _c = _vm._self._c || _h\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) {\n                          return\n                        }\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) {\n                          return\n                        }\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($event)\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 \"-!../../../../../../../node_modules/babel-loader/lib/index.js!../../../../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Login.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../../../../../node_modules/babel-loader/lib/index.js!../../../../../../../node_modules/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=0f0e37b8&\"\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 \"!../../../../../../../node_modules/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\n/* hot reload */\nif (module.hot) {\n  var api = require(\"/home/runner/work/plugin-ceres/plugin-ceres/node_modules/vue-hot-reload-api/dist/index.js\")\n  api.install(require('vue'))\n  if (api.compatible) {\n    module.hot.accept()\n    if (!api.isRecorded('0f0e37b8')) {\n      api.createRecord('0f0e37b8', component.options)\n    } else {\n      api.reload('0f0e37b8', component.options)\n    }\n    module.hot.accept(\"./Login.vue?vue&type=template&id=0f0e37b8&\", function () {\n      api.rerender('0f0e37b8', {\n        render: render,\n        staticRenderFns: staticRenderFns\n      })\n    })\n  }\n}\ncomponent.options.__file = \"resources/js/src/app/components/customer/login/Login.vue\"\nexport default component.exports"],"sourceRoot":""}