Merge branch 'dev_add_auth_1029' of http://192.168.5.200:8081/ql/apismnagaer_backend into dev_add_auth_1029
This commit is contained in:
@@ -19,6 +19,10 @@ namespace Apimanager_backend.Controllers
|
||||
{
|
||||
this.userService = userService;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取用户个人信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Authorize(Roles = "User")]
|
||||
public async Task<ActionResult<ResponseBase<UserInfoDto>>> UserInfo()
|
||||
@@ -32,5 +36,43 @@ namespace Apimanager_backend.Controllers
|
||||
);
|
||||
return Ok(res);
|
||||
}
|
||||
/// <summary>
|
||||
/// 重置用户密码
|
||||
/// </summary>
|
||||
/// <param name="dto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<ActionResult<ResponseBase<object?>>> Resetpassword([FromBody]ResetPasswordDto dto)
|
||||
{
|
||||
try
|
||||
{
|
||||
await userService.ResetPasswordAsync(dto.Email, dto.Code, dto.NewPassword);
|
||||
var res = new ResponseBase<object?>(
|
||||
code:1000,
|
||||
message:"Success",
|
||||
data: null
|
||||
);
|
||||
return Ok(res);
|
||||
}catch(BaseException e)
|
||||
{
|
||||
var res = new ResponseBase<object?>(
|
||||
code:e.code,
|
||||
message:e.message,
|
||||
data:null
|
||||
);
|
||||
return StatusCode(400,res);
|
||||
}
|
||||
}
|
||||
[HttpPost]
|
||||
public async Task<ActionResult<ResponseBase<object?>>> SendResetEmail([FromQuery]string email)
|
||||
{
|
||||
await userService.SendResetPasswordEmailAsync(email);
|
||||
var res = new ResponseBase<object?>(
|
||||
code: 1000,
|
||||
message: "Success",
|
||||
data: null
|
||||
);
|
||||
return Ok(res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user