Browse Source

feat: Phone code registration password is optional

pull/1537/head
colin 2 months ago
parent
commit
9da36bcf68
  1. 1
      aspnet-core/modules/account/LINGYUN.Abp.Account.Application.Contracts/LINGYUN/Abp/Account/Dto/PhoneRegisterDto.cs
  2. 7
      aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/AccountAppService.cs

1
aspnet-core/modules/account/LINGYUN.Abp.Account.Application.Contracts/LINGYUN/Abp/Account/Dto/PhoneRegisterDto.cs

@ -27,7 +27,6 @@ public class PhoneRegisterDto
[DisplayName("EmailAddress")]
public string EmailAddress { get; set; }
[Required]
[DynamicStringLength(typeof(IdentityUserConsts), nameof(IdentityUserConsts.MaxPasswordLength))]
[DataType(DataType.Password)]
[DisplayName("Password")]

7
aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/AccountAppService.cs

@ -121,7 +121,7 @@ public class AccountAppService : AccountApplicationServiceBase, IAccountAppServi
CurrentTenant.Id);
tempNewUser.SetPhoneNumberRegisterUser();
(await UserManager.UpdateSecurityStampAsync(tempNewUser)).CheckErrors();
await UserStore.SetSecurityStampAsync(tempNewUser, Guid.NewGuid().ToString("n"));
var code = await UserManager.GenerateUserTokenAsync(
tempNewUser,
@ -182,7 +182,10 @@ public class AccountAppService : AccountApplicationServiceBase, IAccountAppServi
};
(await UserManager.SetPhoneNumberAsync(user, input.PhoneNumber)).CheckErrors();
(await UserManager.CreateAsync(user, input.Password)).CheckErrors();
if (!input.Password.IsNullOrWhiteSpace())
{
(await UserManager.CreateAsync(user, input.Password)).CheckErrors();
}
await UserStore.SetPhoneNumberConfirmedAsync(user, true);

Loading…
Cancel
Save