18.05 Login User
This commit is contained in:
parent
abe5306e9c
commit
b6d9272317
@ -65,8 +65,9 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
...mapActions('auth', [
|
||||
'registerUser']
|
||||
),
|
||||
'registerUser',
|
||||
'loginUser'
|
||||
]),
|
||||
isValidEmailAddress (email) {
|
||||
const re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
|
||||
return re.test(String(email).toLowerCase())
|
||||
@ -78,7 +79,7 @@ export default {
|
||||
this.$refs.password.validate()
|
||||
if (!this.$refs.email.hasError && !this.$refs.password.hasError) {
|
||||
if (this.tab === 'login') {
|
||||
console.log('login')
|
||||
this.loginUser(this.formData)
|
||||
} else {
|
||||
this.registerUser(this.formData)
|
||||
}
|
||||
|
@ -15,6 +15,15 @@ const actions = {
|
||||
.catch(error => {
|
||||
console.log('error.message: ', error)
|
||||
})
|
||||
},
|
||||
loginUser ({ state }, payload) {
|
||||
firebaseAuth.signInWithEmailAndPassword(payload.email, payload.password)
|
||||
.then(response => {
|
||||
console.log('response: ', response)
|
||||
})
|
||||
.catch(error => {
|
||||
console.log('error.message: ', error)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user