1、优化注册、忘记密码、重置密码功能,密码限制及密码不一样时显示问题
This commit is contained in:
parent
75b400c0e9
commit
eb401fb8ef
@ -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"
|
||||
}
|
||||
|
||||
@ -941,5 +941,7 @@
|
||||
"感应到门前约0.5米有人时,将自动启动面部识别开锁。": "感应到门前约0.5米有人时,将自动启动面部识别开锁。",
|
||||
"感应距离已关闭,需手动触摸键盘任意键,进行面部识别开锁。": "感应距离已关闭,需手动触摸键盘任意键,进行面部识别开锁。",
|
||||
"防误开已打开,开锁后": "防误开已打开,开锁后",
|
||||
"秒内不可使用面容开锁": "秒内不可使用面容开锁"
|
||||
"秒内不可使用面容开锁": "秒内不可使用面容开锁",
|
||||
|
||||
"密码需至少包含数字/字母/字符中的2种组合": "密码需至少包含数字/字母/字符中的2种组合"
|
||||
}
|
||||
|
||||
@ -901,5 +901,8 @@
|
||||
"感应到门前约0.5米有人时,将自动启动面部识别开锁。": "感应到门前约0.5米有人时,将自动启动面部识别开锁。",
|
||||
"感应距离已关闭,需手动触摸键盘任意键,进行面部识别开锁。": "感应距离已关闭,需手动触摸键盘任意键,进行面部识别开锁。",
|
||||
"防误开已打开,开锁后": "防误开已打开,开锁后",
|
||||
"秒内不可使用面容开锁": "秒内不可使用面容开锁"
|
||||
"秒内不可使用面容开锁": "秒内不可使用面容开锁",
|
||||
|
||||
"密码需至少包含数字/字母/字符中的2种组合": "密码需至少包含数字/字母/字符中的2种组合"
|
||||
|
||||
}
|
||||
|
||||
@ -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<void> 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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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)),
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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,
|
||||
)),
|
||||
),
|
||||
|
||||
@ -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<void> 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
|
||||
|
||||
@ -295,7 +295,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
||||
),
|
||||
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<StarLockRegisterPage> {
|
||||
// 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)),
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -195,7 +195,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterXHJPage> {
|
||||
),
|
||||
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<StarLockRegisterXHJPage> {
|
||||
}
|
||||
: 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,
|
||||
)),
|
||||
),
|
||||
|
||||
@ -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<void> 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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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<MinePersonInfoResetPasswordPage> {
|
||||
final logic = Get.put(MinePersonInfoResetPasswordLogic());
|
||||
final state = Get.find<MinePersonInfoResetPasswordLogic>().state;
|
||||
final MinePersonInfoResetPasswordLogic logic = Get.put(MinePersonInfoResetPasswordLogic());
|
||||
final MinePersonInfoResetPasswordState state = Get.find<MinePersonInfoResetPasswordLogic>().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: <Widget>[
|
||||
loginView(),
|
||||
SizedBox(height: 50.w),
|
||||
Obx(() => SubmitBtn(
|
||||
@ -61,7 +62,7 @@ class _MinePersonInfoResetPasswordPageState
|
||||
SizedBox(height: 40.w),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
GestureDetector(
|
||||
child: SizedBox(
|
||||
// width: 150.w,
|
||||
@ -87,7 +88,7 @@ class _MinePersonInfoResetPasswordPageState
|
||||
|
||||
Widget loginView() {
|
||||
Widget view = Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
LoginInput(
|
||||
controller: state.oldPwdController,
|
||||
onchangeAction: (textStr) {
|
||||
@ -99,7 +100,8 @@ class _MinePersonInfoResetPasswordPageState
|
||||
style: TextStyle(fontSize: 22.sp),
|
||||
),
|
||||
hintText: '',
|
||||
inputFormatters: [
|
||||
isLogin: true,
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
LengthLimitingTextInputFormatter(20),
|
||||
]),
|
||||
LoginInput(
|
||||
@ -113,7 +115,8 @@ class _MinePersonInfoResetPasswordPageState
|
||||
style: TextStyle(fontSize: 22.sp),
|
||||
),
|
||||
hintText: '',
|
||||
inputFormatters: [
|
||||
isLogin: true,
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
LengthLimitingTextInputFormatter(20),
|
||||
]),
|
||||
LoginInput(
|
||||
@ -128,7 +131,8 @@ class _MinePersonInfoResetPasswordPageState
|
||||
style: TextStyle(fontSize: 22.sp),
|
||||
),
|
||||
hintText: '',
|
||||
inputFormatters: [
|
||||
isLogin: true,
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
LengthLimitingTextInputFormatter(20),
|
||||
]),
|
||||
Container(
|
||||
|
||||
@ -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() {}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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<LoginInput> {
|
||||
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(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user