重置密码功能
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);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user