18.05 Login User

This commit is contained in:
Fredrick W. Warren 2021-02-13 12:00:48 -08:00
parent abe5306e9c
commit b6d9272317
2 changed files with 13 additions and 3 deletions

View File

@ -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)
}

View File

@ -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)
})
}
}