18.04 Register User
This commit is contained in:
parent
6ec3e3ad11
commit
abe5306e9c
@ -1,18 +1,18 @@
|
|||||||
import firebase from "firebase/app"
|
import firebase from 'firebase/app'
|
||||||
|
|
||||||
import "firebase/auth"
|
import 'firebase/auth'
|
||||||
|
|
||||||
var firebaseConfig = {
|
var firebaseConfig = {
|
||||||
apiKey: "AIzaSyD1xL6X7oCD3IQC_F7vv-mYT4k1Ud0j7qs",
|
apiKey: 'AIzaSyD1xL6X7oCD3IQC_F7vv-mYT4k1Ud0j7qs',
|
||||||
authDomain: "awesometodo-c0aa0.firebaseapp.com",
|
authDomain: 'awesometodo-c0aa0.firebaseapp.com',
|
||||||
databaseURL: "https://awesometodo-c0aa0-default-rtdb.firebaseio.com",
|
databaseURL: 'https://awesometodo-c0aa0-default-rtdb.firebaseio.com',
|
||||||
projectId: "awesometodo-c0aa0",
|
projectId: 'awesometodo-c0aa0',
|
||||||
storageBucket: "awesometodo-c0aa0.appspot.com",
|
storageBucket: 'awesometodo-c0aa0.appspot.com',
|
||||||
messagingSenderId: "959628658138",
|
messagingSenderId: '959628658138',
|
||||||
appId: "1:959628658138:web:37d05be55e433b6e54ece3"
|
appId: '1:959628658138:web:37d05be55e433b6e54ece3'
|
||||||
}
|
}
|
||||||
|
|
||||||
const firebaseApp = firebase.initializeApp(firebaseConfig)
|
const firebaseApp = firebase.initializeApp(firebaseConfig)
|
||||||
const firebaseAuth = firebaseApp.auth()
|
const firebaseAuth = firebaseApp.auth()
|
||||||
|
|
||||||
export { firebaseAuth }
|
export { firebaseAuth }
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { mapActions } from 'vuex'
|
||||||
export default {
|
export default {
|
||||||
props: [
|
props: [
|
||||||
'tab'
|
'tab'
|
||||||
@ -63,6 +64,9 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
...mapActions('auth', [
|
||||||
|
'registerUser']
|
||||||
|
),
|
||||||
isValidEmailAddress (email) {
|
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,}))$/
|
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())
|
return re.test(String(email).toLowerCase())
|
||||||
@ -76,7 +80,7 @@ export default {
|
|||||||
if (this.tab === 'login') {
|
if (this.tab === 'login') {
|
||||||
console.log('login')
|
console.log('login')
|
||||||
} else {
|
} else {
|
||||||
console.log('register')
|
this.registerUser(this.formData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import { firebaseAuth } from 'boot/firebase'
|
||||||
|
|
||||||
const state = {
|
const state = {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5,6 +7,15 @@ const mutations = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const actions = {
|
const actions = {
|
||||||
|
registerUser ({ state }, payload) {
|
||||||
|
firebaseAuth.createUserWithEmailAndPassword(payload.email, payload.password)
|
||||||
|
.then(response => {
|
||||||
|
console.log('response: ', response)
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.log('error.message: ', error)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const getters = {
|
const getters = {
|
||||||
|
Loading…
Reference in New Issue
Block a user