feat: 支持注册带入昵称
This commit is contained in:
@@ -8,12 +8,12 @@
|
||||
/// <summary>
|
||||
/// 账号
|
||||
/// </summary>
|
||||
public string UserName { get; set; } = string.Empty;
|
||||
public string UserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 密码
|
||||
/// </summary>
|
||||
public string Password { get; set; } = string.Empty;
|
||||
public string Password { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 唯一标识码
|
||||
@@ -29,5 +29,11 @@
|
||||
/// 验证码
|
||||
/// </summary>
|
||||
public string? Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 昵称
|
||||
/// </summary>
|
||||
public string? Nick{ get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,7 +245,7 @@ namespace Yi.Framework.Rbac.Application.Services
|
||||
}
|
||||
|
||||
//注册领域逻辑
|
||||
await _accountManager.RegisterAsync(input.UserName, input.Password, input.Phone);
|
||||
await _accountManager.RegisterAsync(input.UserName, input.Password, input.Phone,input.Nick);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -19,12 +19,12 @@ namespace Yi.Framework.Rbac.Domain.Entities
|
||||
{
|
||||
|
||||
}
|
||||
public UserAggregateRoot(string userName, string password, long phone, string nick = "萌新")
|
||||
public UserAggregateRoot(string userName, string password, long phone, string? nick = null)
|
||||
{
|
||||
UserName = userName;
|
||||
EncryPassword.Password = password;
|
||||
Phone = phone;
|
||||
Nick = nick+"-"+userName;
|
||||
Nick =string.IsNullOrWhiteSpace(nick)?"萌新-"+userName:nick.Trim();
|
||||
BuildPassword();
|
||||
}
|
||||
|
||||
|
||||
@@ -271,9 +271,9 @@ namespace Yi.Framework.Rbac.Domain.Managers
|
||||
/// <param name="password"></param>
|
||||
/// <param name="phone"></param>
|
||||
/// <returns></returns>
|
||||
public async Task RegisterAsync(string userName, string password, long phone)
|
||||
public async Task RegisterAsync(string userName, string password, long phone,string? nick)
|
||||
{
|
||||
var user = new UserAggregateRoot(userName, password, phone);
|
||||
var user = new UserAggregateRoot(userName, password, phone,nick);
|
||||
await _userManager.CreateAsync(user);
|
||||
await _userManager.SetDefautRoleAsync(user.Id);
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Yi.Framework.Rbac.Domain.Managers
|
||||
string CreateRefreshToken(Guid userId);
|
||||
Task<string> GetTokenByUserIdAsync(Guid userId,Action<UserRoleMenuDto>? getUserInfo=null);
|
||||
Task LoginValidationAsync(string userName, string password, Action<UserAggregateRoot>? userAction = null);
|
||||
Task RegisterAsync(string userName, string password, long phone);
|
||||
Task RegisterAsync(string userName, string password, long phone,string? nick);
|
||||
Task<bool> RestPasswordAsync(Guid userId, string password);
|
||||
Task UpdatePasswordAsync(Guid userId, string newPassword, string oldPassword);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user