I have a rather strange problem in Firebase where, if I create a new user with the same password as the previous user, that will be created by a new user with the correct information, but will be registered in the previous user account and will display all previous user data.
I log out, and then I log in with the new user information, and only after that I returned the correct information. I also had a problem with a new user rewriting the previous user path in Firebase if I used the same password, but I cannot recreate it.
My code for creating a new user is as follows
createNewUser () {
var email = this.newUserEmail;
var password = this.newUserPassword;
firebaseAuth.createUserWithEmailAndPassword(email, password).catch(function(error) {
var errorCode = error.code;
var errorMessage = error.message;
}).then(() => {
firebaseAuth.onAuthStateChanged(user => {
database.ref('/users/' + user.uid).set({
name: this.newUserName,
email: this.newUserEmail,
isRetailer: false,
isAdmin: false
});
});
});
router.push({ path: '/' });
}
}
}
, created() {}
firebaseAuth.onAuthStateChanged(user => {
console.log(store.state.authentication);
console.log(user);
store.dispatch('checkUser', user);
})
, ,
checkUser (context, user) {
if (user.uid) {
context.commit('authUser', user);
firebase.database()
.ref('/users/' + user.uid + '/isRetailer/')
.once('value').then(snapshot => context.commit('isRetailer', {
value: snapshot.val()
}));
firebase.database()
.ref('/users/' + user.uid + '/name/')
.once('value').then(snapshot => context.commit('getDisplayName', {
name: snapshot.val()
}));
} else {
console.log('No user currently logged in');
}
},
,
- Firebase.
- Firebase.
- Vuex , Firebase.
, , .

, , , (, ). , , Firebase.
bizzare, , , . uid - , . ? , firebase, .
.
: , firebase . . , /, .

!