你好,现在我创建了一个注册和登录页面,用于ionic和firebase的身份验证,但是我也有一个单独的个人资料页面,我的问题是我如何将身份验证与实时数据库的用户名、名字和姓氏等信息联系起来。
signUp(email: string, password: string) {
this.angularFireAuth.createUserWithEmailAndPassword(email, password).then(() => {
this.showToast('Account gemaakt graag je emailadres verifieren.');
this.sendVerificationMail();
})
.catch(error => {
const errorCode = error.code;
let errorMessage;
switch (errorCode) {
case 'auth/email-already-in-use':
errorMessage = 'Dit emailadres bestaat al.';
break;
case 'auth/invalid-email':
errorMessage = 'Dit emailadres is onjuist.';
break;
}
this.presentAlert(errorMessage);
});
}
signIn(email: string, password: string) {
this.angularFireAuth.signInWithEmailAndPassword(email, password).then(res => {
if (res.user.emailVerified) {
}
else {
this.showToast('email is niet geverifieerd.');
}
})
.catch(error => {
const errorCode = error.code;
let errorMessage;
switch (errorCode) {
case 'auth/user-not-found':
errorMessage = 'Dit emailadres komt niet bekend voor.';
break;
case 'auth/user-disabled':
errorMessage = 'Dit emailadres is geblokkeerd.';
break;
case 'auth/wrong-password':
errorMessage = 'Het wachtwoord is onjuist.';
break;
}
this.presentAlert(errorMessage);
});
}
//this is the profilepage code
update() {
firebase.database().ref('users').push({
gebruikersnaam: this.profileform.value.gebruikersnaam,
voornaam: this.profileform.value.voornaam,
achternaam: this.profileform.value.achternaam,
});
}
1条答案
按热度按时间6rvt4ljy1#
我不知道我是否理解你的问题,但如果你想在另一个页面(个人资料页面)显示信息,你可以使用“本地存储”