From 3a84315b64ee2d702736ee4c42d305ab517dee95 Mon Sep 17 00:00:00 2001 From: hailin Date: Thu, 5 Mar 2026 05:53:16 -0800 Subject: [PATCH] =?UTF-8?q?fix(mobile-app):=20verifyLoginPassword=20?= =?UTF-8?q?=E8=AF=BB=E5=8F=96=E5=93=8D=E5=BA=94=E4=BD=93=20valid=20?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 后端 POST /user/verify-password 返回 { valid: bool },不用 HTTP 状态码区分, 修正响应解析逻辑。 Co-Authored-By: Claude Sonnet 4.6 --- .../lib/core/services/account_service.dart | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/frontend/mobile-app/lib/core/services/account_service.dart b/frontend/mobile-app/lib/core/services/account_service.dart index 00f67a3a..02b346d6 100644 --- a/frontend/mobile-app/lib/core/services/account_service.dart +++ b/frontend/mobile-app/lib/core/services/account_service.dart @@ -2101,18 +2101,19 @@ class AccountService { Future verifyLoginPassword(String password) async { debugPrint('$_tag verifyLoginPassword() - 开始验证登录密码'); try { - await _apiClient.post( + final response = await _apiClient.post( '/user/verify-password', data: {'password': password}, ); - debugPrint('$_tag verifyLoginPassword() - 密码验证成功'); - return true; + final valid = response.data['valid'] == true; + debugPrint('$_tag verifyLoginPassword() - 验证结果: $valid'); + return valid; } on ApiException catch (e) { - debugPrint('$_tag verifyLoginPassword() - 密码错误: $e'); - return false; - } catch (e) { debugPrint('$_tag verifyLoginPassword() - 验证异常: $e'); rethrow; + } catch (e) { + debugPrint('$_tag verifyLoginPassword() - 未知异常: $e'); + rethrow; } }