新增手机号码和手机找回密码优化功能

(cherry picked from commit 577dd6eab9ee403ce78850f71e11a5f48dc265b5)
This commit is contained in:
2025-11-01 00:42:10 -07:00
committed by speakeloudest
parent 3f838d224c
commit f71575ee91
2 changed files with 33 additions and 7 deletions
+5 -2
View File
@@ -25,8 +25,11 @@ abstract class Api {
/// 删除账号
static const String kr_deleteAccount = "/v1/public/user/delete_account";
/// 忘记密码-设置新密码
static const String kr_setNewPsdByForgetPsd = "/v1/app/auth/reset_password";
/// 忘记密码-邮箱重置密码
static const String kr_resetPassword = "/v1/auth/reset";
/// 忘记密码-手机号重置密码
static const String kr_resetPasswordByTelephone = "/v1/auth/reset/telephone";
/// 节点信息(包含试用/付费标志)
static const String kr_nodeList = "/v1/public/subscribe/node/list";
+28 -5
View File
@@ -285,17 +285,40 @@ class KRAuthApi {
return right("");
}
/// 忘记密码-设置新密码(仅支持邮箱)
Future<Either<HttpError, String>> kr_setNewPsdByForgetPsd(
/// 忘记密码-邮箱重置密码
Future<Either<HttpError, String>> kr_resetPassword(
String email, String code, String password) async {
final Map<String, dynamic> data = <String, dynamic>{};
data['identifier'] = KRDeviceInfoService().deviceId ?? 'unknown';
data['email'] = email;
data['password'] = password;
data["code"] = code;
data["identifier"] = KRDeviceInfoService().deviceId ?? 'unknown';
data['code'] = code;
data['cf_token'] = ""; // Cloudflare token,暂时留空
BaseResponse<KRLoginData> baseResponse = await HttpUtil.getInstance()
.request<KRLoginData>(Api.kr_setNewPsdByForgetPsd, data,
.request<KRLoginData>(Api.kr_resetPassword, data,
method: HttpMethod.POST, isShowLoading: true);
if (!baseResponse.isSuccess) {
return left(
HttpError(msg: baseResponse.retMsg, code: baseResponse.retCode));
}
return right(baseResponse.model.kr_token.toString());
}
/// 忘记密码-手机号重置密码
Future<Either<HttpError, String>> kr_resetPasswordByTelephone(
String telephone, String areaCode, String code, String password) async {
final Map<String, dynamic> data = <String, dynamic>{};
data['identifier'] = KRDeviceInfoService().deviceId ?? 'unknown';
data['telephone'] = telephone;
data['telephone_area_code'] = areaCode;
data['password'] = password;
data['code'] = code;
data['cf_token'] = ""; // Cloudflare token,暂时留空
BaseResponse<KRLoginData> baseResponse = await HttpUtil.getInstance()
.request<KRLoginData>(Api.kr_resetPasswordByTelephone, data,
method: HttpMethod.POST, isShowLoading: true);
if (!baseResponse.isSuccess) {
return left(