From 9367bc58e7be02a087057e33f4637b09961c5204 Mon Sep 17 00:00:00 2001 From: cKey <35512826+colinin@users.noreply.github.com> Date: Fri, 5 Jun 2020 22:13:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AF=86=E7=A0=81=E9=87=8D?= =?UTF-8?q?=E7=BD=AE=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Abp/Account/Dto/PasswordResetDto.cs | 24 ++ .../LINGYUN/Abp/Account/IAccountAppService.cs | 2 + .../LINGYUN/Abp/Account/AccountAppService.cs | 99 ++++- .../Account/AccountRegisterVerifyCacheItem.cs | 1 + .../Abp/Account/AccountSettingNames.cs | 4 + .../Abp/Account/PhoneNumberVerifyType.cs | 3 +- .../AbpAccountSettingDefinitionProvider.cs | 2 + .../Abp/Account/IIdentityUserRepository.cs | 2 + .../Account/Localization/Resources/en.json | 2 + .../Localization/Resources/zh-Hans.json | 2 + .../LINGYUN/Abp/Account/AccountController.cs | 7 + .../LINGYUN.Abp.FileStorage.Qiniu.csproj | 4 + .../Class1.cs | 8 + ....Abp.IdentityServer.WeChatValidator.csproj | 12 + .../EfCoreIdentityUserExtensionRepository.cs | 9 + .../EfCoreIdentityUserExtensionRepository.cs | 12 +- vueJs/src/api/users.ts | 24 +- vueJs/src/components/LangSelect/index.vue | 1 + vueJs/src/lang/zh.ts | 2 + vueJs/src/permission.ts | 2 +- vueJs/src/router/index.ts | 5 + vueJs/src/views/login/index.vue | 51 ++- vueJs/src/views/register/index.vue | 4 +- vueJs/src/views/reset-password/index.vue | 339 ++++++++++++++++++ 24 files changed, 585 insertions(+), 36 deletions(-) create mode 100644 aspnet-core/modules/account/LINGYUN.Abp.Account.Application.Contracts/LINGYUN/Abp/Account/Dto/PasswordResetDto.cs create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.IdentityServer.WeChatValidator/Class1.cs create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.IdentityServer.WeChatValidator/LINGYUN.Abp.IdentityServer.WeChatValidator.csproj create mode 100644 vueJs/src/views/reset-password/index.vue diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Application.Contracts/LINGYUN/Abp/Account/Dto/PasswordResetDto.cs b/aspnet-core/modules/account/LINGYUN.Abp.Account.Application.Contracts/LINGYUN/Abp/Account/Dto/PasswordResetDto.cs new file mode 100644 index 000000000..a64affca6 --- /dev/null +++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Application.Contracts/LINGYUN/Abp/Account/Dto/PasswordResetDto.cs @@ -0,0 +1,24 @@ +using System.ComponentModel.DataAnnotations; +using Volo.Abp.Auditing; +using Volo.Abp.Identity; + +namespace LINGYUN.Abp.Account +{ + public class PasswordResetDto + { + [Required] + [Phone] + [StringLength(IdentityUserConsts.MaxPhoneNumberLength)] + public string PhoneNumber { get; set; } + + [Required] + [StringLength(IdentityUserConsts.MaxPasswordLength)] + [DataType(DataType.Password)] + [DisableAuditing] + public string NewPassword { get; set; } + + [Required] + [StringLength(6)] + public string VerifyCode { get; set; } + } +} diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Application.Contracts/LINGYUN/Abp/Account/IAccountAppService.cs b/aspnet-core/modules/account/LINGYUN.Abp.Account.Application.Contracts/LINGYUN/Abp/Account/IAccountAppService.cs index 031b76359..eee5ab984 100644 --- a/aspnet-core/modules/account/LINGYUN.Abp.Account.Application.Contracts/LINGYUN/Abp/Account/IAccountAppService.cs +++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Application.Contracts/LINGYUN/Abp/Account/IAccountAppService.cs @@ -8,6 +8,8 @@ namespace LINGYUN.Abp.Account { Task RegisterAsync(RegisterVerifyDto input); + Task ResetPasswordAsync(PasswordResetDto passwordReset); + Task VerifyPhoneNumberAsync(VerifyDto input); } } diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/AccountAppService.cs b/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/AccountAppService.cs index 2c8412887..e73ac96ac 100644 --- a/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/AccountAppService.cs +++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/AccountAppService.cs @@ -8,6 +8,7 @@ using Volo.Abp.Caching; using Volo.Abp.Identity; using Volo.Abp.Settings; using Volo.Abp.Sms; +using Volo.Abp.Uow; namespace LINGYUN.Abp.Account { @@ -87,6 +88,34 @@ namespace LINGYUN.Abp.Account return ObjectMapper.Map(user); } + + // TODO: 是否有必要移动到ProfileService + /// + /// 重置用户密码 + /// + /// + /// + public virtual async Task ResetPasswordAsync(PasswordResetDto passwordReset) + { + // 本来可以不需要的,令牌算法有一个有效期 + // 不过这里采用令牌强制过期策略,避免一个令牌多次使用 + var phoneVerifyCacheKey = NormalizeCacheKey(passwordReset.PhoneNumber); + + var phoneVerifyCacheItem = await Cache.GetAsync(phoneVerifyCacheKey); + if (phoneVerifyCacheItem == null || !phoneVerifyCacheItem.VerifyCode.Equals(passwordReset.VerifyCode)) + { + throw new UserFriendlyException(L["PhoneVerifyCodeInvalid"]); + } + + var userId = await GetUserIdByPhoneNumberAsync(passwordReset.PhoneNumber); + + var user = await UserManager.GetByIdAsync(userId); + + (await UserManager.ResetPasswordAsync(user, phoneVerifyCacheItem.VerifyToken, passwordReset.NewPassword)).CheckErrors(); + + + await Cache.RemoveAsync(phoneVerifyCacheKey); + } /// /// 验证手机号码 /// @@ -124,18 +153,26 @@ namespace LINGYUN.Abp.Account { PhoneNumber = input.PhoneNumber, }; - if (input.VerifyType == PhoneNumberVerifyType.Register) - { - var phoneVerifyCode = new Random().Next(100000, 999999); - verifyCacheItem.VerifyCode = phoneVerifyCode.ToString(); - var templateCode = await SettingProvider.GetOrNullAsync(AccountSettingNames.SmsRegisterTemplateCode); - await SendPhoneVerifyMessageAsync(templateCode, input.PhoneNumber, phoneVerifyCode.ToString()); - } - else + switch (input.VerifyType) { - var phoneVerifyCode = await SendSigninVerifyCodeAsync(input.PhoneNumber); - verifyCacheItem.VerifyCode = phoneVerifyCode; + case PhoneNumberVerifyType.Register: + var phoneVerifyCode = new Random().Next(100000, 999999); + verifyCacheItem.VerifyCode = phoneVerifyCode.ToString(); + var templateCode = await SettingProvider.GetOrNullAsync(AccountSettingNames.SmsRegisterTemplateCode); + await SendPhoneVerifyMessageAsync(templateCode, input.PhoneNumber, phoneVerifyCode.ToString()); + return; + case PhoneNumberVerifyType.Signin: + var phoneSigninCode = await SendSigninVerifyCodeAsync(input.PhoneNumber); + verifyCacheItem.VerifyCode = phoneSigninCode; + break; + case PhoneNumberVerifyType.ResetPassword: + var resetPasswordCode = new Random().Next(100000, 999999); + verifyCacheItem.VerifyCode = resetPasswordCode.ToString(); + var resetPasswordToken = await SendResetPasswordVerifyCodeAsync(input.PhoneNumber, verifyCacheItem.VerifyCode); + verifyCacheItem.VerifyToken = resetPasswordToken; + break; } + var cacheOptions = new DistributedCacheEntryOptions { AbsoluteExpirationRelativeToNow = TimeSpan.FromMinutes(verifyCodeExpiration) @@ -151,11 +188,7 @@ namespace LINGYUN.Abp.Account protected virtual async Task SendSigninVerifyCodeAsync(string phoneNumber) { // 查找用户信息 - var user = await UserRepository.FindByPhoneNumberAsync(phoneNumber); - if (user == null) - { - throw new UserFriendlyException(L["PhoneNumberNotRegisterd"]); - } + var user = await GetUserByPhoneNumberAsync(phoneNumber); // 获取登录验证码模板号 var templateCode = await SettingProvider.GetOrNullAsync(AccountSettingNames.SmsSigninTemplateCode); // 生成手机验证码 @@ -165,6 +198,42 @@ namespace LINGYUN.Abp.Account return phoneVerifyCode; } + + protected virtual async Task SendResetPasswordVerifyCodeAsync(string phoneNumber, string phoneVerifyCode) + { + // 查找用户信息 + var user = await GetUserByPhoneNumberAsync(phoneNumber); + // 获取登录验证码模板号 + var templateCode = await SettingProvider.GetOrNullAsync(AccountSettingNames.SmsResetPasswordTemplateCode); + // 生成重置密码验证码 + var phoneVerifyToken = await UserManager.GeneratePasswordResetTokenAsync(user); + // 发送短信验证码 + await SendPhoneVerifyMessageAsync(templateCode, user.PhoneNumber, phoneVerifyCode); + + return phoneVerifyToken; + } + + protected virtual async Task GetUserByPhoneNumberAsync(string phoneNumber) + { + // 查找用户信息 + var user = await UserRepository.FindByPhoneNumberAsync(phoneNumber); + if (user == null) + { + throw new UserFriendlyException(L["PhoneNumberNotRegisterd"]); + } + return user; + } + + protected virtual async Task GetUserIdByPhoneNumberAsync(string phoneNumber) + { + // 查找用户信息 + var userId = await UserRepository.GetIdByPhoneNumberAsync(phoneNumber); + if (!userId.HasValue) + { + throw new UserFriendlyException(L["PhoneNumberNotRegisterd"]); + } + return userId.Value; + } /// /// 检查是否允许用户注册 /// diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Domain.Shared/LINGYUN/Abp/Account/AccountRegisterVerifyCacheItem.cs b/aspnet-core/modules/account/LINGYUN.Abp.Account.Domain.Shared/LINGYUN/Abp/Account/AccountRegisterVerifyCacheItem.cs index faf78244a..ea74bbe66 100644 --- a/aspnet-core/modules/account/LINGYUN.Abp.Account.Domain.Shared/LINGYUN/Abp/Account/AccountRegisterVerifyCacheItem.cs +++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Domain.Shared/LINGYUN/Abp/Account/AccountRegisterVerifyCacheItem.cs @@ -4,5 +4,6 @@ { public string PhoneNumber { get; set; } public string VerifyCode { get; set; } + public string VerifyToken { get; set; } } } diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Domain.Shared/LINGYUN/Abp/Account/AccountSettingNames.cs b/aspnet-core/modules/account/LINGYUN.Abp.Account.Domain.Shared/LINGYUN/Abp/Account/AccountSettingNames.cs index d3bf2abd9..b5599c281 100644 --- a/aspnet-core/modules/account/LINGYUN.Abp.Account.Domain.Shared/LINGYUN/Abp/Account/AccountSettingNames.cs +++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Domain.Shared/LINGYUN/Abp/Account/AccountSettingNames.cs @@ -15,5 +15,9 @@ /// 用户登录短信验证码模板号 /// public const string SmsSigninTemplateCode = GroupName + ".SmsSigninTemplateCode"; + /// + /// 用户重置密码短信验证码模板号 + /// + public const string SmsResetPasswordTemplateCode = GroupName + ".SmsResetPasswordTemplateCode"; } } diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Domain.Shared/LINGYUN/Abp/Account/PhoneNumberVerifyType.cs b/aspnet-core/modules/account/LINGYUN.Abp.Account.Domain.Shared/LINGYUN/Abp/Account/PhoneNumberVerifyType.cs index 3fb05ebcd..4c01f3b55 100644 --- a/aspnet-core/modules/account/LINGYUN.Abp.Account.Domain.Shared/LINGYUN/Abp/Account/PhoneNumberVerifyType.cs +++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Domain.Shared/LINGYUN/Abp/Account/PhoneNumberVerifyType.cs @@ -3,6 +3,7 @@ public enum PhoneNumberVerifyType : sbyte { Register = 0, - Signin = 10 + Signin = 10, + ResetPassword = 20 } } diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Domain/LINGYUN/Abp/Account/AbpAccountSettingDefinitionProvider.cs b/aspnet-core/modules/account/LINGYUN.Abp.Account.Domain/LINGYUN/Abp/Account/AbpAccountSettingDefinitionProvider.cs index b8f347730..5ea113e60 100644 --- a/aspnet-core/modules/account/LINGYUN.Abp.Account.Domain/LINGYUN/Abp/Account/AbpAccountSettingDefinitionProvider.cs +++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Domain/LINGYUN/Abp/Account/AbpAccountSettingDefinitionProvider.cs @@ -20,6 +20,8 @@ namespace LINGYUN.Abp.Account "SMS_190728520", L("DisplayName:SmsRegisterTemplateCode"), L("Description:SmsRegisterTemplateCode")), new SettingDefinition(AccountSettingNames.SmsSigninTemplateCode, "SMS_190728516", L("DisplayName:SmsSigninTemplateCode"), L("Description:SmsSigninTemplateCode")), + new SettingDefinition(AccountSettingNames.SmsResetPasswordTemplateCode, + "SMS_192530831", L("DisplayName:SmsResetPasswordTemplateCode"), L("Description:SmsResetPasswordTemplateCode")), new SettingDefinition(AccountSettingNames.PhoneVerifyCodeExpiration, "3", L("DisplayName:PhoneVerifyCodeExpiration"), L("Description:PhoneVerifyCodeExpiration")), }; diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Domain/LINGYUN/Abp/Account/IIdentityUserRepository.cs b/aspnet-core/modules/account/LINGYUN.Abp.Account.Domain/LINGYUN/Abp/Account/IIdentityUserRepository.cs index 16fd24b24..360c2f22b 100644 --- a/aspnet-core/modules/account/LINGYUN.Abp.Account.Domain/LINGYUN/Abp/Account/IIdentityUserRepository.cs +++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Domain/LINGYUN/Abp/Account/IIdentityUserRepository.cs @@ -10,5 +10,7 @@ namespace LINGYUN.Abp.Account Task PhoneNumberHasRegistedAsync(string phoneNumber); Task FindByPhoneNumberAsync(string phoneNumber); + + Task GetIdByPhoneNumberAsync(string phoneNumber); } } diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Domain/LINGYUN/Abp/Account/Localization/Resources/en.json b/aspnet-core/modules/account/LINGYUN.Abp.Account.Domain/LINGYUN/Abp/Account/Localization/Resources/en.json index 011e17b0d..d94881919 100644 --- a/aspnet-core/modules/account/LINGYUN.Abp.Account.Domain/LINGYUN/Abp/Account/Localization/Resources/en.json +++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Domain/LINGYUN/Abp/Account/Localization/Resources/en.json @@ -8,6 +8,8 @@ "Description:SmsRegisterTemplateCode": "When the user registers, he/she should send the template number of the SMS verification code and fill in the template number of the corresponding cloud platform registration", "DisplayName:SmsSigninTemplateCode": "Signin sms template", "Description:SmsSigninTemplateCode": "When the user logs in, he/she should send the template number of the SMS verification code and fill in the template number of the corresponding cloud platform registration", + "DisplayName:SmsResetPasswordTemplateCode": "Reset password sms template", + "Description:SmsResetPasswordTemplateCode": "When the user resets the password, he/she sends the template number of SMS verification code and fills in the template number registered on the cloud platform", "DisplayName:PhoneVerifyCodeExpiration": "SMS verification code validity", "Description:PhoneVerifyCodeExpiration": "The valid time for the user to send SMS verification code, unit m, default 3m", "RequiredEmailAddress": "Email address required", diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Domain/LINGYUN/Abp/Account/Localization/Resources/zh-Hans.json b/aspnet-core/modules/account/LINGYUN.Abp.Account.Domain/LINGYUN/Abp/Account/Localization/Resources/zh-Hans.json index 153fc9e6f..114e36d31 100644 --- a/aspnet-core/modules/account/LINGYUN.Abp.Account.Domain/LINGYUN/Abp/Account/Localization/Resources/zh-Hans.json +++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Domain/LINGYUN/Abp/Account/Localization/Resources/zh-Hans.json @@ -8,6 +8,8 @@ "Description:SmsRegisterTemplateCode": "用户注册时发送短信验证码的模板号,填写对应云平台注册的模板号", "DisplayName:SmsSigninTemplateCode": "用户登录短信模板", "Description:SmsSigninTemplateCode": "用户登录时发送短信验证码的模板号,填写对应云平台注册的模板号", + "DisplayName:SmsResetPasswordTemplateCode": "用户重置密码短信模板", + "Description:SmsResetPasswordTemplateCode": "用户重置密码时发送短信验证码的模板号,填写对应云平台注册的模板号", "DisplayName:PhoneVerifyCodeExpiration": "短信验证码有效期", "Description:PhoneVerifyCodeExpiration": "用户发送短信验证码的有效时长,单位m,默认3m", "RequiredEmailAddress": "邮件地址必须输入", diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.HttpApi/LINGYUN/Abp/Account/AccountController.cs b/aspnet-core/modules/account/LINGYUN.Abp.Account.HttpApi/LINGYUN/Abp/Account/AccountController.cs index f1cc98255..af5b83b4a 100644 --- a/aspnet-core/modules/account/LINGYUN.Abp.Account.HttpApi/LINGYUN/Abp/Account/AccountController.cs +++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.HttpApi/LINGYUN/Abp/Account/AccountController.cs @@ -32,5 +32,12 @@ namespace LINGYUN.Abp.Account { await AccountAppService.VerifyPhoneNumberAsync(input); } + + [HttpPut] + [Route("reset-password")] + public virtual async Task ResetPasswordAsync(PasswordResetDto passwordReset) + { + await AccountAppService.ResetPasswordAsync(passwordReset); + } } } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.FileStorage.Qiniu/LINGYUN.Abp.FileStorage.Qiniu.csproj b/aspnet-core/modules/common/LINGYUN.Abp.FileStorage.Qiniu/LINGYUN.Abp.FileStorage.Qiniu.csproj index f9f7278ba..7a4dbebec 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.FileStorage.Qiniu/LINGYUN.Abp.FileStorage.Qiniu.csproj +++ b/aspnet-core/modules/common/LINGYUN.Abp.FileStorage.Qiniu/LINGYUN.Abp.FileStorage.Qiniu.csproj @@ -13,4 +13,8 @@ + + + + diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IdentityServer.WeChatValidator/Class1.cs b/aspnet-core/modules/common/LINGYUN.Abp.IdentityServer.WeChatValidator/Class1.cs new file mode 100644 index 000000000..ea63efae8 --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.IdentityServer.WeChatValidator/Class1.cs @@ -0,0 +1,8 @@ +using System; + +namespace LINGYUN.Abp.IdentityServer.WeChatValidator +{ + public class Class1 + { + } +} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IdentityServer.WeChatValidator/LINGYUN.Abp.IdentityServer.WeChatValidator.csproj b/aspnet-core/modules/common/LINGYUN.Abp.IdentityServer.WeChatValidator/LINGYUN.Abp.IdentityServer.WeChatValidator.csproj new file mode 100644 index 000000000..15534e458 --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.IdentityServer.WeChatValidator/LINGYUN.Abp.IdentityServer.WeChatValidator.csproj @@ -0,0 +1,12 @@ + + + + netcoreapp3.1 + + + + + + + + diff --git a/aspnet-core/services/account/AuthServer.Host/EntityFrameworkCore/Identity/EfCoreIdentityUserExtensionRepository.cs b/aspnet-core/services/account/AuthServer.Host/EntityFrameworkCore/Identity/EfCoreIdentityUserExtensionRepository.cs index 22163ee4e..69727933e 100644 --- a/aspnet-core/services/account/AuthServer.Host/EntityFrameworkCore/Identity/EfCoreIdentityUserExtensionRepository.cs +++ b/aspnet-core/services/account/AuthServer.Host/EntityFrameworkCore/Identity/EfCoreIdentityUserExtensionRepository.cs @@ -24,10 +24,19 @@ namespace AuthServer.Host.EntityFrameworkCore.Identity return await DbSet.AnyAsync(x => x.PhoneNumberConfirmed && x.PhoneNumber.Equals(phoneNumber)); } + public virtual async Task GetIdByPhoneNumberAsync(string phoneNumber) + { + return await DbSet + .Where(x => x.PhoneNumber.Equals(phoneNumber)) + .Select(x => x.Id) + .FirstOrDefaultAsync(); + } + public virtual async Task FindByPhoneNumberAsync(string phoneNumber) { return await WithDetails() .Where(usr => usr.PhoneNumber.Equals(phoneNumber)) + .AsNoTracking() .FirstOrDefaultAsync(); } diff --git a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/EntityFrameworkCore/Identity/EfCoreIdentityUserExtensionRepository.cs b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/EntityFrameworkCore/Identity/EfCoreIdentityUserExtensionRepository.cs index f1e2a7121..c9fd962c4 100644 --- a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/EntityFrameworkCore/Identity/EfCoreIdentityUserExtensionRepository.cs +++ b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/EntityFrameworkCore/Identity/EfCoreIdentityUserExtensionRepository.cs @@ -24,9 +24,19 @@ namespace LINGYUN.Platform.EntityFrameworkCore.Identity return await DbSet.AnyAsync(x => x.PhoneNumberConfirmed && x.PhoneNumber.Equals(phoneNumber)); } + public virtual async Task GetIdByPhoneNumberAsync(string phoneNumber) + { + return await DbSet + .Where(x => x.PhoneNumber.Equals(phoneNumber)) + .Select(x => x.Id) + .FirstOrDefaultAsync(); + } + public virtual async Task FindByPhoneNumberAsync(string phoneNumber) { - return await DbSet.Where(usr => usr.PhoneNumber.Equals(phoneNumber)).FirstOrDefaultAsync(); + return await DbSet.Where(usr => usr.PhoneNumber.Equals(phoneNumber)) + .AsNoTracking() + .FirstOrDefaultAsync(); } } } diff --git a/vueJs/src/api/users.ts b/vueJs/src/api/users.ts index 70cf9e68f..f7555d49e 100644 --- a/vueJs/src/api/users.ts +++ b/vueJs/src/api/users.ts @@ -79,6 +79,16 @@ export default class UserApiService { }) } + public static resetPassword(input: UserResetPasswordData) { + const _url = '/api/account/phone/reset-password' + return ApiService.HttpRequest({ + baseURL: IdentityServiceUrl, + url: _url, + data: input, + method: 'PUT' + }) + } + public static userRegister(registerData: UserRegisterData) { const _url = '/api/account/phone/register' return ApiService.HttpRequest({ @@ -224,8 +234,9 @@ export class UserLoginData { } export enum VerifyType { - register = 0, - signin = 10 + Register = 0, + Signin = 10, + ResetPassword = 20 } export class PhoneVerify { @@ -233,6 +244,15 @@ export class PhoneVerify { verifyType!:VerifyType } +export class UserResetPasswordData { + /** 手机号码 */ + phoneNumber!: string + /** 手机验证码 */ + verifyCode!: string + /** 新密码 */ + newPassword!: string +} + /** 用户手机登录对象 */ export class UserLoginPhoneData { /** 手机号码 */ diff --git a/vueJs/src/components/LangSelect/index.vue b/vueJs/src/components/LangSelect/index.vue index c96add06d..7ecc4778b 100644 --- a/vueJs/src/components/LangSelect/index.vue +++ b/vueJs/src/components/LangSelect/index.vue @@ -30,6 +30,7 @@ + +