From eb401fb8efbdd091d5196a71c9abd2495010b99f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AD=8F=E5=B0=91=E9=98=B3?= <786612630@qq.com> Date: Fri, 13 Sep 2024 14:50:36 +0800 Subject: [PATCH 1/3] =?UTF-8?q?1=E3=80=81=E4=BC=98=E5=8C=96=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E3=80=81=E5=BF=98=E8=AE=B0=E5=AF=86=E7=A0=81=E3=80=81?= =?UTF-8?q?=E9=87=8D=E7=BD=AE=E5=AF=86=E7=A0=81=E5=8A=9F=E8=83=BD=EF=BC=8C?= =?UTF-8?q?=E5=AF=86=E7=A0=81=E9=99=90=E5=88=B6=E5=8F=8A=E5=AF=86=E7=A0=81?= =?UTF-8?q?=E4=B8=8D=E4=B8=80=E6=A0=B7=E6=97=B6=E6=98=BE=E7=A4=BA=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lan/lan_en.json | 3 +- lan/lan_keys.json | 4 +- lan/lan_zh.json | 5 +- .../starLock_forgetPassword_logic.dart | 21 ++++++++- .../starLock_forgetPassword_page.dart | 4 +- .../starLock_forgetPassword_state.dart | 46 ++++++++++--------- .../starLock_forgetPassword_xhj_page.dart | 9 +++- .../register/starLock_register_logic.dart | 24 ++++++---- .../register/starLock_register_page.dart | 4 +- .../register/starLock_register_state.dart | 15 +++--- .../register/starLock_register_xhj_page.dart | 10 ++-- .../minePersonInfoResetPassword_logic.dart | 39 ++++++++++------ .../minePersonInfoResetPassword_page.dart | 20 ++++---- .../minePersonInfoResetPassword_state.dart | 16 +++---- lib/tools/regularExpression.dart | 22 +++++++++ lib/tools/tf_loginInput.dart | 4 +- 16 files changed, 165 insertions(+), 81 deletions(-) diff --git a/lan/lan_en.json b/lan/lan_en.json index 2d48d88e..393df806 100755 --- a/lan/lan_en.json +++ b/lan/lan_en.json @@ -905,5 +905,6 @@ "感应到门前约0.5米有人时,将自动启动面部识别开锁。": "When someone is sensed about 0.5 meters in front of the door, the face recognition unlocking will be automatically started.", "感应距离已关闭,需手动触摸键盘任意键,进行面部识别开锁。": "The sensing distance has been turned off, you need to manually touch any key on the keyboard to perform face recognition unlocking.", "防误开已打开,开锁后": "The anti-mistake opening has been turned on, and after unlocking", - "秒内不可使用面容开锁": "Face unlocking cannot be used within seconds" + "秒内不可使用面容开锁": "Face unlocking cannot be used within seconds", + "密码需至少包含数字/字母/字符中的2种组合": "The password must contain at least 2 combinations of numbers/letters/characters" } diff --git a/lan/lan_keys.json b/lan/lan_keys.json index 48eb4db3..80fe7e8d 100755 --- a/lan/lan_keys.json +++ b/lan/lan_keys.json @@ -941,5 +941,7 @@ "感应到门前约0.5米有人时,将自动启动面部识别开锁。": "感应到门前约0.5米有人时,将自动启动面部识别开锁。", "感应距离已关闭,需手动触摸键盘任意键,进行面部识别开锁。": "感应距离已关闭,需手动触摸键盘任意键,进行面部识别开锁。", "防误开已打开,开锁后": "防误开已打开,开锁后", - "秒内不可使用面容开锁": "秒内不可使用面容开锁" + "秒内不可使用面容开锁": "秒内不可使用面容开锁", + + "密码需至少包含数字/字母/字符中的2种组合": "密码需至少包含数字/字母/字符中的2种组合" } diff --git a/lan/lan_zh.json b/lan/lan_zh.json index 39900100..f0aac37a 100755 --- a/lan/lan_zh.json +++ b/lan/lan_zh.json @@ -901,5 +901,8 @@ "感应到门前约0.5米有人时,将自动启动面部识别开锁。": "感应到门前约0.5米有人时,将自动启动面部识别开锁。", "感应距离已关闭,需手动触摸键盘任意键,进行面部识别开锁。": "感应距离已关闭,需手动触摸键盘任意键,进行面部识别开锁。", "防误开已打开,开锁后": "防误开已打开,开锁后", - "秒内不可使用面容开锁": "秒内不可使用面容开锁" + "秒内不可使用面容开锁": "秒内不可使用面容开锁", + + "密码需至少包含数字/字母/字符中的2种组合": "密码需至少包含数字/字母/字符中的2种组合" + } diff --git a/lib/login/forgetPassword/starLock_forgetPassword_logic.dart b/lib/login/forgetPassword/starLock_forgetPassword_logic.dart index a63fa172..c9119cdf 100755 --- a/lib/login/forgetPassword/starLock_forgetPassword_logic.dart +++ b/lib/login/forgetPassword/starLock_forgetPassword_logic.dart @@ -2,12 +2,14 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; +import 'package:star_lock/app_settings/app_settings.dart'; import 'package:star_lock/login/forgetPassword/starLock_forgetPassword_state.dart'; import 'package:star_lock/login/login/entity/LoginEntity.dart'; import 'package:star_lock/login/register/entity/SendValidationCodeEntity.dart'; import '../../network/api_repository.dart'; import '../../tools/baseGetXController.dart'; +import '../../tools/regularExpression.dart'; import '../../tools/showTipView.dart'; import '../register/entity/checkIP_entity.dart'; @@ -33,6 +35,16 @@ class StarLockForgetPasswordLogic extends BaseGetXController { } Future resetPassword() async { + if(state.pwd.value != state.surePwd.value){ + showToast('两次密码不一致哦'.tr); + return; + } + + if(!RegularExpression().validateString(state.pwd.value)){ + showToast('密码需至少包含数字/字母/字符中的2种组合'.tr); + return; + } + final LoginEntity entity = await ApiRepository.to.resetPassword( state.countryCode.value, state.phoneStr.value, @@ -82,7 +94,6 @@ class StarLockForgetPasswordLogic extends BaseGetXController { }else{ state.codeType.value = '1'; } - state.phoneStrIsOK.value = state.phoneStr.value.isNotEmpty; } if (controller == state.pwdController) { state.pwd.value = controller.text; @@ -93,10 +104,16 @@ class StarLockForgetPasswordLogic extends BaseGetXController { if (controller == state.codeController) { state.verificationCode.value = controller.text; } + _resetCanSendCode(); _resetCanSub(); + AppLog.log('state.canSub.value:${state.canSub.value} state.pwdIsOK:${state.pwdIsOK} state.codeIsOK:${state.codeIsOK} state.phoneStr.value:${state.phoneStr.value}'); } void _resetCanSub() { - state.canSub.value = state.pwdIsOK && state.codeIsOK; + state.canSub.value = state.pwdIsOK && state.codeIsOK && state.phoneStr.value.isNotEmpty; + } + + void _resetCanSendCode() { + state.canSendCode.value = state.pwdIsOK && state.phoneStr.value.isNotEmpty; } } diff --git a/lib/login/forgetPassword/starLock_forgetPassword_page.dart b/lib/login/forgetPassword/starLock_forgetPassword_page.dart index 57684f35..0aa89470 100755 --- a/lib/login/forgetPassword/starLock_forgetPassword_page.dart +++ b/lib/login/forgetPassword/starLock_forgetPassword_page.dart @@ -185,7 +185,7 @@ class _StarLockForgetPasswordPageState width: 10.w, ), Obx(() => GestureDetector( - onTap: (state.phoneStrIsOK.value && state.canResend.value) + onTap: (state.canSendCode.value && state.canResend.value) ? () async { // Navigator.pushNamed(context, Routers.safetyVerificationPage, arguments: {"countryCode":"+86", "account":state.phoneOrEmailStr.value}); final Object? result = await Navigator.pushNamed( @@ -204,7 +204,7 @@ class _StarLockForgetPasswordPageState // height: 60.h, padding: EdgeInsets.all(10.h), decoration: BoxDecoration( - color: state.phoneStrIsOK.value + color: (state.canSendCode.value && state.canResend.value) ? AppColors.mainColor : AppColors.btnDisableColor, borderRadius: BorderRadius.circular(5)), diff --git a/lib/login/forgetPassword/starLock_forgetPassword_state.dart b/lib/login/forgetPassword/starLock_forgetPassword_state.dart index 8772c014..686802f9 100755 --- a/lib/login/forgetPassword/starLock_forgetPassword_state.dart +++ b/lib/login/forgetPassword/starLock_forgetPassword_state.dart @@ -1,10 +1,15 @@ -import 'package:flustars/flustars.dart'; + import 'package:flutter/material.dart'; import 'package:get/get.dart'; import '../../translations/trans_lib.dart'; +import '../selectCountryRegion/common/index.dart'; class StarLockForgetPasswordState { + + StarLockForgetPasswordState() { + resetResend(); + } final TextEditingController phoneController = TextEditingController(); final TextEditingController pwdController = TextEditingController(); final TextEditingController sureController = TextEditingController(); @@ -14,30 +19,27 @@ class StarLockForgetPasswordState { return DateTime.now().millisecondsSinceEpoch; } - var countryCode = "86".obs; - var countryName = '中国'.tr.obs; - var codeType = '2'.obs; // 1:邮箱 2:手机 - var pwd = ''.obs; - var surePwd = ''.obs; - var verificationCode = ''.obs; - var xWidth = ''.obs; // 滑动验证码滑动位置 - var canSub = false.obs; - var phoneStr = ''.obs; - var phoneStrIsOK = false.obs; - var date = currentTimeMillis().toString().obs; + RxString countryCode = '86'.obs; + RxString countryName = '中国'.tr.obs; + RxString codeType = '2'.obs; // 1:邮箱 2:手机 + RxString pwd = ''.obs; + RxString surePwd = ''.obs; + RxString verificationCode = ''.obs; + RxString xWidth = ''.obs; // 滑动验证码滑动位置 + RxString phoneStr = ''.obs; + RxBool canSub = false.obs;// 是否能点击发送按钮 + RxBool canSendCode = false.obs;// 是否能店家获取验证码按钮 + RxString date = currentTimeMillis().toString().obs; + // bool get isEmail => RegexUtil.isEmail(phoneStr.value); // bool get isIphone => RegexUtil.isMobileSimple(phoneStr.value); - bool get pwdIsOK => pwd.value.isNotEmpty && (pwd.value == surePwd.value); - bool get codeIsOK => verificationCode.value.isNotEmpty; + bool get pwdIsOK => pwd.value.isNotEmpty && surePwd.value.isNotEmpty && pwd.value.length >= 8 && surePwd.value.length >= 8; + bool get codeIsOK => verificationCode.value.isNotEmpty && verificationCode.value.length >= 6; - var canResend = false.obs; - var btnText = ''.obs; - var totalSeconds = 120; - var currentSecond = 120; - - StarLockForgetPasswordState() { - resetResend(); - } + RxBool canResend = false.obs;// 是否能重新发送,就是验证码倒计时之后的重新发送 + RxString btnText = ''.obs; + int totalSeconds = 120; + int currentSecond = 120; void resetResend() { canResend.value = totalSeconds == currentSecond; diff --git a/lib/login/forgetPassword/starLock_forgetPassword_xhj_page.dart b/lib/login/forgetPassword/starLock_forgetPassword_xhj_page.dart index a0dc857e..8c9ea551 100755 --- a/lib/login/forgetPassword/starLock_forgetPassword_xhj_page.dart +++ b/lib/login/forgetPassword/starLock_forgetPassword_xhj_page.dart @@ -143,7 +143,7 @@ class _StarLockForgetPasswordPageState ]), ), Obx(() => GestureDetector( - onTap: (state.phoneStrIsOK.value && state.canResend.value) + onTap: (state.canSendCode.value && state.canResend.value) ? () async { final Object? result = await Navigator.pushNamed( context, Routers.safetyVerificationPage, @@ -159,11 +159,16 @@ class _StarLockForgetPasswordPageState child: Container( width: 180.w, padding: EdgeInsets.all(10.h), + decoration: BoxDecoration( + color: (state.canSendCode.value && state.canResend.value) + ? AppColors.mainColor + : AppColors.btnDisableColor, + borderRadius: BorderRadius.circular(5)), child: Center( child: Text(state.btnText.value, textAlign: TextAlign.center, style: TextStyle( - color: AppColors.mainColor, + color: Colors.white, fontSize: 24.sp, )), ), diff --git a/lib/login/register/starLock_register_logic.dart b/lib/login/register/starLock_register_logic.dart index 5119acc4..e34cfb26 100755 --- a/lib/login/register/starLock_register_logic.dart +++ b/lib/login/register/starLock_register_logic.dart @@ -1,19 +1,20 @@ import 'dart:async'; + import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:star_lock/appRouters.dart'; import 'package:star_lock/app_settings/app_settings.dart'; import 'package:star_lock/blue/blue_manage.dart'; - import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart'; import 'package:star_lock/login/login/entity/LoginEntity.dart'; import 'package:star_lock/login/register/entity/SendValidationCodeEntity.dart'; import 'package:star_lock/tools/eventBusEventManage.dart'; -import 'package:star_lock/tools/storage.dart'; import 'package:star_lock/tools/push/xs_jPhush.dart'; +import 'package:star_lock/tools/storage.dart'; import '../../network/api_repository.dart'; import '../../tools/baseGetXController.dart'; +import '../../tools/regularExpression.dart'; import '../../tools/showTipView.dart'; import 'entity/checkIP_entity.dart'; import 'starLock_register_state.dart'; @@ -40,12 +41,15 @@ class StarLockRegisterLogic extends BaseGetXController { } Future register() async { - AppLog.log( - 'state.pwd.value:${state.pwd.value} state.surePwd.value:${state.surePwd.value}'); if (state.pwd.value != state.surePwd.value) { showToast('密码不一致哦'.tr); return; } + + if(!RegularExpression().validateString(state.pwd.value)){ + showToast('密码需至少包含数字/字母/字符中的2种组合'.tr); + return; + } final LoginEntity entity = await ApiRepository.to.register( receiverType: state.isIphoneType.value == true ? 1 : 2, countryCode: int.parse(state.countryCode.value), @@ -101,7 +105,6 @@ class StarLockRegisterLogic extends BaseGetXController { void changeInput(TextEditingController controller) { if (controller == state.phoneOrEmailController) { state.phoneOrEmailStr.value = controller.text; - state.phoneOrEmailStrIsOK.value = state.phoneOrEmailStr.value.isNotEmpty; } if (controller == state.pwdController) { state.pwd.value = controller.text; @@ -113,12 +116,17 @@ class StarLockRegisterLogic extends BaseGetXController { state.verificationCode.value = controller.text; } _resetCanSub(); + _resetCanSendCode(); } + // 重置是否能提交 void _resetCanSub() { - state.canSub.value = state.pwdIsOK && - state.codeIsOK && - (state.isIphoneType.value ? state.isIphone : state.isEmail); + state.canSub.value = state.pwdIsOK && state.codeIsOK && state.phoneOrEmailStr.value.isNotEmpty; + } + + // 重置是否能发送验证码 + void _resetCanSendCode() { + state.canSendCode.value = state.pwdIsOK && state.phoneOrEmailStr.value.isNotEmpty; } @override diff --git a/lib/login/register/starLock_register_page.dart b/lib/login/register/starLock_register_page.dart index 6f844e29..b9af45d5 100755 --- a/lib/login/register/starLock_register_page.dart +++ b/lib/login/register/starLock_register_page.dart @@ -295,7 +295,7 @@ class _StarLockRegisterPageState extends State { ), Obx(() => GestureDetector( onTap: - state.phoneOrEmailStrIsOK.value && state.canResend.value + (state.canSendCode.value && state.canResend.value) ? () async { // Navigator.pushNamed(context, Routers.safetyVerificationPage, arguments: {"countryCode":"+86", "account":state.phoneOrEmailStr.value}); final Object? result = await Navigator.pushNamed( @@ -314,7 +314,7 @@ class _StarLockRegisterPageState extends State { // height: 60.h, padding: EdgeInsets.all(10.h), decoration: BoxDecoration( - color: state.phoneOrEmailStrIsOK.value + color: (state.canSendCode.value && state.canResend.value) ? AppColors.mainColor : Colors.grey, borderRadius: BorderRadius.circular(5)), diff --git a/lib/login/register/starLock_register_state.dart b/lib/login/register/starLock_register_state.dart index 4dc202aa..c3c01120 100755 --- a/lib/login/register/starLock_register_state.dart +++ b/lib/login/register/starLock_register_state.dart @@ -18,21 +18,22 @@ class StarLockRegisterState { RxString countryName = '中国'.tr.obs; RxString phoneOrEmailStr = ''.obs; - RxBool phoneOrEmailStrIsOK = false.obs; + // RxBool phoneOrEmailStrIsOK = false.obs; RxString pwd = ''.obs; RxString surePwd = ''.obs; RxString verificationCode = ''.obs; RxString xWidth = ''.obs; // 滑动验证码滑动位置 RxBool isIphoneType = true.obs; - RxBool canSub = false.obs; + RxBool canSub = false.obs;// 是否能提交 RxBool agree = false.obs; + RxBool canSendCode = false.obs;// 是否能发送验证码 - bool get isEmail => RegexUtil.isEmail(phoneOrEmailStr.value); - bool get isIphone => RegexUtil.isMobileSimple(phoneOrEmailStr.value); - bool get pwdIsOK => pwd.value.isNotEmpty && surePwd.value.isNotEmpty; - bool get codeIsOK => verificationCode.value.isNotEmpty; + // bool get isEmail => RegexUtil.isEmail(phoneOrEmailStr.value); + // bool get isIphone => RegexUtil.isMobileSimple(phoneOrEmailStr.value); + bool get pwdIsOK => pwd.value.isNotEmpty && surePwd.value.isNotEmpty && pwd.value.length >= 8 && surePwd.value.length >= 8; + bool get codeIsOK => verificationCode.value.isNotEmpty && verificationCode.value.length >= 6 ; - RxBool canResend = false.obs; + RxBool canResend = false.obs;// 是否能重新发送,就是验证码倒计时之后的重新发送 RxString btnText = ''.obs; int totalSeconds = 120; int currentSecond = 120; diff --git a/lib/login/register/starLock_register_xhj_page.dart b/lib/login/register/starLock_register_xhj_page.dart index f2234e69..6fc7fbbd 100755 --- a/lib/login/register/starLock_register_xhj_page.dart +++ b/lib/login/register/starLock_register_xhj_page.dart @@ -195,7 +195,7 @@ class _StarLockRegisterPageState extends State { ), Obx(() => GestureDetector( onTap: - state.phoneOrEmailStrIsOK.value && state.canResend.value + (state.canSendCode.value && state.canResend.value) ? () async { // Navigator.pushNamed(context, Routers.safetyVerificationPage, arguments: {"countryCode":"+86", "account":state.phoneOrEmailStr.value}); if (state.pwd.value != state.surePwd.value) { @@ -214,13 +214,17 @@ class _StarLockRegisterPageState extends State { } : null, child: Container( - color: Colors.transparent, padding: EdgeInsets.all(10.h), + decoration: BoxDecoration( + color: (state.canSendCode.value && state.canResend.value) + ? AppColors.mainColor + : AppColors.btnDisableColor, + borderRadius: BorderRadius.circular(5)), child: Center( child: Text(state.btnText.value, textAlign: TextAlign.center, style: TextStyle( - color: AppColors.mainColor, + color: Colors.white, fontSize: 22.sp, )), ), diff --git a/lib/mine/minePersonInfo/minePersonInfoResetPassword/minePersonInfoResetPassword_logic.dart b/lib/mine/minePersonInfo/minePersonInfoResetPassword/minePersonInfoResetPassword_logic.dart index 03b016ed..45ebdc29 100755 --- a/lib/mine/minePersonInfo/minePersonInfoResetPassword/minePersonInfoResetPassword_logic.dart +++ b/lib/mine/minePersonInfo/minePersonInfoResetPassword/minePersonInfoResetPassword_logic.dart @@ -2,35 +2,48 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; +import 'package:star_lock/login/login/entity/LoginEntity.dart'; import 'package:star_lock/mine/minePersonInfo/minePersonInfoResetPassword/minePersonInfoResetPassword_state.dart'; import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/tools/baseGetXController.dart'; +import '../../../tools/regularExpression.dart'; + class MinePersonInfoResetPasswordLogic extends BaseGetXController { final MinePersonInfoResetPasswordState state = MinePersonInfoResetPasswordState(); - void changePasswordRequest() async { - if(state.newPwd.value.length < 8){ - showToast("新密码长度不足8位"); + Future changePasswordRequest() async { + // if(state.newPwd.value.length < 8){ + // showToast('新密码长度不足8位'); + // return; + // } + // + // if(state.surePwd.value.length < 8){ + // showToast('确认长度不足8位'); + // return; + // } + // + // if(state.surePwd.value != state.newPwd.value){ + // showToast('两次密码不一致'); + // return; + // } + + if(state.newPwd.value != state.surePwd.value){ + showToast('两次密码不一致哦'.tr); return; } - if(state.surePwd.value.length < 8){ - showToast("确认长度不足8位"); + if(!RegularExpression().validateString(state.newPwd.value)){ + showToast('密码需至少包含数字/字母/字符中的2种组合'.tr); return; } - if(state.surePwd.value != state.newPwd.value){ - showToast("两次密码不一致"); - return; - } - - var entity = await ApiRepository.to.changePassword( + final LoginEntity entity = await ApiRepository.to.changePassword( state.date.value, state.surePwd.value, state.oldPwd.value); if (entity.errorCode!.codeIsSuccessful) { - showToast("重置成功"); + showToast('重置成功'); Get.back(); } } @@ -53,6 +66,6 @@ class MinePersonInfoResetPasswordLogic extends BaseGetXController { } void _resetCanSub() { - state.canSub.value = state.oldPwdIsOK && state.newPwdIsOK; + state.canSub.value = state.oldPwdIsOK && state.newPwdIsOK && state.surePwdIsOK; } } diff --git a/lib/mine/minePersonInfo/minePersonInfoResetPassword/minePersonInfoResetPassword_page.dart b/lib/mine/minePersonInfo/minePersonInfoResetPassword/minePersonInfoResetPassword_page.dart index 66a5cb95..b6cdb379 100755 --- a/lib/mine/minePersonInfo/minePersonInfoResetPassword/minePersonInfoResetPassword_page.dart +++ b/lib/mine/minePersonInfo/minePersonInfoResetPassword/minePersonInfoResetPassword_page.dart @@ -4,6 +4,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/flavors.dart'; import 'package:star_lock/mine/minePersonInfo/minePersonInfoResetPassword/minePersonInfoResetPassword_logic.dart'; +import 'package:star_lock/mine/minePersonInfo/minePersonInfoResetPassword/minePersonInfoResetPassword_state.dart'; import '../../../appRouters.dart'; import '../../../app_settings/app_colors.dart'; @@ -22,8 +23,8 @@ class MinePersonInfoResetPasswordPage extends StatefulWidget { class _MinePersonInfoResetPasswordPageState extends State { - final logic = Get.put(MinePersonInfoResetPasswordLogic()); - final state = Get.find().state; + final MinePersonInfoResetPasswordLogic logic = Get.put(MinePersonInfoResetPasswordLogic()); + final MinePersonInfoResetPasswordState state = Get.find().state; @override Widget build(BuildContext context) { @@ -46,7 +47,7 @@ class _MinePersonInfoResetPasswordPageState body: Container( margin: EdgeInsets.only(left: 30.w, right: 30.w), child: Column( - children: [ + children: [ loginView(), SizedBox(height: 50.w), Obx(() => SubmitBtn( @@ -61,7 +62,7 @@ class _MinePersonInfoResetPasswordPageState SizedBox(height: 40.w), Row( mainAxisAlignment: MainAxisAlignment.center, - children: [ + children: [ GestureDetector( child: SizedBox( // width: 150.w, @@ -87,7 +88,7 @@ class _MinePersonInfoResetPasswordPageState Widget loginView() { Widget view = Column( - children: [ + children: [ LoginInput( controller: state.oldPwdController, onchangeAction: (textStr) { @@ -99,7 +100,8 @@ class _MinePersonInfoResetPasswordPageState style: TextStyle(fontSize: 22.sp), ), hintText: '', - inputFormatters: [ + isLogin: true, + inputFormatters: [ LengthLimitingTextInputFormatter(20), ]), LoginInput( @@ -113,7 +115,8 @@ class _MinePersonInfoResetPasswordPageState style: TextStyle(fontSize: 22.sp), ), hintText: '', - inputFormatters: [ + isLogin: true, + inputFormatters: [ LengthLimitingTextInputFormatter(20), ]), LoginInput( @@ -128,7 +131,8 @@ class _MinePersonInfoResetPasswordPageState style: TextStyle(fontSize: 22.sp), ), hintText: '', - inputFormatters: [ + isLogin: true, + inputFormatters: [ LengthLimitingTextInputFormatter(20), ]), Container( diff --git a/lib/mine/minePersonInfo/minePersonInfoResetPassword/minePersonInfoResetPassword_state.dart b/lib/mine/minePersonInfo/minePersonInfoResetPassword/minePersonInfoResetPassword_state.dart index ab2a419b..74b551a0 100755 --- a/lib/mine/minePersonInfo/minePersonInfoResetPassword/minePersonInfoResetPassword_state.dart +++ b/lib/mine/minePersonInfo/minePersonInfoResetPassword/minePersonInfoResetPassword_state.dart @@ -10,15 +10,15 @@ class MinePersonInfoResetPasswordState { return DateTime.now().millisecondsSinceEpoch; } - var oldPwd = ''.obs; - var newPwd = ''.obs; - var surePwd = ''.obs; - var canSub = false.obs; - var date = currentTimeMillis().toString().obs; + RxString oldPwd = ''.obs; + RxString newPwd = ''.obs; + RxString surePwd = ''.obs; + RxBool canSub = false.obs; + RxString date = currentTimeMillis().toString().obs; - bool get oldPwdIsOK => oldPwd.value.isNotEmpty; - bool get newPwdIsOK => - newPwd.value.isNotEmpty && (newPwd.value == surePwd.value); + bool get oldPwdIsOK => oldPwd.value.isNotEmpty && oldPwd.value.length >= 8; + bool get newPwdIsOK => newPwd.value.isNotEmpty && newPwd.value.length >= 8; + bool get surePwdIsOK => surePwd.value.isNotEmpty && surePwd.value.length >= 8; void onClose() {} } diff --git a/lib/tools/regularExpression.dart b/lib/tools/regularExpression.dart index 2d7c1aaf..390fabd7 100644 --- a/lib/tools/regularExpression.dart +++ b/lib/tools/regularExpression.dart @@ -16,4 +16,26 @@ class RegularExpression { r'https?:\/\/\S+', caseSensitive: false, ); + + // 验证登录密码是否至少包含数字、字母、符号中的两种 + bool validateString(String value) { + // 正则表达式 + RegExp regExpNum = RegExp(r'\d'); // 数字 + RegExp regExpLetter = RegExp(r'[a-zA-Z]'); // 字母 + RegExp regExpSymbol = RegExp(r'[!@#\$&*~]'); // 符号 + + // 将字符串与每个正则表达式进行比较 + bool hasNum = regExpNum.hasMatch(value); + bool hasLetter = regExpLetter.hasMatch(value); + bool hasSymbol = regExpSymbol.hasMatch(value); + + // 计算匹配的数量 + int count = 0; + if (hasNum) count++; + if (hasLetter) count++; + if (hasSymbol) count++; + + // 如果数量大于或等于2,返回true + return count >= 2; + } } diff --git a/lib/tools/tf_loginInput.dart b/lib/tools/tf_loginInput.dart index c4f45c2b..4c7230c3 100755 --- a/lib/tools/tf_loginInput.dart +++ b/lib/tools/tf_loginInput.dart @@ -28,6 +28,7 @@ class LoginInput extends StatefulWidget { BlockStrCallback? onchangeAction; BlockStrCallback? onSubmitted; BlockClickCallback? onTapAction; + bool? isLogin;// 是否是登录之前,因为登录之前的密码框文字显示缩在左上角 默认是false LoginInput({ Key? key, @@ -46,6 +47,7 @@ class LoginInput extends StatefulWidget { this.onchangeAction, this.onTapAction, this.onSubmitted, + this.isLogin = false, }) : super(key: key); @override @@ -123,7 +125,7 @@ class _LoginInputState extends State { if (isPwd) Padding( padding: EdgeInsets.only( - top: F.sw(skyCall: () => 27.h, xhjCall: () => 39.h)), + top: F.sw(skyCall: () => 27.h, xhjCall: () => widget.isLogin! ? 27.h : 39.h)), child: Text( pwd, style: TextStyle( From 60bdbc1b2bba662e439308181a7b11341c859e75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AD=8F=E5=B0=91=E9=98=B3?= <786612630@qq.com> Date: Fri, 13 Sep 2024 14:54:07 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=8F=96=E6=B6=88=E9=94=81=E7=BB=9F?= =?UTF-8?q?=E7=BB=9F=E6=88=91=E7=9A=84=E8=AE=BE=E7=BD=AE=E9=87=8C=E9=9D=A2?= =?UTF-8?q?=E5=A2=9E=E5=80=BC=E6=9C=8D=E5=8A=A1=E5=85=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/mine/mineSet/mineSet/mineSet_page.dart | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/mine/mineSet/mineSet/mineSet_page.dart b/lib/mine/mineSet/mineSet/mineSet_page.dart index c9bd938b..d0a4e228 100755 --- a/lib/mine/mineSet/mineSet/mineSet_page.dart +++ b/lib/mine/mineSet/mineSet/mineSet_page.dart @@ -321,15 +321,16 @@ class _MineSetPageState extends State Navigator.pushNamed( context, Routers.aPPUnlockNeedMobileNetworkingLockPage); }), - CommonItem( - leftTitel: '增值服务'.tr, - isHaveLine: true, - isHaveDirection: true, - action: () { - Get.back(); - Get.toNamed(Routers.valueAddedServicesPage); - }, - ), + if(!F.isSKY) + CommonItem( + leftTitel: '增值服务'.tr, + isHaveLine: true, + isHaveDirection: true, + action: () { + Get.back(); + Get.toNamed(Routers.valueAddedServicesPage); + }, + ), SizedBox( height: 10.h, ), From 3b9e2b1224d163d7f03782eae530198647fd9a96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AD=8F=E5=B0=91=E9=98=B3?= <786612630@qq.com> Date: Fri, 13 Sep 2024 15:22:17 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=86=B2=E7=AA=81?= =?UTF-8?q?=E5=90=88=E5=B9=B6=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lan/lan_en.json | 4 +--- lan/lan_keys.json | 4 ++-- lan/lan_zh.json | 4 +--- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/lan/lan_en.json b/lan/lan_en.json index 40ab7efa..a98074fd 100755 --- a/lan/lan_en.json +++ b/lan/lan_en.json @@ -912,9 +912,7 @@ "支持的国家值":"United States, Canada, United Kingdom, Germany, France, Italy, Spain, Australia, New Zealand, India, Japan", "操作流程": "Operation process", "操作流程值": "1. Open the Alexa app and search for the Skye Smart Lock skill\n2. Click Enable Skill and log in to your Skye account\n3. Say 'Alexa, discover devices' to Alexa\n4. After discovering the device, you can use the voice command to control the lock" - "秒内不可使用面容开锁": "Face unlocking cannot be used within seconds", - "密码需至少包含数字/字母/字符中的2种组合": "The password must contain at least 2 combinations of numbers/letters/characters" - "操作流程值": "1. Open the Alexa app and search for the Skye Smart Lock skill\n2. Click Enable Skill and log in to your Skye account\n3. Say 'Alexa, discover devices' to Alexa\n4. After discovering the device, you can use the voice command to control the lock", + "密码需至少包含数字/字母/字符中的2种组合": "The password must contain at least 2 combinations of numbers/letters/characters", "Google Home": "Google Home", "Action name": "Action name", "ScienerSmart": "ScienerSmart", diff --git a/lan/lan_keys.json b/lan/lan_keys.json index 3618f20a..516d27c7 100755 --- a/lan/lan_keys.json +++ b/lan/lan_keys.json @@ -947,10 +947,10 @@ "支持的国家":"支持的国家", "支持的国家值":"支持的国家值", "操作流程":"操作流程", - "操作流程值":"操作流程值" + "操作流程值":"操作流程值", "秒内不可使用面容开锁": "秒内不可使用面容开锁", - "密码需至少包含数字/字母/字符中的2种组合": "密码需至少包含数字/字母/字符中的2种组合" + "密码需至少包含数字/字母/字符中的2种组合": "密码需至少包含数字/字母/字符中的2种组合", "操作流程值":"操作流程值", "Google Home":"Google Home", "Action name":"Action name", diff --git a/lan/lan_zh.json b/lan/lan_zh.json index 2cc18095..7e91a30a 100755 --- a/lan/lan_zh.json +++ b/lan/lan_zh.json @@ -907,10 +907,8 @@ "支持的国家": "支持的国家", "支持的国家值": "美国、加拿大、英国、澳大利亚、印度、德国、法国、意大利、西班牙、日本", "操作流程": "操作流程", - "操作流程值":"1 用智能锁APP添加锁和网关\n\n2 在APP里开启锁的远程开锁功能(这个功能默认是关闭的)。如果没有这个选项,则锁不支持Alexa \n\n3 在Alexa中添加Skill,并用智能锁APP的账号和密码进行授权。授权成功后就可以发现账号下的设备\n\n4 在Alexa app里找到锁,开启语音开锁的功能,并设置语言密码\n\n5 可以通过Alexa操作锁了" - "秒内不可使用面容开锁": "秒内不可使用面容开锁", - "密码需至少包含数字/字母/字符中的2种组合": "密码需至少包含数字/字母/字符中的2种组合" + "密码需至少包含数字/字母/字符中的2种组合": "密码需至少包含数字/字母/字符中的2种组合", "操作流程值":"1 用智能锁APP添加锁和网关\n\n2 在APP里开启锁的远程开锁功能(这个功能默认是关闭的)。如果没有这个选项,则锁不支持Alexa \n\n3 在Alexa中添加Skill,并用智能锁APP的账号和密码进行授权。授权成功后就可以发现账号下的设备\n\n4 在Alexa app里找到锁,开启语音开锁的功能,并设置语言密码\n\n5 可以通过Alexa操作锁了", "Google Home": "Google Home",