feat: 支持修改手机号验证功能
parent
f88b0952ca
commit
b1d1a3c77c
|
@ -229,5 +229,17 @@ namespace Storage.Test {
|
|||
//public async Task ResetPasswordBySMSCode() {
|
||||
// await LCUser.ResetPasswordBySmsCode("15101006007", "732552", "112358");
|
||||
//}
|
||||
|
||||
[Test]
|
||||
public async Task RequestSMSCodeForUpdatingPhoneNumber() {
|
||||
await LCUser.Login("hello", "world");
|
||||
await LCUser.RequestSMSCodeForUpdatingPhoneNumber("15101006007");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task VerifyCodeForUpdatingPhoneNumber() {
|
||||
await LCUser.Login("hello", "world");
|
||||
await LCUser.VerifyCodeForUpdatingPhoneNumber("15101006007", "055595");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -555,5 +555,39 @@ namespace LeanCloud.Storage {
|
|||
authData["main_account"] = option.AsMainAccount;
|
||||
authData["unionid"] = unionId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 请求修改手机号验证码
|
||||
/// </summary>
|
||||
/// <param name="mobile"></param>
|
||||
/// <param name="ttl"></param>
|
||||
/// <param name="captchaToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task RequestSMSCodeForUpdatingPhoneNumber(string mobile, int ttl = 360, string captchaToken = null) {
|
||||
string path = "requestChangePhoneNumber";
|
||||
Dictionary<string, object> data = new Dictionary<string, object> {
|
||||
{ "mobilePhoneNumber", mobile },
|
||||
{ "ttl", ttl }
|
||||
};
|
||||
if (!string.IsNullOrEmpty(captchaToken)) {
|
||||
data["validate_token"] = captchaToken;
|
||||
}
|
||||
await LCApplication.HttpClient.Post<Dictionary<string, object>>(path, data: data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 验证修改手机号验证码
|
||||
/// </summary>
|
||||
/// <param name="mobile"></param>
|
||||
/// <param name="code"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task VerifyCodeForUpdatingPhoneNumber(string mobile, string code) {
|
||||
string path = "changePhoneNumber";
|
||||
Dictionary<string, object> data = new Dictionary<string, object> {
|
||||
{ "mobilePhoneNumber", mobile },
|
||||
{ "code", code }
|
||||
};
|
||||
await LCApplication.HttpClient.Post<Dictionary<string, object>>(path, data: data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue