mirror of
https://github.com/nsnail/NetAdmin.git
synced 2025-04-22 22:22:51 +08:00
parent
b01b8b24ba
commit
5edcf63e24
@ -70,13 +70,13 @@
|
||||
等于
|
||||
等待发送
|
||||
系统模块
|
||||
绑定手机号
|
||||
绑定手机号码
|
||||
结果非预期
|
||||
群众
|
||||
自定义
|
||||
范围
|
||||
菜单
|
||||
解绑手机号
|
||||
解绑手机号码
|
||||
警告
|
||||
调试
|
||||
跟踪
|
||||
|
@ -58,7 +58,7 @@ XML注释文件不存在
|
||||
父节点不存在
|
||||
用户不存在
|
||||
用户名不能为空
|
||||
用户名不能是手机号
|
||||
用户名不能是手机号码
|
||||
用户名或密码错误
|
||||
用户名长度4位以上
|
||||
用户头像不能为空
|
||||
|
@ -1,7 +1,7 @@
|
||||
namespace NetAdmin.Domain.Attributes.DataValidation;
|
||||
|
||||
/// <summary>
|
||||
/// 手机号验证器
|
||||
/// 手机号码验证器
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Parameter)]
|
||||
public sealed class MobileAttribute : RegexAttribute
|
||||
@ -12,7 +12,7 @@ public sealed class MobileAttribute : RegexAttribute
|
||||
public MobileAttribute() //
|
||||
: base(Chars.RGX_MOBILE)
|
||||
{
|
||||
ErrorMessageResourceName = nameof(Ln.手机号不正确);
|
||||
ErrorMessageResourceName = nameof(Ln.手机号码不正确);
|
||||
ErrorMessageResourceType = typeof(Ln);
|
||||
}
|
||||
}
|
@ -27,8 +27,8 @@ public sealed class UserNameAttribute : RegexAttribute
|
||||
return true;
|
||||
}
|
||||
|
||||
// 不能是手机号
|
||||
ErrorMessageResourceName = nameof(Ln.用户名不能是手机号);
|
||||
// 不能是手机号码
|
||||
ErrorMessageResourceName = nameof(Ln.用户名不能是手机号码);
|
||||
return false;
|
||||
}
|
||||
}
|
@ -49,7 +49,7 @@ public record Sys_User : VersionEntity, IFieldSummary, IFieldEnabled, IRegister
|
||||
public virtual bool Enabled { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 手机号
|
||||
/// 手机号码
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_15)]
|
||||
[JsonIgnore]
|
||||
|
@ -80,7 +80,7 @@ public record Sys_UserProfile : VersionEntity, IRegister
|
||||
public int? EmergencyContactArea { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 紧急联系人手机号
|
||||
/// 紧急联系人手机号码
|
||||
/// </summary>
|
||||
[Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_15)]
|
||||
[JsonIgnore]
|
||||
|
@ -4,13 +4,13 @@ using NetAdmin.Domain.DbMaps.Sys;
|
||||
namespace NetAdmin.Domain.Dto.Sys.User;
|
||||
|
||||
/// <summary>
|
||||
/// 请求:检查手机号是否可用
|
||||
/// 请求:检查手机号码是否可用
|
||||
/// </summary>
|
||||
public sealed record CheckMobileAvailableReq : Sys_User
|
||||
{
|
||||
/// <inheritdoc cref="Sys_User.Mobile" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
[Mobile]
|
||||
[Required(ErrorMessageResourceType = typeof(Ln), ErrorMessageResourceName = nameof(Ln.手机号不能为空))]
|
||||
[Required(ErrorMessageResourceType = typeof(Ln), ErrorMessageResourceName = nameof(Ln.手机号码不能为空))]
|
||||
public override string Mobile { get; init; }
|
||||
}
|
@ -8,7 +8,7 @@ namespace NetAdmin.Domain.Dto.Sys.User;
|
||||
public sealed record LoginByPwdReq : DataAbstraction
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户名、手机号、邮箱
|
||||
/// 用户名、手机号码、邮箱
|
||||
/// </summary>
|
||||
[Required(ErrorMessageResourceType = typeof(Ln), ErrorMessageResourceName = nameof(Ln.账号不能为空))]
|
||||
public string Account { get; init; }
|
||||
|
@ -3,7 +3,7 @@ using NetAdmin.Domain.Dto.Sys.VerifyCode;
|
||||
namespace NetAdmin.Domain.Dto.Sys.User;
|
||||
|
||||
/// <summary>
|
||||
/// 请求:设置手机号
|
||||
/// 请求:设置手机号码
|
||||
/// </summary>
|
||||
public sealed record SetMobileReq : DataAbstraction
|
||||
{
|
||||
|
@ -7,9 +7,9 @@ namespace NetAdmin.Domain.Enums.Sys;
|
||||
public enum VerifyCodeTypes
|
||||
{
|
||||
/// <summary>
|
||||
/// 绑定手机号
|
||||
/// 绑定手机号码
|
||||
/// </summary>
|
||||
[ResourceDescription<Ln>(nameof(Ln.绑定手机号))]
|
||||
[ResourceDescription<Ln>(nameof(Ln.绑定手机号码))]
|
||||
LinkMobile = 1
|
||||
|
||||
,
|
||||
@ -23,9 +23,9 @@ public enum VerifyCodeTypes
|
||||
,
|
||||
|
||||
/// <summary>
|
||||
/// 解绑手机号
|
||||
/// 解绑手机号码
|
||||
/// </summary>
|
||||
[ResourceDescription<Ln>(nameof(Ln.解绑手机号))]
|
||||
[ResourceDescription<Ln>(nameof(Ln.解绑手机号码))]
|
||||
UnlinkMobile = 3
|
||||
|
||||
,
|
||||
|
@ -15,7 +15,7 @@ public interface IUserModule : ICrudModule<CreateUserReq, QueryUserRsp // 创建
|
||||
>
|
||||
{
|
||||
/// <summary>
|
||||
/// 检查手机号是否可用
|
||||
/// 检查手机号码是否可用
|
||||
/// </summary>
|
||||
Task<bool> CheckMobileAvailableAsync(CheckMobileAvailableReq req);
|
||||
|
||||
@ -65,7 +65,7 @@ public interface IUserModule : ICrudModule<CreateUserReq, QueryUserRsp // 创建
|
||||
Task SetEnabledAsync(SetUserEnabledReq req);
|
||||
|
||||
/// <summary>
|
||||
/// 设置手机号
|
||||
/// 设置手机号码
|
||||
/// </summary>
|
||||
Task<UserInfoRsp> SetMobileAsync(SetMobileReq req);
|
||||
|
||||
|
@ -284,14 +284,14 @@ public sealed class UserService(
|
||||
.ToOneAsync(a => new { a.Mobile, a.Version, a.Email })
|
||||
.ConfigureAwait(false);
|
||||
|
||||
// 如果已绑定手机号、需要手机安全验证
|
||||
// 如果已绑定手机号码、需要手机安全验证
|
||||
if (!user.Mobile.NullOrEmpty()) {
|
||||
if (!await verifyCodeService.VerifyAsync(req.VerifySmsCodeReq).ConfigureAwait(false)) {
|
||||
throw new NetAdminInvalidOperationException(Ln.验证码不正确);
|
||||
}
|
||||
|
||||
if (user.Mobile != req.VerifySmsCodeReq.DestDevice) {
|
||||
throw new NetAdminInvalidOperationException($"{Ln.手机号不正确}");
|
||||
throw new NetAdminInvalidOperationException($"{Ln.手机号码不正确}");
|
||||
}
|
||||
}
|
||||
|
||||
@ -328,19 +328,19 @@ public sealed class UserService(
|
||||
.ConfigureAwait(false);
|
||||
|
||||
if (!user.Mobile.NullOrEmpty()) {
|
||||
// 已有手机号,需验证旧手机
|
||||
// 已有手机号码,需验证旧手机
|
||||
if (!await verifyCodeService.VerifyAsync(req.OriginVerifySmsCodeReq).ConfigureAwait(false)) {
|
||||
throw new NetAdminInvalidOperationException($"{Ln.旧手机号验证码不正确}");
|
||||
throw new NetAdminInvalidOperationException($"{Ln.旧手机号码验证码不正确}");
|
||||
}
|
||||
|
||||
if (user.Mobile != req.OriginVerifySmsCodeReq.DestDevice) {
|
||||
throw new NetAdminInvalidOperationException($"{Ln.旧手机号不正确}");
|
||||
throw new NetAdminInvalidOperationException($"{Ln.旧手机号码不正确}");
|
||||
}
|
||||
}
|
||||
|
||||
// 验证新手机号
|
||||
// 验证新手机号码
|
||||
if (!await verifyCodeService.VerifyAsync(req.NewVerifySmsCodeReq).ConfigureAwait(false)) {
|
||||
throw new NetAdminInvalidOperationException($"{Ln.新手机号验证码不正确}");
|
||||
throw new NetAdminInvalidOperationException($"{Ln.新手机号码验证码不正确}");
|
||||
}
|
||||
|
||||
if (await Rpo.UpdateDiy
|
||||
|
@ -27,7 +27,7 @@ public sealed class UserController(IUserCache cache, IConfigCache configCache)
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查手机号是否可用
|
||||
/// 检查手机号码是否可用
|
||||
/// </summary>
|
||||
[AllowAnonymous]
|
||||
public Task<bool> CheckMobileAvailableAsync(CheckMobileAvailableReq req)
|
||||
@ -192,7 +192,7 @@ public sealed class UserController(IUserCache cache, IConfigCache configCache)
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置手机号
|
||||
/// 设置手机号码
|
||||
/// </summary>
|
||||
[Transaction]
|
||||
public Task<UserInfoRsp> SetMobileAsync(SetMobileReq req)
|
||||
|
Loading…
x
Reference in New Issue
Block a user