mod: 密码登录手机验证风控流程(未完成)

This commit is contained in:
orz12
2024-08-13 08:41:27 +08:00
parent a669488612
commit 43318de79a
3 changed files with 130 additions and 0 deletions

View File

@@ -502,6 +502,26 @@ class Api {
static const String loginByPwdApi =
'${HttpString.passBaseUrl}/x/passport-login/oauth2/login';
/// 密码登录时,提示“本次登录环境存在风险, 需使用手机号进行验证或绑定”
/// 根据https://ivan.hanloth.cn/archives/530/流程进行手机号验证
/// tmp_code
static const String safeCenterGetInfo =
'${HttpString.passBaseUrl}/x/safecenter/user/info';
/// 验证绑定手机号前的人机验证
static const String preCapture =
'${HttpString.passBaseUrl}/x/safecenter/captcha/pre';
/// 密码登录时风控发送手机验证码
///sms_type str loginTelCheck
/// tmp_code str 验证标记代码 来自数据处理中的解析出的参数tmp_token
/// gee_challenge str 极验id 申请人机验证时得到(data->gee_challenge)
/// gee_seccode str 极验key 人机验证后得到(result->geetest_seccode)
/// gee_validate str 极验result 人机验证后得到(result->geetest_validate)
/// recaptcha_token str 验证token 申请人机验证时得到(data->recaptcha_token)
static const String safeCenterSmsCode =
'${HttpString.passBaseUrl}/x/safecenter/common/sms/send';
/// 密码加密密钥
/// disable_rcmd
/// local_id

View File

@@ -349,4 +349,70 @@ class LoginHttp {
};
}
}
// 密码登录时风控验证手机
static Future safeCenterGetInfo({
required String tmpCode,
}) async {
var res = await Request().get(Api.safeCenterGetInfo, data: {
tmpCode: tmpCode,
});
print(res);
if (res.data['code'] == 0) {
return {'status': true, 'data': res.data['data']};
} else {
return {
'status': false,
'code': res.data['code'],
'msg': res.data['message'],
'data': res.data['data']
};
}
}
// 风控验证手机前的验证码
static Future preCapture() async {
var res = await Request().post(Api.preCapture);
print(res);
if (res.data['code'] == 0) {
return {'status': true, 'data': res.data['data']};
} else {
return {
'status': false,
'code': res.data['code'],
'msg': res.data['message'],
'data': res.data['data']
};
}
}
// 风控验证手机
static Future safeCenterSmsCode({
String? smsType,
required String tmpCode,
required String geeChallenge,
required String geeSeccode,
required String geeValidate,
required String recaptchaToken,
}) async {
var res = await Request().post(Api.safeCenterSmsCode, data: {
'sms_type': smsType ?? 'loginTelCheck',
'tmp_code': tmpCode,
'gee_challenge': geeChallenge,
'gee_seccode': geeSeccode,
'gee_validate': geeValidate,
'recaptcha_token': recaptchaToken,
});
print(res);
if (res.data['code'] == 0) {
return {'status': true, 'data': res.data['data']};
} else {
return {
'status': false,
'code': res.data['code'],
'msg': res.data['message'],
'data': res.data['data']
};
}
}
}