Home > OS >  Where are the details defined about error code "invalid-email" and "weak-password&quo
Where are the details defined about error code "invalid-email" and "weak-password&quo

Time:09-15

I'm gonna handle errors about createUserWithEmailAndPassword as follows;

class myComplete extends ConsumerWidget {
  @override
  Widget build(BuildContext context, WidgetRef ref) {
    return TextButton(
      child: Text("Register"),
      onPressed: () async {
        try{
        final FirebaseAuth auth = FirebaseAuth.instance;
        final UserCredential result = await auth.createUserWithEmailAndPassword(
          email: emailController.text,
          password: maskController.text,
        );
        dialogMsg(context, result.user);
        } on FirebaseAuthException catch (e){
          //here e.code
        }
      },
      style: TextButton.styleFrom(
        foregroundColor: MyStyle.mainColor,
      ),
    );
  }
}

And I found several type of errors in related docs here and there were errors such as invalid-email and weak-password.

However, I could not find like what kind of RegEx adopted for email-validation or how short password is defined as weak password. Where can I check out these default definitions?

CodePudding user response:

The password must have at least 6 characters as in the errors thrown by Firebase SDKs and also in the Firebase Admin documentation.

From the Identity Toolkit documentation,

The length of email should be less than 256 characters and in the format of [email protected]. The email should also match the RFC 822 addr-spec production.

  • Related