修改了重置密码问题

This commit is contained in:
魏少阳 2024-04-03 13:42:26 +08:00
parent 87aa689380
commit 09985bd206
3 changed files with 22 additions and 8 deletions

View File

@ -7,12 +7,28 @@ import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
class MinePersonInfoResetPasswordLogic extends BaseGetXController { class MinePersonInfoResetPasswordLogic extends BaseGetXController {
final MinePersonInfoResetPasswordState state = final MinePersonInfoResetPasswordState state = MinePersonInfoResetPasswordState();
MinePersonInfoResetPasswordState();
void changePasswordRequest() async { 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;
}
var entity = await ApiRepository.to.changePassword( var entity = await ApiRepository.to.changePassword(
state.date.value, state.surePwd.value, state.oldPwd.value, ""); state.date.value,
state.surePwd.value,
state.oldPwd.value);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
showToast("重置成功"); showToast("重置成功");
Get.back(); Get.back();

View File

@ -1570,14 +1570,13 @@ class ApiProvider extends BaseProvider {
// //
Future<Response> changePassword(String date, String newPassword, Future<Response> changePassword(String date, String newPassword,
String oldPassword, String operatorUid) => String oldPassword) =>
post( post(
changePasswordURL.toUrl, changePasswordURL.toUrl,
jsonEncode({ jsonEncode({
"date": date, "date": date,
'newPassword': newPassword, 'newPassword': newPassword,
"oldPassword": oldPassword, "oldPassword": oldPassword,
'operatorUid': operatorUid
})); }));
// //

View File

@ -1601,10 +1601,9 @@ class ApiRepository {
} }
// //
Future<LoginEntity> changePassword(String date, String newPassword, Future<LoginEntity> changePassword(String date, String newPassword, String oldPassword) async {
String oldPassword, String operatorUid) async {
final res = await apiProvider.changePassword( final res = await apiProvider.changePassword(
date, newPassword, oldPassword, operatorUid); date, newPassword, oldPassword);
return LoginEntity.fromJson(res.body); return LoginEntity.fromJson(res.body);
} }