Browse Source
Merge pull request #1537 from colinin/phone-register-password-optional
feat: Phone code registration password is optional
pull/1542/head
yx lin
2 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
5 additions and
3 deletions
-
aspnet-core/modules/account/LINGYUN.Abp.Account.Application.Contracts/LINGYUN/Abp/Account/Dto/PhoneRegisterDto.cs
-
aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/AccountAppService.cs
|
|
@ -27,7 +27,6 @@ public class PhoneRegisterDto |
|
|
[DisplayName("EmailAddress")] |
|
|
[DisplayName("EmailAddress")] |
|
|
public string EmailAddress { get; set; } |
|
|
public string EmailAddress { get; set; } |
|
|
|
|
|
|
|
|
[Required] |
|
|
|
|
|
[DynamicStringLength(typeof(IdentityUserConsts), nameof(IdentityUserConsts.MaxPasswordLength))] |
|
|
[DynamicStringLength(typeof(IdentityUserConsts), nameof(IdentityUserConsts.MaxPasswordLength))] |
|
|
[DataType(DataType.Password)] |
|
|
[DataType(DataType.Password)] |
|
|
[DisplayName("Password")] |
|
|
[DisplayName("Password")] |
|
|
|
|
|
@ -121,7 +121,7 @@ public class AccountAppService : AccountApplicationServiceBase, IAccountAppServi |
|
|
CurrentTenant.Id); |
|
|
CurrentTenant.Id); |
|
|
tempNewUser.SetPhoneNumberRegisterUser(); |
|
|
tempNewUser.SetPhoneNumberRegisterUser(); |
|
|
|
|
|
|
|
|
(await UserManager.UpdateSecurityStampAsync(tempNewUser)).CheckErrors(); |
|
|
await UserStore.SetSecurityStampAsync(tempNewUser, Guid.NewGuid().ToString("n")); |
|
|
|
|
|
|
|
|
var code = await UserManager.GenerateUserTokenAsync( |
|
|
var code = await UserManager.GenerateUserTokenAsync( |
|
|
tempNewUser, |
|
|
tempNewUser, |
|
|
@ -182,7 +182,10 @@ public class AccountAppService : AccountApplicationServiceBase, IAccountAppServi |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
(await UserManager.SetPhoneNumberAsync(user, input.PhoneNumber)).CheckErrors(); |
|
|
(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); |
|
|
await UserStore.SetPhoneNumberConfirmedAsync(user, true); |
|
|
|
|
|
|
|
|
|