feat:完成注册功能
This commit is contained in:
@@ -55,7 +55,8 @@ namespace Yi.Framework.Sms.Aliyun
|
|||||||
{
|
{
|
||||||
PhoneNumbers = phoneNumbers,
|
PhoneNumbers = phoneNumbers,
|
||||||
SignName = Options.SignName,
|
SignName = Options.SignName,
|
||||||
TemplateCode = code,
|
TemplateCode = Options.TemplateCode,
|
||||||
|
TemplateParam = System.Text.Json.JsonSerializer.Serialize(new { code })
|
||||||
};
|
};
|
||||||
|
|
||||||
var response = await AliyunClient.SendSmsAsync(sendSmsRequest);
|
var response = await AliyunClient.SendSmsAsync(sendSmsRequest);
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ namespace Yi.Framework.Sms.Aliyun
|
|||||||
|
|
||||||
public string SignName { get; set; }
|
public string SignName { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public string TemplateCode { get; set; }
|
||||||
public bool EnableFeature { get; set; } = true;
|
public bool EnableFeature { get; set; } = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,7 @@
|
|||||||
"AccessKeyId": "",
|
"AccessKeyId": "",
|
||||||
"AccessKeySecret": "",
|
"AccessKeySecret": "",
|
||||||
"SignName": "",
|
"SignName": "",
|
||||||
|
"TemplateCode": "",
|
||||||
"EnableFeature": false
|
"EnableFeature": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,7 @@
|
|||||||
"AccessKeyId": "",
|
"AccessKeyId": "",
|
||||||
"AccessKeySecret": "",
|
"AccessKeySecret": "",
|
||||||
"SignName": "",
|
"SignName": "",
|
||||||
|
"TemplateCode": "",
|
||||||
"EnableFeature": false
|
"EnableFeature": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -172,13 +172,19 @@ namespace Yi.RBAC.Application.Identity
|
|||||||
/// 验证电话号码
|
/// 验证电话号码
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="str_handset"></param>
|
/// <param name="str_handset"></param>
|
||||||
private void ValidationPhone(string str_handset)
|
private async Task ValidationPhone(string str_handset)
|
||||||
{
|
{
|
||||||
var res= Regex.IsMatch(str_handset, "^(0\\d{2,3}-?\\d{7,8}(-\\d{3,5}){0,1})|(((13[0-9])|(15([0-3]|[5-9]))|(18[0-9])|(17[0-9])|(14[0-9]))\\d{8})$");
|
var res= Regex.IsMatch(str_handset, "^(0\\d{2,3}-?\\d{7,8}(-\\d{3,5}){0,1})|(((13[0-9])|(15([0-3]|[5-9]))|(18[0-9])|(17[0-9])|(14[0-9]))\\d{8})$");
|
||||||
if (res == false)
|
if (res == false)
|
||||||
{
|
{
|
||||||
throw new UserFriendlyException("手机号码格式错误!请检查");
|
throw new UserFriendlyException("手机号码格式错误!请检查");
|
||||||
}
|
}
|
||||||
|
if (await _userRepository.IsAnyAsync(x => x.Phone.ToString() == str_handset))
|
||||||
|
{
|
||||||
|
throw new UserFriendlyException("该手机号已被注册!");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -189,7 +195,7 @@ namespace Yi.RBAC.Application.Identity
|
|||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
public async Task<object> PostCaptchaPhone(PhoneCaptchaImageDto input)
|
public async Task<object> PostCaptchaPhone(PhoneCaptchaImageDto input)
|
||||||
{
|
{
|
||||||
ValidationPhone(input.Phone);
|
await ValidationPhone(input.Phone);
|
||||||
var value = _cacheManager.Get<string>($"Yi:Phone:{input.Phone}");
|
var value = _cacheManager.Get<string>($"Yi:Phone:{input.Phone}");
|
||||||
|
|
||||||
//防止暴刷
|
//防止暴刷
|
||||||
|
|||||||
Reference in New Issue
Block a user