mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-02-25 23:50:51 +08:00
feat: 设置页面修改用户名,需要重新发放token
This commit is contained in:
@@ -28,6 +28,7 @@ public class UserController {
|
||||
private final PostReadService postReadService;
|
||||
private final UserVisitService userVisitService;
|
||||
private final LevelService levelService;
|
||||
private final JwtService jwtService;
|
||||
|
||||
@Value("${app.upload.check-type:true}")
|
||||
private boolean checkImageType;
|
||||
@@ -73,10 +74,13 @@ public class UserController {
|
||||
}
|
||||
|
||||
@PutMapping("/me")
|
||||
public ResponseEntity<UserDto> updateProfile(@RequestBody UpdateProfileDto dto,
|
||||
public ResponseEntity<?> updateProfile(@RequestBody UpdateProfileDto dto,
|
||||
Authentication auth) {
|
||||
User user = userService.updateProfile(auth.getName(), dto.getUsername(), dto.getIntroduction());
|
||||
return ResponseEntity.ok(toDto(user, auth));
|
||||
return ResponseEntity.ok(Map.of(
|
||||
"token", jwtService.generateToken(user.getUsername()),
|
||||
"user", toDto(user, auth)
|
||||
));
|
||||
}
|
||||
|
||||
@PostMapping("/me/signin")
|
||||
|
||||
Reference in New Issue
Block a user