handeled login or register from a modal, YES git status

This commit is contained in:
2019-10-07 15:54:03 +02:00
parent 8b3c31c0f5
commit d5a6194727
25 changed files with 398 additions and 58 deletions

View File

@ -16,8 +16,8 @@ export default {
userLogin: 'User/userLogin'
}),
getLoginForm(){
// Form through ajax is provided by materio_user custom module
// vuejs attributes a inserted by template in theme level
// Form through ajax is provided by materio_user drupal custom module
// vuejs attributes a inserted by form alter in same module
MA.get(`/materio_user/login_form`)
.then(({data}) => {
console.log("getLoginForm data");

View File

@ -7,20 +7,21 @@ import { MA } from 'vuejs/api/ma-axios'
export default {
name: "RegisterForm",
data: () => ({
form:null,
mail:null,
password:null
form: null,
mail: null,
pass1: null,
pass2: null
}),
methods: {
...mapActions({
userRegister: 'User/userRegister'
}),
getRegisterForm(){
// Form through ajax is provided by materio_user custom module
// vuejs attributes a inserted by template in theme level
// Form through ajax is provided by materio_user drupal custom module
// vuejs attributes a inserted by form alter in same module
MA.get(`/materio_user/register_form`)
.then(({data}) => {
console.log("getRegisterForm data");
console.log("getRegisterForm data", data);
this.form = Vue.compile(data.rendered)
this.$options.staticRenderFns = [];
this._staticTrees = [];
@ -30,19 +31,27 @@ export default {
console.warn('Issue with getRegisterForm', error)
})
},
// login () {
// this.userLogin({
// mail: this.mail,
// pass: this.password
// }).then( () => {
// console.log('logedin from login component');
// this.$emit('onLogedIn')
// }
// ).catch(( error ) => {
// console.warn('Issue with login from login component', error)
// Promise.reject(error)
// })
// }
register () {
console.log('register', this.mail, this.pass1, this.pass2);
// TODO: check for identical password
// TODO: check for valide email
// TODO: check for unique email
if(this.pass1 === this.pass2){
this.userRegister({
name: this.mail,
mail: this.mail,
pass: this.pass1
}).then( () => {
console.log('registered from register component');
this.$emit('onRegistered')
}
).catch(( error ) => {
console.warn('Issue with register from registerform component', error)
Promise.reject(error)
})
}
}
},
beforeMount () {
if(!this.form){
@ -67,20 +76,18 @@ export default {
</script>
<style lang="scss" scoped>
// .form-item,
// .form-actions{
// display:inline-block;
// max-width:30%;
// margin:0;
// }
// input{
// box-sizing:content-box;
// max-width:100%;
// }
// div.description{
// display:none;
// }
// .form-item-persistent-login{
// display:none;
// }
.form-type-email,
.form-type-password-confirm{
// display:inline-block;
max-width:30%;
margin:0;
}
input{
box-sizing:content-box;
max-width:100%;
}
label,
div.description{
display:none;
}
</style>