.sendEmailVerification不会通过电子邮件发送验证

时间:2018-10-10 16:23:09

标签: typescript firebase ionic-framework firebase-authentication google-cloud-firestore

我正在尝试通过从firebase发送电子邮件确认来验证用户,但是我什么也没收到,这是代码

onCreate(form: NgForm) {
  var user = new User();
  user.name = form.value.name;
  user.email = form.value.email;
  user.contact = form.value.contact;

  if(form.value.gender == "male") {
    user.gender = "male";
  } else {
    user.gender = "female"
  }
  let loading = this.mProv.getLoader('Creating your account...', 0);
  loading.present();
  this.afAuth.auth.createUserWithEmailAndPassword(form.value.email, form.value.password)
    .then(data => {
      let firebaseUser = firebase.auth().currentUser;
      firebaseUser.sendEmailVerification();

      user.id = data.uid;
      this.userProvider.addUser(user)
        .then(_ =>
          loading.dismiss()
        )
        .catch(error => {
          loading.dismiss();
          this.mProv.showAlertOkMessage('Error','Sign up error. Please try again later.');
        });
    })
    .catch(error => {
      loading.dismiss();
      this.mProv.showAlertOkMessage('Error','Sign up error. Please try again later.');
    });
}

该电子邮件已在Firebase身份验证上注册,但未添加到Firestore用户部分,显示为空白,但带有ID

enter image description here

应该这样添加

enter image description here

0 个答案:

没有答案