提交 b77693f1 authored 作者: yueweilu's avatar yueweilu

密码正则

上级 94cd07bf
...@@ -115,7 +115,7 @@ class _ChangePwdPageState extends State<ChangePwdPage> { ...@@ -115,7 +115,7 @@ class _ChangePwdPageState extends State<ChangePwdPage> {
), ),
Container( Container(
margin: EdgeInsets.only(left: 5.w,top: 5.w), margin: EdgeInsets.only(left: 5.w,top: 5.w),
child: Text('密码必须是8-20个英文字母、数字或符号(除空格)',style: TextStyle(fontSize: 10.w,color: Colours.c9),), child: Text('密码必须是数字、字母、特殊符号两种及以上8-12位的组合',style: TextStyle(fontSize: 10.w,color: Colours.c9),),
), ),
Gaps.vGaps40, Gaps.vGaps40,
CustomGradientButton( CustomGradientButton(
......
...@@ -68,7 +68,7 @@ class _ResetPwdPageState extends State<ResetPwdPage> { ...@@ -68,7 +68,7 @@ class _ResetPwdPageState extends State<ResetPwdPage> {
), ),
Container( Container(
margin: EdgeInsets.only(left: 5.w,top: 5.w), margin: EdgeInsets.only(left: 5.w,top: 5.w),
child: Text('密码必须是8-20个英文字母、数字或符号(除空格)',style: TextStyle(fontSize: 10.w,color: Colours.c9),), child: Text('密码必须是数字、字母、特殊符号两种及以上8-12位的组合',style: TextStyle(fontSize: 10.w,color: Colours.c9),),
), ),
Gaps.vGaps40, Gaps.vGaps40,
CustomGradientButton( CustomGradientButton(
......
...@@ -91,7 +91,9 @@ class ValidatorTool { ...@@ -91,7 +91,9 @@ class ValidatorTool {
// 密码 // 密码
static bool isValidPassword(String value) { static bool isValidPassword(String value) {
RegExp passwordPattern = RegExp(r'^[A-Za-z0-9!@#\$%^&*()_+{}\[\]:;<>,.?~\\/-]{8,12}$'); // RegExp passwordPattern = RegExp(r'^[A-Za-z0-9!@#\$%^&*()_+{}\[\]:;<>,.?~\\/-]{8,12}$');
// 密码必须是数字、字母、特殊符号两种及以上8-12位的组合
RegExp passwordPattern = RegExp(r'^(?=(?:.*[0-9])(?:.*[a-zA-Z])|(?=.*[0-9])(?:.*[\W_])|(?=.*[a-zA-Z])(?:.*[\W_]))[0-9a-zA-Z\W_]{8,12}$');
// RegExp passwordPattern = RegExp(r'^(?=.*[A-Za-z])(?=.*\d)(?=.*[~@#%$*()_+{}\[\]:;<>,.?\\/-])[A-Za-z0-9~@#%$*()_+{}\[\]:;<>,.?\\/-]{8,12}$'); // RegExp passwordPattern = RegExp(r'^(?=.*[A-Za-z])(?=.*\d)(?=.*[~@#%$*()_+{}\[\]:;<>,.?\\/-])[A-Za-z0-9~@#%$*()_+{}\[\]:;<>,.?\\/-]{8,12}$');
// RegExp passwordPattern = RegExp(r'^\d{6}$'); // RegExp passwordPattern = RegExp(r'^\d{6}$');
return passwordPattern.hasMatch(value); return passwordPattern.hasMatch(value);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论