How can I send a verification Email with the Firebase Verification Email template to an user when trying to create an account in Swift 3? Until now I have this code:
@IBAction func CreateAccount(_ sender: AnyObject) {
let username = UserText.text
let password = PasswordText.text
FIRAuth.auth()?.createUser(withEmail: username!, password: password!, completion: { (user, error) in
if error != nil {
//error creating account
let alert = UIAlertController(title: "Error", message: "Error creating account", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
self.present(alert, animated: true, completion: nil)
} else {
//success
let vc = self.storyboard?.instantiateViewController(withIdentifier: "mainVC")
self.present(vc!, animated: true, completion: nil)
}
})
}
What I want is to confirm that the user is using a valid email.