diff options
author | crupest <crupest@outlook.com> | 2022-03-23 21:30:14 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-03-23 21:30:31 +0800 |
commit | da9139b7bab95f6e5ba5f4bb2d99011c2d6db03a (patch) | |
tree | 051fd4ca4bc511db7e04b019a33fddaab2d0cc6b /BackEnd/Timeline/Controllers/UserController.cs | |
parent | 3d6c9fd916e18c99b3a5497b8313672680571b5e (diff) | |
download | timeline-da9139b7bab95f6e5ba5f4bb2d99011c2d6db03a.tar.gz timeline-da9139b7bab95f6e5ba5f4bb2d99011c2d6db03a.tar.bz2 timeline-da9139b7bab95f6e5ba5f4bb2d99011c2d6db03a.zip |
…
Diffstat (limited to 'BackEnd/Timeline/Controllers/UserController.cs')
-rw-r--r-- | BackEnd/Timeline/Controllers/UserController.cs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/BackEnd/Timeline/Controllers/UserController.cs b/BackEnd/Timeline/Controllers/UserController.cs index 740bd0ed..95a99a03 100644 --- a/BackEnd/Timeline/Controllers/UserController.cs +++ b/BackEnd/Timeline/Controllers/UserController.cs @@ -7,6 +7,7 @@ using Timeline.Auth; using Timeline.Filters;
using Timeline.Models.Http;
using Timeline.Models.Validation;
+using Timeline.Services; using Timeline.Services.Mapper;
using Timeline.Services.User;
@@ -103,7 +104,7 @@ namespace Timeline.Controllers }
else
{
- if (GetUsername() != username)
+ if (!await CheckIsSelf(username))
return ForbidWithCommonResponse(Resource.MessageForbidNotAdministratorOrOwner);
if (body.Username is not null)
@@ -112,7 +113,7 @@ namespace Timeline.Controllers if (body.Password is not null)
return ForbidWithCommonResponse(Resource.MessageForbidNotAdministrator);
- var user = await _userService.ModifyUserAsync(GetUserId(), _mapper.AutoMapperMap<ModifyUserParams>(body));
+ var user = await _userService.ModifyUserAsync(GetAuthUserId(), _mapper.AutoMapperMap<ModifyUserParams>(body));
return await _mapper.MapAsync<HttpUser>(user, Url, User);
}
}
@@ -152,7 +153,7 @@ namespace Timeline.Controllers {
try
{
- await _userService.ChangePassword(GetUserId(), request.OldPassword, request.NewPassword);
+ await _userService.ChangePassword(GetAuthUserId(), request.OldPassword, request.NewPassword);
return OkWithCommonResponse();
}
catch (BadPasswordException)
|