我遇到错误,我试图在Ionic 3 Framework中使用Angular和Firebase身份验证创建登录名。问题是我不知道如何解决该错误。
Typescript Error
Property 'emailVerified' does not exist on type 'UserCredential'.
src/pages/login/login.ts
import { Component } from '@angular/core';
import { IonicPage, NavController, AlertController } from 'ionic-angular';
import { AngularFireAuth } from 'angularfire2/auth';
@IonicPage()
@Component({
selector: 'page-login',
templateUrl: 'login.html',
})
export class LoginPage {
user: any = {}
constructor(private navCtrl: NavController, private afAuth: AngularFireAuth, private alertCtrl: AlertController) {
}
login() {
this.afAuth.auth.signInWithEmailAndPassword(this.user.email, this.user.password).then(data => {
if (!data.emailVerified) {
let alert = this.alertCtrl.create({
title: 'Failed',
message: 'Email has not been verified',
buttons: ['OK']
})
alert.present()
} else {
this.navCtrl.setRoot('HomePage')
}
}).catch(err => {
let alert = this.alertCtrl.create({
title: 'Failed',
message: err.message,
buttons: ['OK']
})
alert.present()
})
}
toRegister() {
this.navCtrl.push('RegisterPage')
}
toResetPassword() {
this.navCtrl.push('ResetPasswordPage')
}
}