客户端修改密码

master
ZR20090193-陈敬勇 2 years ago
parent fcc973b051
commit c6fb7393fe

@ -30,6 +30,7 @@
{
label: '旧密码',
field: 'oldPassword',
colProps: { span: 20 },
component: 'InputPassword',
required: true,
},
@ -37,6 +38,7 @@
label: '新密码',
field: 'newPassword',
component: 'StrengthMeter',
colProps: { span: 20 },
componentProps: {
placeholder: '请输入新密码',
},
@ -50,6 +52,7 @@
{
label: '确认新密码',
field: 'confirmPassword',
colProps: { span: 20 },
component: 'InputPassword',
// dynamicRules: ({ values }) => rules.confirmPassword(values, true),
},

@ -30,7 +30,7 @@
<!-- icon="ion:lock-closed-outline"-->
<!-- />-->
<!-- <MenuItem key="tenant" text="切换租户" icon="ant-design:cluster-outlined" />-->
<!-- <MenuItem key="password" text="修改密码" icon="ant-design:edit-outlined" />-->
<MenuItem key="password" text="修改密码" icon="ant-design:edit-outlined" />
</Menu>
</template>
</Dropdown>

@ -0,0 +1,48 @@
using FluentValidation;
namespace DS.WMS.Core.System.Dtos;
/// <summary>
/// 修改密码实体
/// </summary>
public class ChangePasswordInput
{
// /// <summary>
// /// 用户Id
// /// </summary>
// public string UserId { get; set; }
/// <summary>
/// 旧密码
/// </summary>
public string OldPassword { get; set; }
/// <summary>
/// 新密码
/// </summary>
public string NewPassword { get; set; }
/// <summary>
/// 确认密码
/// </summary>
public string ConfirmPassword { get; set; }
}
/// <summary>
/// 验证
/// </summary>
public class ChangePasswordInputValidator : AbstractValidator<ChangePasswordInput>
{
/// <summary>
/// 构造函数
/// </summary>
public ChangePasswordInputValidator()
{
// this.RuleFor(o => o.UserId)
// .NotEmpty().WithName("用户Id");
this.RuleFor(o => o.OldPassword)
.NotEmpty().WithName("旧密码") ;
this.RuleFor(o => o.NewPassword)
.NotEmpty().WithName("新密码") ;
this.RuleFor(o => o.ConfirmPassword)
.NotEmpty().WithName("确认密码") ;
}
}

@ -93,4 +93,11 @@ public interface ICommonService
/// <param name="request"></param>
/// <returns></returns>
public DataResult<List<WmsStoreListPagModel>> GetWmsStoreList(PageRequest request);
/// <summary>
/// 修改密码
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public DataResult ChangePassword(ChangePasswordInput model);
}

@ -636,4 +636,39 @@ public class CommonService : ICommonService
.Where(whereList).Where(a => a.ClientId == companyId && a.STORAGEUNITCOUNT >0).ToQueryPage(request.PageCondition);
return data;
}
#region 修改密码
/// <summary>
/// 修改密码
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public DataResult ChangePassword(ChangePasswordInput model)
{
var userId = user.UserId;
var userInfo = db.Queryable<tb_User>().First(x => x.Gid == Guid.Parse(userId));
if (model.OldPassword == model.NewPassword)
{
return DataResult.Failed("旧密码与新密码一致!");
}
if (model.NewPassword != model.ConfirmPassword)
{
return DataResult.Failed("新密码与确认密码不一致!");
}
if (userInfo.Password == model.NewPassword)
{
return DataResult.Failed("新密码与用户密码一致!");
}
userInfo.Password = model.ConfirmPassword;
userInfo.MD5Password = MD5Helper.MD5Encrypt(model.ConfirmPassword);
db.Updateable(userInfo).ExecuteCommand();
return DataResult.Successed("密码修改成功!");
}
#endregion
}

@ -184,6 +184,13 @@
<param name="request"></param>
<returns></returns>
</member>
<member name="M:DS.WMS.WebApi.Controllers.CommonController.ChangePassword(DS.WMS.Core.System.Dtos.ChangePasswordInput)">
<summary>
修改密码
</summary>
<param name="model"></param>
<returns></returns>
</member>
<member name="M:DS.WMS.WebApi.Controllers.CompanyController.#ctor(DS.WMS.Core.System.Interface.ICompanyService)">
<summary>
构造函数

@ -197,4 +197,17 @@ public class CommonController : ApiController
var res = _invokeService.GetWmsStoreList(request);
return res;
}
/// <summary>
/// 修改密码
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
[Route("ChangePassword")]
public DataResult ChangePassword([FromBody] ChangePasswordInput model)
{
var res = _invokeService.ChangePassword(model);
return res;
}
}

@ -5370,3 +5370,10 @@
2023-04-24 11:34:13.7418 Info Adding target ColoredConsoleTarget(Name=console)
2023-04-24 11:34:13.8487 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\sdgslk-wms-solution\gslk-wmsapi-service-client\DS.WMS.WebApi\bin\Debug\net6.0\nlog.config
2023-04-24 11:34:13.8945 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2023-04-24 16:29:04.8327 Info Message Template Auto Format enabled
2023-04-24 16:29:04.8902 Info Loading assembly: NLog.Web.AspNetCore
2023-04-24 16:29:05.1330 Info Adding target FileTarget(Name=allfile)
2023-04-24 16:29:05.1553 Info Adding target FileTarget(Name=ownFile-web)
2023-04-24 16:29:05.1934 Info Adding target ColoredConsoleTarget(Name=console)
2023-04-24 16:29:05.3305 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\sdgslk-wms-solution\gslk-wmsapi-service-client\DS.WMS.WebApi\bin\Debug\net6.0\nlog.config
2023-04-24 16:29:05.3680 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile

Loading…
Cancel
Save