From 96b23acbb3dc9cffca7654561f17741a84f339ac Mon Sep 17 00:00:00 2001 From: Bachir Soussi Chiadmi Date: Sun, 6 Oct 2019 16:32:25 +0200 Subject: [PATCH] login from modal is working, register is lacking password generator --- .../custom/materiotheme/assets/dist/main.css | 14 ++- .../custom/materiotheme/assets/dist/main.js | 93 +++++++++++++++++- .../vuejs/components/Content/Product.vue | 37 ++++--- .../vuejs/components/Helper/LoginForm.vue | 58 +++++++++++ .../components/Helper/LoginRegisterForm.vue | 97 +++++++++++++++++++ .../vuejs/components/Helper/Modal.vue | 38 +++++++- .../materiotheme/vuejs/store/modules/user.js | 39 ++++++-- 7 files changed, 343 insertions(+), 33 deletions(-) create mode 100644 web/themes/custom/materiotheme/vuejs/components/Helper/LoginForm.vue create mode 100644 web/themes/custom/materiotheme/vuejs/components/Helper/LoginRegisterForm.vue diff --git a/web/themes/custom/materiotheme/assets/dist/main.css b/web/themes/custom/materiotheme/assets/dist/main.css index f6e8c2f9..4eff8bbc 100644 --- a/web/themes/custom/materiotheme/assets/dist/main.css +++ b/web/themes/custom/materiotheme/assets/dist/main.css @@ -10,13 +10,23 @@ .modal[data-v-b98ce164] { background-color: #fff; position: absolute; - width: 250px; - height: 200px; + box-sizing: border; + max-width: 80vw; + max-height: 70vh; top: 0; right: 0; bottom: 0; left: 0; margin: auto; + padding: 1em; + border-radius: 3px; + box-shadow: 2px 2px; +} + +fieldset[data-v-2952b9b1] { + padding: 0; + margin: 0; + border: none; } diff --git a/web/themes/custom/materiotheme/assets/dist/main.js b/web/themes/custom/materiotheme/assets/dist/main.js index 10a9f73b..292764e3 100644 --- a/web/themes/custom/materiotheme/assets/dist/main.js +++ b/web/themes/custom/materiotheme/assets/dist/main.js @@ -453,7 +453,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n /***/ (function(module, exports, __webpack_require__) { "use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _restAxios = __webpack_require__(/*! vuejs/api/rest-axios */ \"./web/themes/custom/materiotheme/vuejs/api/rest-axios.js\");\n\nvar _route = _interopRequireDefault(__webpack_require__(/*! vuejs/route */ \"./web/themes/custom/materiotheme/vuejs/route/index.js\"));\n\nvar _vuex = __webpack_require__(/*! vuex */ \"./node_modules/vuex/dist/vuex.esm.js\");\n\nvar _Modal = _interopRequireDefault(__webpack_require__(/*! vuejs/components/Helper/Modal */ \"./web/themes/custom/materiotheme/vuejs/components/Helper/Modal.vue\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nvar basePath = drupalSettings.path.baseUrl + drupalSettings.path.pathPrefix;\nvar _default = {\n name: \"Product\",\n router: _route.default,\n props: ['product'],\n data: function data() {\n return {\n quantity: 1,\n login: false,\n register: false\n };\n },\n computed: _objectSpread({}, (0, _vuex.mapState)({\n isloggedin: function isloggedin(state) {\n return state.User.isloggedin;\n }\n })),\n methods: _objectSpread({}, (0, _vuex.mapActions)({\n userLogin: 'User/userLogin'\n }), {\n checkaddtocart: function checkaddtocart() {\n console.log('checkaddtocart');\n\n if (!this.isloggedin) {\n // TODO: show popup login or register\n this.login = true; // TODO: rest login or register\n // TODO: rest login\n // TODO: this.addtocart()\n } else {\n this.addtocart();\n }\n },\n addtocart: function addtocart() {\n console.log(\"addtocart\");\n\n _restAxios.REST.post(\"/cart/add?_format=json\", [{\n \"purchased_entity_type\": \"commerce_product_variation\",\n \"purchased_entity_id\": this.product.variation_id,\n \"quantity\": this.quantity\n }]).then(function (_ref) {\n var data = _ref.data;\n console.log('product add to cart REST: data', data);\n }).catch(function (error) {\n console.warn('Issue with pricing', error);\n Promise.reject(error);\n });\n }\n }),\n components: {\n Modal: _Modal.default\n }\n};\nexports.default = _default;\n\n//# sourceURL=webpack:///./web/themes/custom/materiotheme/vuejs/components/Content/Product.vue?./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options"); +eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _restAxios = __webpack_require__(/*! vuejs/api/rest-axios */ \"./web/themes/custom/materiotheme/vuejs/api/rest-axios.js\");\n\nvar _route = _interopRequireDefault(__webpack_require__(/*! vuejs/route */ \"./web/themes/custom/materiotheme/vuejs/route/index.js\"));\n\nvar _vuex = __webpack_require__(/*! vuex */ \"./node_modules/vuex/dist/vuex.esm.js\");\n\nvar _Modal = _interopRequireDefault(__webpack_require__(/*! vuejs/components/Helper/Modal */ \"./web/themes/custom/materiotheme/vuejs/components/Helper/Modal.vue\"));\n\nvar _LoginRegisterForm = _interopRequireDefault(__webpack_require__(/*! vuejs/components/Helper/LoginRegisterForm */ \"./web/themes/custom/materiotheme/vuejs/components/Helper/LoginRegisterForm.vue\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nvar basePath = drupalSettings.path.baseUrl + drupalSettings.path.pathPrefix;\nvar _default = {\n name: \"Product\",\n router: _route.default,\n props: ['product'],\n data: function data() {\n return {\n quantity: 1,\n showLoginModal: false\n };\n },\n computed: _objectSpread({}, (0, _vuex.mapState)({\n isloggedin: function isloggedin(state) {\n return state.User.isloggedin;\n },\n isAdherent: function isAdherent(state) {\n return state.User.isAdherent;\n }\n })),\n methods: {\n // ...mapActions({\n // userLogin: 'User/userLogin'\n // }),\n closeModal: function closeModal() {\n this.showLoginModal = false;\n },\n checkaddtocart: function checkaddtocart() {\n console.log('checkaddtocart');\n\n if (!this.isloggedin) {\n // TODO: show popup login or register\n this.showLoginModal = true; // TODO: rest login or register\n // TODO: rest login\n // TODO: this.addtocart()\n } else {\n this.addtocart();\n }\n },\n logedIn: function logedIn() {\n console.log('Product: logedIn');\n this.closeModal();\n },\n addtocart: function addtocart() {\n console.log(\"addtocart\");\n\n _restAxios.REST.post(\"/cart/add?_format=json\", [{\n \"purchased_entity_type\": \"commerce_product_variation\",\n \"purchased_entity_id\": this.product.variation_id,\n \"quantity\": this.quantity\n }]).then(function (_ref) {\n var data = _ref.data;\n console.log('product add to cart REST: data', data);\n }).catch(function (error) {\n console.warn('Issue with pricing', error);\n Promise.reject(error);\n });\n }\n },\n components: {\n Modal: _Modal.default,\n LoginRegisterForm: _LoginRegisterForm.default\n }\n};\nexports.default = _default;\n\n//# sourceURL=webpack:///./web/themes/custom/materiotheme/vuejs/components/Content/Product.vue?./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options"); /***/ }), @@ -481,6 +481,18 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n /***/ }), +/***/ "./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/index.js?!./web/themes/custom/materiotheme/vuejs/components/Helper/LoginRegisterForm.vue?vue&type=script&lang=js&": +/*!*************************************************************************************************************************************************************************************************!*\ + !*** ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./web/themes/custom/materiotheme/vuejs/components/Helper/LoginRegisterForm.vue?vue&type=script&lang=js& ***! + \*************************************************************************************************************************************************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _vuex = __webpack_require__(/*! vuex */ \"./node_modules/vuex/dist/vuex.esm.js\");\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nvar _default = {\n name: \"LoginForm\",\n data: function data() {\n return {\n loginEmail: null,\n password: null,\n registerEmail: null\n };\n },\n methods: _objectSpread({}, (0, _vuex.mapActions)({\n userLogin: 'User/userLogin',\n userRegister: 'User/userRegister'\n }), {\n onLogin: function onLogin() {\n var _this = this;\n\n this.userLogin({\n mail: this.loginEmail,\n pass: this.password\n }).then(function () {\n console.log('logedin from login component');\n\n _this.$emit('onLogedIn');\n }).catch(function (error) {\n console.warn('Issue with login from login component', error);\n Promise.reject(error);\n });\n },\n onRegister: function onRegister() {\n console.log('on register');\n this.userRegister({\n mail: this.registerEmail\n }).then(function () {\n console.log('user registered');\n }).catch(function (error) {\n console.warn('Issue with register from login component', error);\n Promise.reject(error);\n });\n }\n })\n};\nexports.default = _default;\n\n//# sourceURL=webpack:///./web/themes/custom/materiotheme/vuejs/components/Helper/LoginRegisterForm.vue?./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options"); + +/***/ }), + /***/ "./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/index.js?!./web/themes/custom/materiotheme/vuejs/components/Helper/Modal.vue?vue&type=script&lang=js&": /*!*************************************************************************************************************************************************************************************!*\ !*** ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./web/themes/custom/materiotheme/vuejs/components/Helper/Modal.vue?vue&type=script&lang=js& ***! @@ -489,7 +501,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n /***/ (function(module, exports, __webpack_require__) { "use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n//\n//\n//\n//\n//\n//\n//\nvar _default = {\n name: \"\",\n data: function data() {\n return {};\n }\n};\nexports.default = _default;\n\n//# sourceURL=webpack:///./web/themes/custom/materiotheme/vuejs/components/Helper/Modal.vue?./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options"); +eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\nvar _default2 = {\n name: \"\",\n props: {\n styles: {\n default: function _default() {\n return {\n width: '500px',\n height: '350px'\n };\n },\n type: Object\n }\n },\n data: function data() {\n return {};\n },\n methods: {\n close: function close() {\n console.log('click close');\n this.$emit('close');\n }\n }\n};\nexports.default = _default2;\n\n//# sourceURL=webpack:///./web/themes/custom/materiotheme/vuejs/components/Helper/Modal.vue?./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options"); /***/ }), @@ -611,6 +623,17 @@ eval("// extracted by mini-css-extract-plugin\n\n//# sourceURL=webpack:///./web/ /***/ }), +/***/ "./node_modules/mini-css-extract-plugin/dist/loader.js!./node_modules/css-loader/dist/cjs.js!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/sass-loader/lib/loader.js!./node_modules/vue-loader/lib/index.js?!./web/themes/custom/materiotheme/vuejs/components/Helper/LoginRegisterForm.vue?vue&type=style&index=0&id=2952b9b1&lang=scss&scoped=true&": +/*!************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\ + !*** ./node_modules/mini-css-extract-plugin/dist/loader.js!./node_modules/css-loader/dist/cjs.js!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/sass-loader/lib/loader.js!./node_modules/vue-loader/lib??vue-loader-options!./web/themes/custom/materiotheme/vuejs/components/Helper/LoginRegisterForm.vue?vue&type=style&index=0&id=2952b9b1&lang=scss&scoped=true& ***! + \************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +eval("// extracted by mini-css-extract-plugin\n\n//# sourceURL=webpack:///./web/themes/custom/materiotheme/vuejs/components/Helper/LoginRegisterForm.vue?./node_modules/mini-css-extract-plugin/dist/loader.js!./node_modules/css-loader/dist/cjs.js!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/sass-loader/lib/loader.js!./node_modules/vue-loader/lib??vue-loader-options"); + +/***/ }), + /***/ "./node_modules/mini-css-extract-plugin/dist/loader.js!./node_modules/css-loader/dist/cjs.js!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/sass-loader/lib/loader.js!./node_modules/vue-loader/lib/index.js?!./web/themes/custom/materiotheme/vuejs/components/Helper/Modal.vue?vue&type=style&index=0&id=b98ce164&lang=scss&scoped=true&": /*!************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\ !*** ./node_modules/mini-css-extract-plugin/dist/loader.js!./node_modules/css-loader/dist/cjs.js!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/sass-loader/lib/loader.js!./node_modules/vue-loader/lib??vue-loader-options!./web/themes/custom/materiotheme/vuejs/components/Helper/Modal.vue?vue&type=style&index=0&id=b98ce164&lang=scss&scoped=true& ***! @@ -781,7 +804,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) * /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"render\", function() { return render; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"staticRenderFns\", function() { return staticRenderFns; });\nvar render = function() {\n var _vm = this\n var _h = _vm.$createElement\n var _c = _vm._self._c || _h\n return _c(\n \"article\",\n { staticClass: \"product\" },\n [\n _c(\"header\", [\n _c(\"h1\", { domProps: { innerHTML: _vm._s(_vm.product.title) } })\n ]),\n _vm._v(\" \"),\n _c(\"section\", { staticClass: \"content\" }, [\n _c(\"div\", {\n staticClass: \"description\",\n domProps: { innerHTML: _vm._s(_vm.product.field_description) }\n }),\n _vm._v(\" \"),\n _c(\"span\", { staticClass: \"price\" }, [\n _vm._v(_vm._s(_vm.product.price__number))\n ])\n ]),\n _vm._v(\" \"),\n _c(\"aside\", {}, [\n _vm.product.field_multiple\n ? _c(\"input\", {\n directives: [\n {\n name: \"model\",\n rawName: \"v-model\",\n value: _vm.quantity,\n expression: \"quantity\"\n }\n ],\n attrs: {\n placeholder: \"quantity\",\n type: \"text\",\n name: \"quantity\",\n value: \"1\"\n },\n domProps: { value: _vm.quantity },\n on: {\n input: function($event) {\n if ($event.target.composing) {\n return\n }\n _vm.quantity = $event.target.value\n }\n }\n })\n : _vm._e(),\n _vm._v(\" \"),\n _c(\n \"button\",\n {\n attrs: { type: \"button\", name: \"addtocart\" },\n on: {\n click: function($event) {\n $event.stopPropagation()\n return _vm.checkaddtocart($event)\n }\n }\n },\n [_vm._v(\"\\n Commander\\n \")]\n )\n ]),\n _vm._v(\" \"),\n _vm.login ? _c(\"Modal\", [_vm._v(\"\\n i'm a modal\\n \")]) : _vm._e()\n ],\n 1\n )\n}\nvar staticRenderFns = []\nrender._withStripped = true\n\n\n\n//# sourceURL=webpack:///./web/themes/custom/materiotheme/vuejs/components/Content/Product.vue?./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"render\", function() { return render; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"staticRenderFns\", function() { return staticRenderFns; });\nvar render = function() {\n var _vm = this\n var _h = _vm.$createElement\n var _c = _vm._self._c || _h\n return _c(\n \"article\",\n { staticClass: \"product\" },\n [\n _c(\"header\", [\n _c(\"h1\", { domProps: { innerHTML: _vm._s(_vm.product.title) } })\n ]),\n _vm._v(\" \"),\n _c(\"section\", { staticClass: \"content\" }, [\n _c(\"div\", {\n staticClass: \"description\",\n domProps: { innerHTML: _vm._s(_vm.product.field_description) }\n }),\n _vm._v(\" \"),\n _c(\"span\", { staticClass: \"price\" }, [\n _vm._v(_vm._s(_vm.product.price__number))\n ])\n ]),\n _vm._v(\" \"),\n !_vm.isAdherent\n ? _c(\"aside\", [\n _vm.product.field_multiple\n ? _c(\"input\", {\n directives: [\n {\n name: \"model\",\n rawName: \"v-model\",\n value: _vm.quantity,\n expression: \"quantity\"\n }\n ],\n attrs: {\n placeholder: \"quantity\",\n type: \"text\",\n name: \"quantity\",\n value: \"1\"\n },\n domProps: { value: _vm.quantity },\n on: {\n input: function($event) {\n if ($event.target.composing) {\n return\n }\n _vm.quantity = $event.target.value\n }\n }\n })\n : _vm._e(),\n _vm._v(\" \"),\n _c(\n \"button\",\n {\n attrs: { type: \"button\", name: \"addtocart\" },\n on: {\n click: function($event) {\n $event.stopPropagation()\n return _vm.checkaddtocart($event)\n }\n }\n },\n [_vm._v(\"\\n Commander\\n \")]\n )\n ])\n : _vm._e(),\n _vm._v(\" \"),\n _vm.showLoginModal\n ? _c(\n \"Modal\",\n { on: { close: _vm.closeModal } },\n [\n _c(\"div\", [\n _vm._v(\n \"\\n Please login or register before continue.\\n \"\n )\n ]),\n _vm._v(\" \"),\n _c(\"LoginRegisterForm\", { on: { onLogedIn: _vm.logedIn } })\n ],\n 1\n )\n : _vm._e()\n ],\n 1\n )\n}\nvar staticRenderFns = []\nrender._withStripped = true\n\n\n\n//# sourceURL=webpack:///./web/themes/custom/materiotheme/vuejs/components/Content/Product.vue?./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options"); /***/ }), @@ -797,6 +820,18 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) * /***/ }), +/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./web/themes/custom/materiotheme/vuejs/components/Helper/LoginRegisterForm.vue?vue&type=template&id=2952b9b1&scoped=true&": +/*!***************************************************************************************************************************************************************************************************************************************************************!*\ + !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./web/themes/custom/materiotheme/vuejs/components/Helper/LoginRegisterForm.vue?vue&type=template&id=2952b9b1&scoped=true& ***! + \***************************************************************************************************************************************************************************************************************************************************************/ +/*! exports provided: render, staticRenderFns */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"render\", function() { return render; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"staticRenderFns\", function() { return staticRenderFns; });\nvar render = function() {\n var _vm = this\n var _h = _vm.$createElement\n var _c = _vm._self._c || _h\n return _c(\"div\", { attrs: { id: \"login-form\" } }, [\n _c(\"fieldset\", { staticClass: \"login\" }, [\n _c(\"h2\", [_vm._v(\"Login\")]),\n _vm._v(\" \"),\n _c(\"input\", {\n directives: [\n {\n name: \"model\",\n rawName: \"v-model\",\n value: _vm.loginEmail,\n expression: \"loginEmail\"\n }\n ],\n attrs: { type: \"email\", name: \"email\", placeholder: \"Email\" },\n domProps: { value: _vm.loginEmail },\n on: {\n input: function($event) {\n if ($event.target.composing) {\n return\n }\n _vm.loginEmail = $event.target.value\n }\n }\n }),\n _vm._v(\" \"),\n _c(\"input\", {\n directives: [\n {\n name: \"model\",\n rawName: \"v-model\",\n value: _vm.password,\n expression: \"password\"\n }\n ],\n attrs: { type: \"password\", name: \"password\", placeholder: \"Password\" },\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(\n \"button\",\n {\n attrs: { type: \"button\", name: \"login\" },\n on: {\n click: function($event) {\n $event.stopPropagation()\n return _vm.onLogin($event)\n }\n }\n },\n [_vm._v(\"\\n login\\n \")]\n )\n ]),\n _vm._v(\" \"),\n _c(\"fieldset\", { staticClass: \"register\" }, [\n _c(\"h2\", [_vm._v(\"Or register\")]),\n _vm._v(\" \"),\n _c(\"input\", {\n directives: [\n {\n name: \"model\",\n rawName: \"v-model\",\n value: _vm.registerEmail,\n expression: \"registerEmail\"\n }\n ],\n attrs: { type: \"email\", name: \"email\", placeholder: \"Email\" },\n domProps: { value: _vm.registerEmail },\n on: {\n input: function($event) {\n if ($event.target.composing) {\n return\n }\n _vm.registerEmail = $event.target.value\n }\n }\n }),\n _vm._v(\" \"),\n _c(\n \"button\",\n {\n attrs: { type: \"button\", name: \"register\" },\n on: {\n click: function($event) {\n $event.stopPropagation()\n return _vm.onRegister($event)\n }\n }\n },\n [_vm._v(\"\\n register\\n \")]\n )\n ])\n ])\n}\nvar staticRenderFns = []\nrender._withStripped = true\n\n\n\n//# sourceURL=webpack:///./web/themes/custom/materiotheme/vuejs/components/Helper/LoginRegisterForm.vue?./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options"); + +/***/ }), + /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./web/themes/custom/materiotheme/vuejs/components/Helper/Modal.vue?vue&type=template&id=b98ce164&scoped=true&": /*!***************************************************************************************************************************************************************************************************************************************************!*\ !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./web/themes/custom/materiotheme/vuejs/components/Helper/Modal.vue?vue&type=template&id=b98ce164&scoped=true& ***! @@ -805,7 +840,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) * /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"render\", function() { return render; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"staticRenderFns\", function() { return staticRenderFns; });\nvar render = function() {\n var _vm = this\n var _h = _vm.$createElement\n var _c = _vm._self._c || _h\n return _c(\"div\", { staticClass: \"overlay\" }, [\n _c(\"div\", { staticClass: \"modal\" }, [_vm._t(\"default\")], 2)\n ])\n}\nvar staticRenderFns = []\nrender._withStripped = true\n\n\n\n//# sourceURL=webpack:///./web/themes/custom/materiotheme/vuejs/components/Helper/Modal.vue?./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"render\", function() { return render; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"staticRenderFns\", function() { return staticRenderFns; });\nvar render = function() {\n var _vm = this\n var _h = _vm.$createElement\n var _c = _vm._self._c || _h\n return _c(\n \"div\",\n {\n staticClass: \"overlay\",\n on: {\n click: function($event) {\n if ($event.target !== $event.currentTarget) {\n return null\n }\n return _vm.close($event)\n }\n }\n },\n [\n _c(\n \"div\",\n { staticClass: \"modal\", style: _vm.styles },\n [_vm._t(\"default\")],\n 2\n )\n ]\n )\n}\nvar staticRenderFns = []\nrender._withStripped = true\n\n\n\n//# sourceURL=webpack:///./web/themes/custom/materiotheme/vuejs/components/Helper/Modal.vue?./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options"); /***/ }), @@ -1322,6 +1357,54 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _nod /***/ }), +/***/ "./web/themes/custom/materiotheme/vuejs/components/Helper/LoginRegisterForm.vue": +/*!**************************************************************************************!*\ + !*** ./web/themes/custom/materiotheme/vuejs/components/Helper/LoginRegisterForm.vue ***! + \**************************************************************************************/ +/*! no static exports found */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _LoginRegisterForm_vue_vue_type_template_id_2952b9b1_scoped_true___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./LoginRegisterForm.vue?vue&type=template&id=2952b9b1&scoped=true& */ \"./web/themes/custom/materiotheme/vuejs/components/Helper/LoginRegisterForm.vue?vue&type=template&id=2952b9b1&scoped=true&\");\n/* harmony import */ var _LoginRegisterForm_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./LoginRegisterForm.vue?vue&type=script&lang=js& */ \"./web/themes/custom/materiotheme/vuejs/components/Helper/LoginRegisterForm.vue?vue&type=script&lang=js&\");\n/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _LoginRegisterForm_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__) if(__WEBPACK_IMPORT_KEY__ !== 'default') (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _LoginRegisterForm_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__[key]; }) }(__WEBPACK_IMPORT_KEY__));\n/* harmony import */ var _LoginRegisterForm_vue_vue_type_style_index_0_id_2952b9b1_lang_scss_scoped_true___WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./LoginRegisterForm.vue?vue&type=style&index=0&id=2952b9b1&lang=scss&scoped=true& */ \"./web/themes/custom/materiotheme/vuejs/components/Helper/LoginRegisterForm.vue?vue&type=style&index=0&id=2952b9b1&lang=scss&scoped=true&\");\n/* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../../../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ \"./node_modules/vue-loader/lib/runtime/componentNormalizer.js\");\n\n\n\n\n\n\n/* normalize component */\n\nvar component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(\n _LoginRegisterForm_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__[\"default\"],\n _LoginRegisterForm_vue_vue_type_template_id_2952b9b1_scoped_true___WEBPACK_IMPORTED_MODULE_0__[\"render\"],\n _LoginRegisterForm_vue_vue_type_template_id_2952b9b1_scoped_true___WEBPACK_IMPORTED_MODULE_0__[\"staticRenderFns\"],\n false,\n null,\n \"2952b9b1\",\n null\n \n)\n\n/* hot reload */\nif (false) { var api; }\ncomponent.options.__file = \"web/themes/custom/materiotheme/vuejs/components/Helper/LoginRegisterForm.vue\"\n/* harmony default export */ __webpack_exports__[\"default\"] = (component.exports);\n\n//# sourceURL=webpack:///./web/themes/custom/materiotheme/vuejs/components/Helper/LoginRegisterForm.vue?"); + +/***/ }), + +/***/ "./web/themes/custom/materiotheme/vuejs/components/Helper/LoginRegisterForm.vue?vue&type=script&lang=js&": +/*!***************************************************************************************************************!*\ + !*** ./web/themes/custom/materiotheme/vuejs/components/Helper/LoginRegisterForm.vue?vue&type=script&lang=js& ***! + \***************************************************************************************************************/ +/*! no static exports found */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _node_modules_babel_loader_lib_index_js_node_modules_vue_loader_lib_index_js_vue_loader_options_LoginRegisterForm_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../../../../../node_modules/babel-loader/lib!../../../../../../../node_modules/vue-loader/lib??vue-loader-options!./LoginRegisterForm.vue?vue&type=script&lang=js& */ \"./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/index.js?!./web/themes/custom/materiotheme/vuejs/components/Helper/LoginRegisterForm.vue?vue&type=script&lang=js&\");\n/* harmony import */ var _node_modules_babel_loader_lib_index_js_node_modules_vue_loader_lib_index_js_vue_loader_options_LoginRegisterForm_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_babel_loader_lib_index_js_node_modules_vue_loader_lib_index_js_vue_loader_options_LoginRegisterForm_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__);\n/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _node_modules_babel_loader_lib_index_js_node_modules_vue_loader_lib_index_js_vue_loader_options_LoginRegisterForm_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== 'default') (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _node_modules_babel_loader_lib_index_js_node_modules_vue_loader_lib_index_js_vue_loader_options_LoginRegisterForm_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__[key]; }) }(__WEBPACK_IMPORT_KEY__));\n /* harmony default export */ __webpack_exports__[\"default\"] = (_node_modules_babel_loader_lib_index_js_node_modules_vue_loader_lib_index_js_vue_loader_options_LoginRegisterForm_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0___default.a); \n\n//# sourceURL=webpack:///./web/themes/custom/materiotheme/vuejs/components/Helper/LoginRegisterForm.vue?"); + +/***/ }), + +/***/ "./web/themes/custom/materiotheme/vuejs/components/Helper/LoginRegisterForm.vue?vue&type=style&index=0&id=2952b9b1&lang=scss&scoped=true&": +/*!************************************************************************************************************************************************!*\ + !*** ./web/themes/custom/materiotheme/vuejs/components/Helper/LoginRegisterForm.vue?vue&type=style&index=0&id=2952b9b1&lang=scss&scoped=true& ***! + \************************************************************************************************************************************************/ +/*! no static exports found */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_node_modules_css_loader_dist_cjs_js_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_sass_loader_lib_loader_js_node_modules_vue_loader_lib_index_js_vue_loader_options_LoginRegisterForm_vue_vue_type_style_index_0_id_2952b9b1_lang_scss_scoped_true___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../../../../../node_modules/mini-css-extract-plugin/dist/loader.js!../../../../../../../node_modules/css-loader/dist/cjs.js!../../../../../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../../../../../node_modules/sass-loader/lib/loader.js!../../../../../../../node_modules/vue-loader/lib??vue-loader-options!./LoginRegisterForm.vue?vue&type=style&index=0&id=2952b9b1&lang=scss&scoped=true& */ \"./node_modules/mini-css-extract-plugin/dist/loader.js!./node_modules/css-loader/dist/cjs.js!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/sass-loader/lib/loader.js!./node_modules/vue-loader/lib/index.js?!./web/themes/custom/materiotheme/vuejs/components/Helper/LoginRegisterForm.vue?vue&type=style&index=0&id=2952b9b1&lang=scss&scoped=true&\");\n/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_node_modules_css_loader_dist_cjs_js_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_sass_loader_lib_loader_js_node_modules_vue_loader_lib_index_js_vue_loader_options_LoginRegisterForm_vue_vue_type_style_index_0_id_2952b9b1_lang_scss_scoped_true___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_dist_loader_js_node_modules_css_loader_dist_cjs_js_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_sass_loader_lib_loader_js_node_modules_vue_loader_lib_index_js_vue_loader_options_LoginRegisterForm_vue_vue_type_style_index_0_id_2952b9b1_lang_scss_scoped_true___WEBPACK_IMPORTED_MODULE_0__);\n/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _node_modules_mini_css_extract_plugin_dist_loader_js_node_modules_css_loader_dist_cjs_js_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_sass_loader_lib_loader_js_node_modules_vue_loader_lib_index_js_vue_loader_options_LoginRegisterForm_vue_vue_type_style_index_0_id_2952b9b1_lang_scss_scoped_true___WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== 'default') (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _node_modules_mini_css_extract_plugin_dist_loader_js_node_modules_css_loader_dist_cjs_js_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_sass_loader_lib_loader_js_node_modules_vue_loader_lib_index_js_vue_loader_options_LoginRegisterForm_vue_vue_type_style_index_0_id_2952b9b1_lang_scss_scoped_true___WEBPACK_IMPORTED_MODULE_0__[key]; }) }(__WEBPACK_IMPORT_KEY__));\n /* harmony default export */ __webpack_exports__[\"default\"] = (_node_modules_mini_css_extract_plugin_dist_loader_js_node_modules_css_loader_dist_cjs_js_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_sass_loader_lib_loader_js_node_modules_vue_loader_lib_index_js_vue_loader_options_LoginRegisterForm_vue_vue_type_style_index_0_id_2952b9b1_lang_scss_scoped_true___WEBPACK_IMPORTED_MODULE_0___default.a); \n\n//# sourceURL=webpack:///./web/themes/custom/materiotheme/vuejs/components/Helper/LoginRegisterForm.vue?"); + +/***/ }), + +/***/ "./web/themes/custom/materiotheme/vuejs/components/Helper/LoginRegisterForm.vue?vue&type=template&id=2952b9b1&scoped=true&": +/*!*********************************************************************************************************************************!*\ + !*** ./web/themes/custom/materiotheme/vuejs/components/Helper/LoginRegisterForm.vue?vue&type=template&id=2952b9b1&scoped=true& ***! + \*********************************************************************************************************************************/ +/*! exports provided: render, staticRenderFns */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_LoginRegisterForm_vue_vue_type_template_id_2952b9b1_scoped_true___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../../../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../../../../../node_modules/vue-loader/lib??vue-loader-options!./LoginRegisterForm.vue?vue&type=template&id=2952b9b1&scoped=true& */ \"./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./web/themes/custom/materiotheme/vuejs/components/Helper/LoginRegisterForm.vue?vue&type=template&id=2952b9b1&scoped=true&\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"render\", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_LoginRegisterForm_vue_vue_type_template_id_2952b9b1_scoped_true___WEBPACK_IMPORTED_MODULE_0__[\"render\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"staticRenderFns\", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_LoginRegisterForm_vue_vue_type_template_id_2952b9b1_scoped_true___WEBPACK_IMPORTED_MODULE_0__[\"staticRenderFns\"]; });\n\n\n\n//# sourceURL=webpack:///./web/themes/custom/materiotheme/vuejs/components/Helper/LoginRegisterForm.vue?"); + +/***/ }), + /***/ "./web/themes/custom/materiotheme/vuejs/components/Helper/Modal.vue": /*!**************************************************************************!*\ !*** ./web/themes/custom/materiotheme/vuejs/components/Helper/Modal.vue ***! @@ -1750,7 +1833,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n /***/ (function(module, exports, __webpack_require__) { "use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _restAxios = __webpack_require__(/*! vuejs/api/rest-axios */ \"./web/themes/custom/materiotheme/vuejs/api/rest-axios.js\");\n\nvar _jsonAxios = __webpack_require__(/*! vuejs/api/json-axios */ \"./web/themes/custom/materiotheme/vuejs/api/json-axios.js\");\n\nvar _querystring = _interopRequireDefault(__webpack_require__(/*! querystring */ \"./node_modules/querystring-es3/index.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar _default = {\n namespaced: true,\n // initial state\n state: {\n uid: null,\n // username: '',\n mail: '',\n token: null,\n logout_token: null,\n isloggedin: false,\n isAdmin: false,\n canSearch: false\n },\n // getters\n getters: {},\n // mutations\n mutations: {\n setToken: function setToken(state, data) {\n state.uid = data.current_user.uid; // state.username = data.username\n\n state.mail = data.current_user.mail;\n state.token = data.csrf_token;\n state.isloggedin = true;\n state.logout_token = data.logout_token;\n },\n setUid: function setUid(state, uid) {\n state.uid = uid;\n state.isloggedin = true;\n },\n setUser: function setUser(state, data) {\n state.mail = data.mail[0].value;\n state.uuid = data.uuid[0].value;\n },\n setRoles: function setRoles(state, roles) {\n console.log(\"User setRoles\", roles);\n state.roles = [];\n\n for (var i = 0; i < roles.length; i++) {\n state.roles.push(roles[i].target_id);\n } // check if admin\n\n\n if (state.roles.indexOf('admin') != -1 || state.roles.indexOf('root') != -1) {\n // console.log('is admin');\n state.isAdmin = true;\n } // check if has access to search\n\n\n if (state.roles.indexOf('adherent') != -1) {\n // console.log('is admin');\n state.canSearch = true;\n }\n },\n setLoggedOut: function setLoggedOut(state) {\n console.log(\"setLoggedOut state\", state);\n state.uid = null;\n state.mail = '';\n state.token = null;\n state.isloggedin = false;\n state.logout_token = null;\n\n if (state.isAdmin) {\n window.location.reload(true);\n }\n\n state.asAdmin = false;\n state.canSearch = false;\n }\n },\n // actions\n actions: {\n userLogin: function userLogin(_ref, credentials) {\n var dispatch = _ref.dispatch,\n commit = _ref.commit,\n state = _ref.state;\n dispatch('getToken', credentials).then(function () {\n dispatch('getUser').then(function (userdata) {\n console.log('User Loggedin');\n\n if (state.isAdmin) {\n window.location.reload(true);\n }\n });\n });\n },\n getToken: function getToken(_ref2, credentials) {\n var dispatch = _ref2.dispatch,\n commit = _ref2.commit,\n state = _ref2.state;\n return _restAxios.REST.post('/user/login?_format=json', credentials).then(function (_ref3) {\n var data = _ref3.data;\n console.log('user REST getToken data', data);\n commit('setToken', data);\n }).catch(function (error) {\n console.warn('Issue with getToken', error);\n Promise.reject(error);\n });\n },\n getUser: function getUser(_ref4) {\n var dispatch = _ref4.dispatch,\n commit = _ref4.commit,\n state = _ref4.state;\n var params = {\n token: state.token\n };\n return _restAxios.REST.get(\"/user/\".concat(state.uid, \"?_format=json\"), params).then(function (_ref5) {\n var data = _ref5.data;\n console.log('user REST getUser data', data);\n console.log('roles', data['roles']);\n commit('setUser', data);\n\n if (data.roles) {\n commit('setRoles', data.roles);\n }\n }).catch(function (error) {\n console.warn('Issue with getUser', error);\n Promise.reject(error);\n });\n },\n userLogout: function userLogout(_ref6) {\n var commit = _ref6.commit,\n state = _ref6.state;\n\n var credentials = _querystring.default.stringify({\n token: state.token\n });\n\n _restAxios.REST.post('/user/logout', credentials).then(function (resp) {\n console.log('userLogout resp', resp);\n commit('setLoggedOut');\n }).catch(function (error) {\n console.warn('Issue with logout', error);\n Promise.reject(error);\n });\n }\n }\n};\nexports.default = _default;\n\n//# sourceURL=webpack:///./web/themes/custom/materiotheme/vuejs/store/modules/user.js?"); +eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _restAxios = __webpack_require__(/*! vuejs/api/rest-axios */ \"./web/themes/custom/materiotheme/vuejs/api/rest-axios.js\");\n\nvar _jsonAxios = __webpack_require__(/*! vuejs/api/json-axios */ \"./web/themes/custom/materiotheme/vuejs/api/json-axios.js\");\n\nvar _querystring = _interopRequireDefault(__webpack_require__(/*! querystring */ \"./node_modules/querystring-es3/index.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar _default = {\n namespaced: true,\n // initial state\n state: {\n uid: null,\n // username: '',\n mail: '',\n token: null,\n logout_token: null,\n isloggedin: false,\n isAdmin: false,\n isAdherent: false,\n canSearch: false,\n roles: []\n },\n // getters\n getters: {},\n // mutations\n mutations: {\n setToken: function setToken(state, data) {\n state.uid = data.current_user.uid; // state.username = data.username\n\n state.mail = data.current_user.mail;\n state.token = data.csrf_token;\n state.isloggedin = true;\n state.logout_token = data.logout_token;\n },\n setUid: function setUid(state, uid) {\n state.uid = uid;\n state.isloggedin = true;\n },\n setUser: function setUser(state, data) {\n state.mail = data.mail[0].value;\n state.uuid = data.uuid[0].value;\n },\n setRoles: function setRoles(state, roles) {\n console.log(\"User setRoles\", roles);\n state.roles = [];\n\n for (var i = 0; i < roles.length; i++) {\n state.roles.push(roles[i].target_id);\n } // check if admin\n\n\n if (state.roles.indexOf('admin') != -1 || state.roles.indexOf('root') != -1) {\n // console.log('is admin');\n state.isAdmin = true;\n } // check if has access to search\n\n\n if (state.roles.indexOf('adherent') != -1) {\n // console.log('is admin');\n state.canSearch = true;\n state.isAdherent = true;\n }\n },\n setLoggedOut: function setLoggedOut(state) {\n console.log(\"setLoggedOut state\", state);\n state.uid = null;\n state.mail = '';\n state.token = null;\n state.isloggedin = false;\n state.logout_token = null;\n\n if (state.isAdmin) {\n window.location.reload(true);\n }\n\n state.asAdmin = false;\n state.canSearch = false;\n }\n },\n // actions\n actions: {\n userRegister: function userRegister(_ref, credentials) {\n var dispatch = _ref.dispatch,\n commit = _ref.commit,\n state = _ref.state;\n return new Promise(function (resolve, reject) {\n _restAxios.REST.post('/user/register?_format=json', credentials).then(function (_ref2) {\n var data = _ref2.data;\n console.log('user REST registered', data);\n resolve();\n }).catch(function (error) {\n console.warn('Issue with register', error);\n Promise.reject(error);\n });\n });\n },\n userLogin: function userLogin(_ref3, credentials) {\n var dispatch = _ref3.dispatch,\n commit = _ref3.commit,\n state = _ref3.state;\n return new Promise(function (resolve, reject) {\n dispatch('getToken', credentials).then(function () {\n dispatch('getUser').then(function (userdata) {\n console.log('User Loggedin');\n\n if (state.isAdmin) {\n window.location.reload(true);\n }\n\n resolve();\n });\n });\n });\n },\n getToken: function getToken(_ref4, credentials) {\n var dispatch = _ref4.dispatch,\n commit = _ref4.commit,\n state = _ref4.state;\n return _restAxios.REST.post('/user/login?_format=json', credentials).then(function (_ref5) {\n var data = _ref5.data;\n console.log('user REST getToken data', data);\n commit('setToken', data);\n }).catch(function (error) {\n console.warn('Issue with getToken', error);\n Promise.reject(error);\n });\n },\n getUser: function getUser(_ref6) {\n var dispatch = _ref6.dispatch,\n commit = _ref6.commit,\n state = _ref6.state;\n var params = {\n token: state.token\n };\n return _restAxios.REST.get(\"/user/\".concat(state.uid, \"?_format=json\"), params).then(function (_ref7) {\n var data = _ref7.data;\n console.log('user REST getUser data', data);\n console.log('roles', data['roles']);\n commit('setUser', data);\n\n if (data.roles) {\n commit('setRoles', data.roles);\n }\n }).catch(function (error) {\n console.warn('Issue with getUser', error);\n Promise.reject(error);\n });\n },\n userLogout: function userLogout(_ref8) {\n var commit = _ref8.commit,\n state = _ref8.state;\n\n var credentials = _querystring.default.stringify({\n token: state.token\n });\n\n _restAxios.REST.post('/user/logout', credentials).then(function (resp) {\n console.log('userLogout resp', resp);\n commit('setLoggedOut');\n }).catch(function (error) {\n console.warn('Issue with logout', error);\n Promise.reject(error);\n });\n }\n }\n};\nexports.default = _default;\n\n//# sourceURL=webpack:///./web/themes/custom/materiotheme/vuejs/store/modules/user.js?"); /***/ }) diff --git a/web/themes/custom/materiotheme/vuejs/components/Content/Product.vue b/web/themes/custom/materiotheme/vuejs/components/Content/Product.vue index 5158bf70..6195f4bc 100644 --- a/web/themes/custom/materiotheme/vuejs/components/Content/Product.vue +++ b/web/themes/custom/materiotheme/vuejs/components/Content/Product.vue @@ -7,7 +7,7 @@
{{ product.price__number }} -