feat: 移植注册格式验证和移除验证登录密码功能

This commit is contained in:
wuyaxi 2025-07-17 16:57:20 +08:00
commit 576e330e84
3 changed files with 57 additions and 3 deletions

View File

@ -149,6 +149,35 @@ class StarLockRegisterLogic extends BaseGetXController {
state.pwdIsOK && state.phoneOrEmailStr.value.isNotEmpty;
}
// StarLockRegisterLogic
bool validatePhoneOrEmailFormat() {
final String input = state.phoneOrEmailStr.value;
if (state.isIphoneType.value) {
//
if (input.isEmpty) {
showToast('请输入手机号'.tr);
return false;
}
if (!RegExp(r'^[0-9]+$').hasMatch(input)) {
showToast('手机号只能包含数字'.tr);
return false;
}
} else {
// @
if (input.isEmpty) {
showToast('请输入邮箱地址'.tr);
return false;
}
if (!input.contains('@')) {
showToast('邮箱地址必须包含@符号'.tr);
return false;
}
}
return true;
}
@override
void onReady() {
super.onReady();

View File

@ -135,6 +135,17 @@ class _StarLockRegisterPageState extends State<StarLockRegisterXHJPage> {
Widget middleTFWidget() {
return Column(
children: <Widget>[
// Obx(() => LoginInput(
// controller: state.phoneOrEmailController,
// onchangeAction: (v) {
// logic.checkNext(state.phoneOrEmailController);
// },
// leftWidget: SizedBox(),
// label: state.isIphoneType.value ? '请输入手机号'.tr : '请输入邮箱'.tr,
// keyboardType: TextInputType.number,
// inputFormatters: <TextInputFormatter>[
// LengthLimitingTextInputFormatter(30),
// ])),
Obx(() => LoginInput(
controller: state.phoneOrEmailController,
onchangeAction: (v) {
@ -142,9 +153,18 @@ class _StarLockRegisterPageState extends State<StarLockRegisterXHJPage> {
},
leftWidget: SizedBox(),
label: state.isIphoneType.value ? '请输入手机号'.tr : '请输入邮箱'.tr,
keyboardType: TextInputType.number,
keyboardType: state.isIphoneType.value
? TextInputType.number
: TextInputType.emailAddress,
inputFormatters: <TextInputFormatter>[
LengthLimitingTextInputFormatter(30),
//
if (state.isIphoneType.value)
FilteringTextInputFormatter.digitsOnly //
else
// @._-
FilteringTextInputFormatter.allow(
RegExp(r'[a-zA-Z0-9@._-]'))
])),
LoginInput(
controller: state.pwdController,
@ -190,6 +210,10 @@ class _StarLockRegisterPageState extends State<StarLockRegisterXHJPage> {
Obx(() => GestureDetector(
onTap: (state.canSendCode.value && state.canResend.value)
? () async {
if (!logic.validatePhoneOrEmailFormat()) {
return;
}
// Navigator.pushNamed(context, Routers.safetyVerificationPage, arguments: {"countryCode":"+86", "account":state.phoneOrEmailStr.value});
final result = await Get.toNamed(
Routers.safetyVerificationPage,

View File

@ -563,8 +563,9 @@ class LockSetLogic extends BaseGetXController {
.showIosTipWithContentDialog('删除锁后,所有信息都会一起删除,确定删除锁吗?'.tr, () {
//
state.showTipView.resetGetController();
state.showTipView.showTFViewAlertDialog(
state.passwordTF, '请输入登录密码'.tr, '请输入登录密码'.tr, checkLoginPassword);
factoryDataResetAction();
// state.showTipView.showTFViewAlertDialog(
// state.passwordTF, '请输入登录密码'.tr, '请输入登录密码'.tr, checkLoginPassword);
});
} else if (state.lockBasicInfo.value.keyRight == 1) {
//