I use the library angular/angularfire2
and want to manage with it my authentication process. I want to create a user only if the email varification process succeeded. For now how I implemented it, it seems like the user already was created in my db before verification:
So far my Service looks as follows:
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));
Does anyone know how to verify the user before creating/activating his acc?