|
@@ -6,15 +6,18 @@ import cn.kdan.compdf.dto.LoginDTO;
|
|
|
import cn.kdan.compdf.enums.AuthEnum;
|
|
|
import cn.kdan.compdf.service.BackgroundUserService;
|
|
|
import cn.kdan.compdf.vo.LoginVO;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.util.Date;
|
|
|
import java.util.Enumeration;
|
|
|
|
|
|
/**
|
|
|
* @author comPDF-Kit WPH 2022-10-09
|
|
|
*/
|
|
|
+@Slf4j
|
|
|
@RestController
|
|
|
@RequestMapping("/v1/user")
|
|
|
public class BackgroundUserController {
|
|
@@ -36,14 +39,15 @@ public class BackgroundUserController {
|
|
|
@PostMapping("/logout")
|
|
|
public R<Void> logout(HttpServletRequest request) {
|
|
|
String token = request.getHeader(AuthEnum.AUTHORIZATION);
|
|
|
- backgroundUserService.logout(token);
|
|
|
+ log.info("登出token:{},time:{}", token, new Date());
|
|
|
+ backgroundUserService.logout(token.replaceFirst("Bearer ",""));
|
|
|
return R.ok();
|
|
|
}
|
|
|
|
|
|
@PutMapping("/changePassword")
|
|
|
public R<Void> changePassword(@Validated @RequestBody ChangePasswordDTO changePasswordDTO, HttpServletRequest request) {
|
|
|
String token = request.getHeader(AuthEnum.AUTHORIZATION);
|
|
|
- backgroundUserService.changePassword(changePasswordDTO, token);
|
|
|
+ backgroundUserService.changePassword(changePasswordDTO, token.replaceFirst("Bearer ",""));
|
|
|
return R.ok();
|
|
|
}
|
|
|
|