diff --git a/web/themes/custom/materiotheme/assets/dist/main.js b/web/themes/custom/materiotheme/assets/dist/main.js index 2e3865d..7666d81 100644 --- a/web/themes/custom/materiotheme/assets/dist/main.js +++ b/web/themes/custom/materiotheme/assets/dist/main.js @@ -1279,7 +1279,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n})); /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.default = void 0;\n\nvar _vue = _interopRequireDefault(__webpack_require__(/*! vue */ \"./node_modules/vue/dist/vue.js\"));\n\nvar _vuex = __webpack_require__(/*! vuex */ \"./node_modules/vuex/dist/vuex.common.js\");\n\nvar _maAxios = __webpack_require__(/*! vuejs/api/ma-axios */ \"./web/themes/custom/materiotheme/vuejs/api/ma-axios.js\");\n\nvar _checkPasswordStrength = _interopRequireDefault(__webpack_require__(/*! check-password-strength */ \"./node_modules/check-password-strength/index.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(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: \"RegisterForm\",\n data: function data() {\n return {\n form: null,\n mail: null,\n pass1: null,\n pass2: null,\n ps: \"\"\n };\n },\n computed: _objectSpread(_objectSpread({}, (0, _vuex.mapState)({\n registerMessage: function registerMessage(state) {\n return state.User.registerMessage;\n }\n })), {}, {\n psswd_class: function psswd_class() {\n return this.ps.toLowerCase();\n },\n can_register: function can_register() {\n if (this.ps === \"Strong\") {\n return 'can-register';\n }\n\n return '';\n }\n }),\n methods: _objectSpread(_objectSpread({}, (0, _vuex.mapActions)({\n userRegister: 'User/userRegister'\n })), {}, {\n getRegisterForm: function getRegisterForm() {\n var _this = this;\n\n // Form through ajax is provided by materio_user drupal custom module\n // vuejs attributes a inserted by form alter in same module\n _maAxios.MA.get(\"/materio_user/register_form\").then(function (_ref) {\n var data = _ref.data;\n console.log(\"getRegisterForm data\", data);\n _this.form = _vue.default.compile(data.rendered);\n _this.$options.staticRenderFns = [];\n _this._staticTrees = [];\n\n _this.form.staticRenderFns.map(function (fn) {\n return _this.$options.staticRenderFns.push(fn);\n });\n }).catch(function (error) {\n console.warn('Issue with getRegisterForm', error);\n });\n },\n checkSubmitEnabled: function checkSubmitEnabled() {\n if (this.ps === 'Strong') {\n this.$refs.register.disabled = false;\n } else {\n this.$refs.register.disabled = true;\n }\n },\n register: function register() {\n var _this2 = this;\n\n console.log('register', this.mail, this.pass1, this.pass2); // TODO: check for identical password\n // TODO: check for valide email\n // TODO: check for unique email\n\n if (this.pass1 === this.pass2) {\n this.userRegister({\n name: this.mail,\n mail: this.mail,\n pass: this.pass1\n }).then(function () {\n console.log('registered from register component');\n\n _this2.$emit('onRegistered');\n }).catch(function (error) {\n console.warn('Issue with register from registerform component', error);\n Promise.reject(error);\n });\n }\n }\n }),\n beforeMount: function beforeMount() {\n if (!this.form) {\n this.getRegisterForm();\n }\n },\n mounted: function mounted() {\n // console.log('LoginBlock mounted');\n Drupal.attachBehaviors(this.$el);\n this.checkSubmitEnabled();\n },\n render: function render(h) {\n // console.log('LoginBlock render');\n if (!this.form) {\n // console.log('LoginBlock render NAN');\n return h('span', 'Loading ...');\n } else {\n // console.log('LoginBlock render template');\n return this.form.render.call(this);\n }\n },\n watch: {\n pass1: function pass1(n, o) {\n if (n) {\n this.ps = (0, _checkPasswordStrength.default)(n).value;\n console.log('watch pass1 n', n, 'ps :', this.ps);\n this.checkSubmitEnabled();\n }\n }\n }\n};\nexports.default = _default;\n\n//# sourceURL=webpack://materio.com/./web/themes/custom/materiotheme/vuejs/components/Form/RegisterForm.vue?./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/index.js??vue-loader-options"); +eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.default = void 0;\n\nvar _vue = _interopRequireDefault(__webpack_require__(/*! vue */ \"./node_modules/vue/dist/vue.js\"));\n\nvar _vuex = __webpack_require__(/*! vuex */ \"./node_modules/vuex/dist/vuex.common.js\");\n\nvar _maAxios = __webpack_require__(/*! vuejs/api/ma-axios */ \"./web/themes/custom/materiotheme/vuejs/api/ma-axios.js\");\n\nvar _checkPasswordStrength = _interopRequireDefault(__webpack_require__(/*! check-password-strength */ \"./node_modules/check-password-strength/index.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(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: \"RegisterForm\",\n data: function data() {\n return {\n form: null,\n mail: null,\n pass1: null,\n pass2: null,\n ps: \"\"\n };\n },\n computed: _objectSpread(_objectSpread({}, (0, _vuex.mapState)({\n registerMessage: function registerMessage(state) {\n return state.User.registerMessage;\n }\n })), {}, {\n psswd_class: function psswd_class() {\n return this.ps.toLowerCase();\n },\n can_register: function can_register() {\n if (this.ps === \"Strong\") {\n return 'can-register';\n }\n\n return '';\n }\n }),\n methods: _objectSpread(_objectSpread({}, (0, _vuex.mapActions)({\n userRegister: 'User/userRegister'\n })), {}, {\n getRegisterForm: function getRegisterForm() {\n var _this = this;\n\n // Form through ajax is provided by materio_user drupal custom module\n // vuejs attributes a inserted by form alter in same module\n _maAxios.MA.get(\"/materio_user/register_form\").then(function (_ref) {\n var data = _ref.data;\n console.log(\"getRegisterForm data\", data);\n _this.form = _vue.default.compile(data.rendered);\n _this.$options.staticRenderFns = [];\n _this._staticTrees = [];\n\n _this.form.staticRenderFns.map(function (fn) {\n return _this.$options.staticRenderFns.push(fn);\n });\n\n _this.initFormBehaviours();\n }).catch(function (error) {\n console.warn('Issue with getRegisterForm', error);\n });\n },\n initFormBehaviours: function initFormBehaviours() {\n Drupal.attachBehaviors(this.$el);\n this.checkSubmitEnabled();\n },\n checkSubmitEnabled: function checkSubmitEnabled() {\n console.log(\"checkSubmitEnabled\", this);\n\n if (this.ps === 'Strong') {\n this.$refs.register.disabled = false;\n } else {\n this.$refs.register.disabled = true;\n }\n },\n register: function register() {\n var _this2 = this;\n\n console.log('register', this.mail, this.pass1, this.pass2); // TODO: check for identical password\n // TODO: check for valide email\n // TODO: check for unique email\n\n if (this.pass1 === this.pass2) {\n this.userRegister({\n name: this.mail,\n mail: this.mail,\n pass: this.pass1\n }).then(function () {\n console.log('registered from register component');\n\n _this2.$emit('onRegistered');\n }).catch(function (error) {\n console.warn('Issue with register from registerform component', error);\n Promise.reject(error);\n });\n }\n }\n }),\n beforeMount: function beforeMount() {\n if (!this.form) {\n this.getRegisterForm();\n }\n },\n mounted: function mounted() {\n // console.log('LoginBlock mounted');\n if (this.form) {\n this.initForm();\n }\n },\n render: function render(h) {\n // console.log('LoginBlock render');\n if (!this.form) {\n // console.log('LoginBlock render NAN');\n return h('span', 'Loading ...');\n } else {\n // console.log('LoginBlock render template');\n return this.form.render.call(this);\n }\n },\n watch: {\n pass1: function pass1(n, o) {\n if (n) {\n this.ps = (0, _checkPasswordStrength.default)(n).value;\n console.log('watch pass1 n', n, 'ps :', this.ps);\n this.checkSubmitEnabled();\n }\n }\n }\n};\nexports.default = _default;\n\n//# sourceURL=webpack://materio.com/./web/themes/custom/materiotheme/vuejs/components/Form/RegisterForm.vue?./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/index.js??vue-loader-options"); /***/ }), diff --git a/web/themes/custom/materiotheme/vuejs/components/Form/RegisterForm.vue b/web/themes/custom/materiotheme/vuejs/components/Form/RegisterForm.vue index ad601b2..1afef49 100644 --- a/web/themes/custom/materiotheme/vuejs/components/Form/RegisterForm.vue +++ b/web/themes/custom/materiotheme/vuejs/components/Form/RegisterForm.vue @@ -43,12 +43,18 @@ export default { this.$options.staticRenderFns = []; this._staticTrees = []; this.form.staticRenderFns.map(fn => (this.$options.staticRenderFns.push(fn))); + this.initFormBehaviours() }) .catch(( error ) => { console.warn('Issue with getRegisterForm', error) }) }, + initFormBehaviours(){ + Drupal.attachBehaviors(this.$el) + this.checkSubmitEnabled() + }, checkSubmitEnabled () { + console.log("checkSubmitEnabled", this); if(this.ps === 'Strong'){ this.$refs.register.disabled = false }else{ @@ -84,8 +90,9 @@ export default { }, mounted(){ // console.log('LoginBlock mounted'); - Drupal.attachBehaviors(this.$el); - this.checkSubmitEnabled() + if(this.form){ + this.initForm() + } }, render(h) { // console.log('LoginBlock render');