parent
9723f85c46
commit
ddd640c7c1
|
@ -136,6 +136,10 @@ public class UserController {
|
||||||
|
|
||||||
@PostMapping("/update/current")
|
@PostMapping("/update/current")
|
||||||
public UserDTO updateCurrentUser(@RequestBody User user) {
|
public UserDTO updateCurrentUser(@RequestBody User user) {
|
||||||
|
String currentUserId = SessionUtils.getUserId();
|
||||||
|
if (!StringUtils.equals(currentUserId, user.getId())) {
|
||||||
|
MSException.throwException(Translator.get("not_authorized"));
|
||||||
|
}
|
||||||
userService.updateUser(user);
|
userService.updateUser(user);
|
||||||
UserDTO userDTO = userService.getUserDTO(user.getId());
|
UserDTO userDTO = userService.getUserDTO(user.getId());
|
||||||
SessionUtils.putUser(SessionUser.fromUser(userDTO));
|
SessionUtils.putUser(SessionUser.fromUser(userDTO));
|
||||||
|
|
Loading…
Reference in New Issue