使用Firebase建立帐户时的密码要求 [英] Password Requirements when making an account with 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屋!