【发布时间】:2018-07-13 19:41:15
【问题描述】:
我使用库 angular/angularfire2 并想用它来管理我的身份验证过程。只有当电子邮件验证过程成功时,我才想创建一个用户。现在我是如何实现它的,似乎在验证之前已经在我的数据库中创建了用户:
到目前为止,我的服务如下所示:
import { Injectable } from '@angular/core';
import {AngularFireAuth} from 'angularfire2/auth';
import {RegisterDataModel} from '../../components/register/register-data.model';
@Injectable({
providedIn: 'root'
})
export class RegistrationService {
constructor(private afAuth: AngularFireAuth) {
}
public register(register: RegisterDataModel): void {
this.afAuth.auth.createUserWithEmailAndPassword(register.email, register.password)
.then(() => {
const user = this.afAuth.auth.currentUser;
user.sendEmailVerification().then(() => console.log('please verify your email'))
.catch((err) => console.log(err));
}).catch(
(err) => console.log(err));
有谁知道在创建/激活他的账户之前如何验证用户?
【问题讨论】:
标签: angular firebase firebase-authentication angularfire2