使用 Firebase 创建帐户时的密码要求 [英] Password Requirements when making an account with Firebase

查看:22
本文介绍了使用 Firebase 创建帐户时的密码要求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

避免在 firebase.auth().createUserWithEmailAndPassword(email, password) 上抛出auth/weak-password"错误代码的要求是什么.

What are the requirements to avoid throwing the "auth/weak-password" error code on the firebase.auth().createUserWithEmailAndPassword(email, password).

我想向用户展示要求,这样他们就不必在创建帐户的过程中多次抛出错误.

I would like to show the user the requirements so they don't have to throw the error several times on the way to create an account.

我检查了 firebase 文档:https://firebase.google.com/docs/reference/js/firebase.auth.Auth

I have checked the firebase documentation: https://firebase.google.com/docs/reference/js/firebase.auth.Auth

和堆栈溢出但尚未找到此信息.

and stack overflow but have not found this info.

推荐答案

我所知道的唯一弱点测试是长度小于 6 个字符:

The only weakness test I'm aware of is length less than 6 characters:

公共最终类 FirebaseAuthWeakPasswordException 扩展FirebaseAuthInvalidCredentialsException

public final class FirebaseAuthWeakPasswordException extends FirebaseAuthInvalidCredentialsException

使用弱密码(少于 6 个字符)创建新密码时抛出帐户或更新现有帐户的密码.使用 getReason()获取一条消息,说明验证失败的原因,您可以向您的用户展示.

Thrown when using a weak password (less than 6 chars) to create a new account or to update an existing account's password. Use getReason() to get a message with the reason the validation failed that you can display to your users.

摘自本文档.

这篇关于使用 Firebase 创建帐户时的密码要求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆