重置密码功能
This commit is contained in:
@@ -115,5 +115,11 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
||||
{
|
||||
return Result.Success().SetStatus(await _iUserService.AddInfo(userDto));
|
||||
}
|
||||
|
||||
[HttpPut]
|
||||
public async Task<Result> RestPassword(UserEntity user)
|
||||
{
|
||||
return Result.Success().SetStatus(await _iUserService.RestPassword(user.Id, user.Password));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -98,5 +98,13 @@ namespace Yi.Framework.Interface
|
||||
/// <param name="userDto"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> AddInfo(UserInfoDto userDto);
|
||||
|
||||
/// <summary>
|
||||
/// 重置密码
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="password"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> RestPassword(long userId,string password );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,5 +235,17 @@ namespace Yi.Framework.Service
|
||||
var res2 = await GiveUserSetRole(new List<long> { res1 }, userDto.RoleIds);
|
||||
return !0.Equals(res1) && res2;
|
||||
}
|
||||
|
||||
public async Task<bool> RestPassword(long userId, string password)
|
||||
{
|
||||
var user = new UserEntity();
|
||||
user.Id = userId;
|
||||
user.Password = password;
|
||||
user.BuildPassword();
|
||||
|
||||
return await _repository.UpdateIgnoreNullAsync(user);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,13 +50,15 @@ export function delUser(userId) {
|
||||
}
|
||||
|
||||
// 用户密码重置
|
||||
export function resetUserPwd(userId, password) {
|
||||
export function resetUserPwd(id, password) {
|
||||
const data = {
|
||||
userId,
|
||||
id,
|
||||
password
|
||||
}
|
||||
|
||||
|
||||
return request({
|
||||
url: '/system/user/resetPwd',
|
||||
url: '/user/restPassword',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user