From e6853c170159043c36ca48e239cc2dbaf8734731 Mon Sep 17 00:00:00 2001 From: shimingxy Date: Thu, 15 Aug 2024 09:01:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E8=B5=84=E6=96=99=E3=80=81?= =?UTF-8?q?=E5=AF=86=E7=A0=81=E4=BF=AE=E6=94=B9=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../routes/config/profile/profile.component.ts | 8 ++++---- .../src/app/service/password.service.ts | 6 +++--- .../src/app/service/users.service.ts | 4 ++-- .../maxkey/autoconfigure/MaxKeyMvcConfig.java | 1 + .../contorller/ChangePasswodController.java | 2 +- .../web/contorller/ProfileController.java | 18 +++++++++--------- 6 files changed, 20 insertions(+), 19 deletions(-) diff --git a/maxkey-web-frontend/maxkey-web-app/src/app/routes/config/profile/profile.component.ts b/maxkey-web-frontend/maxkey-web-app/src/app/routes/config/profile/profile.component.ts index 1bf0afc48..8cbc254c7 100644 --- a/maxkey-web-frontend/maxkey-web-app/src/app/routes/config/profile/profile.component.ts +++ b/maxkey-web-frontend/maxkey-web-app/src/app/routes/config/profile/profile.component.ts @@ -70,9 +70,9 @@ export class ProfileComponent implements OnInit { submitting: boolean; model: Users; } = { - submitting: false, - model: new Users() - }; + submitting: false, + model: new Users() + }; formGroup: FormGroup = new FormGroup({}); @@ -102,7 +102,7 @@ export class ProfileComponent implements OnInit { private msg: NzMessageService, @Inject(ALAIN_I18N_TOKEN) private i18n: I18NService, private cdr: ChangeDetectorRef - ) {} + ) { } ngOnInit(): void { this.usersService.getProfile().subscribe(res => { diff --git a/maxkey-web-frontend/maxkey-web-app/src/app/service/password.service.ts b/maxkey-web-frontend/maxkey-web-app/src/app/service/password.service.ts index 8bea676cb..2ddce5eed 100644 --- a/maxkey-web-frontend/maxkey-web-app/src/app/service/password.service.ts +++ b/maxkey-web-frontend/maxkey-web-app/src/app/service/password.service.ts @@ -28,13 +28,13 @@ import { BaseService } from './base.service'; }) export class PasswordService extends BaseService { constructor(private _httpClient: HttpClient) { - super(_httpClient, '/config'); + super(_httpClient, '/users'); } public changePassword(body: NzSafeAny): Observable> { - return this.http.put>('/config/changePassword', body); + return this.http.put>('/users/changePassword', body); } public passwordpolicy(): Observable> { - return this.http.put>('/config/passwordpolicy',null); + return this.http.get>('/users/passwordpolicy', {}); } } diff --git a/maxkey-web-frontend/maxkey-web-app/src/app/service/users.service.ts b/maxkey-web-frontend/maxkey-web-app/src/app/service/users.service.ts index 445870264..98c30c6dc 100644 --- a/maxkey-web-frontend/maxkey-web-app/src/app/service/users.service.ts +++ b/maxkey-web-frontend/maxkey-web-app/src/app/service/users.service.ts @@ -38,10 +38,10 @@ export class UsersService extends BaseService { } getProfile(): Observable> { - return this.http.get>('/config/profile/get', {}); + return this.http.get>('/users/profile/get', {}); } updateProfile(body: any): Observable> { - return this.http.put>('/config/profile/update', body); + return this.http.put>('/users/profile/update', body); } } diff --git a/maxkey-webs/maxkey-web-maxkey/src/main/java/org/dromara/maxkey/autoconfigure/MaxKeyMvcConfig.java b/maxkey-webs/maxkey-web-maxkey/src/main/java/org/dromara/maxkey/autoconfigure/MaxKeyMvcConfig.java index f97282d03..d1bc82e09 100644 --- a/maxkey-webs/maxkey-web-maxkey/src/main/java/org/dromara/maxkey/autoconfigure/MaxKeyMvcConfig.java +++ b/maxkey-webs/maxkey-web-maxkey/src/main/java/org/dromara/maxkey/autoconfigure/MaxKeyMvcConfig.java @@ -98,6 +98,7 @@ public class MaxKeyMvcConfig implements WebMvcConfigurer { //for frontend registry.addInterceptor(permissionInterceptor) .addPathPatterns("/config/**") + .addPathPatterns("/users/**") .addPathPatterns("/historys/**") .addPathPatterns("/access/session/**") .addPathPatterns("/access/session/**/**") diff --git a/maxkey-webs/maxkey-web-maxkey/src/main/java/org/dromara/maxkey/web/contorller/ChangePasswodController.java b/maxkey-webs/maxkey-web-maxkey/src/main/java/org/dromara/maxkey/web/contorller/ChangePasswodController.java index 8b8fbbed3..72bda640d 100644 --- a/maxkey-webs/maxkey-web-maxkey/src/main/java/org/dromara/maxkey/web/contorller/ChangePasswodController.java +++ b/maxkey-webs/maxkey-web-maxkey/src/main/java/org/dromara/maxkey/web/contorller/ChangePasswodController.java @@ -37,7 +37,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @RestController -@RequestMapping(value={"/config"}) +@RequestMapping(value={"/users"}) public class ChangePasswodController { static final Logger logger = LoggerFactory.getLogger(ChangePasswodController.class); diff --git a/maxkey-webs/maxkey-web-maxkey/src/main/java/org/dromara/maxkey/web/contorller/ProfileController.java b/maxkey-webs/maxkey-web-maxkey/src/main/java/org/dromara/maxkey/web/contorller/ProfileController.java index 855302163..d163c7c68 100644 --- a/maxkey-webs/maxkey-web-maxkey/src/main/java/org/dromara/maxkey/web/contorller/ProfileController.java +++ b/maxkey-webs/maxkey-web-maxkey/src/main/java/org/dromara/maxkey/web/contorller/ProfileController.java @@ -27,15 +27,16 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Controller; import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; -@Controller -@RequestMapping(value = { "/config/profile" }) +@RestController +@RequestMapping(value = { "/users/profile" }) public class ProfileController { static final Logger logger = LoggerFactory.getLogger(ProfileController.class); @@ -45,11 +46,11 @@ public class ProfileController { @Autowired FileUploadService fileUploadService; - @RequestMapping(value = { "/get" }, produces = {MediaType.APPLICATION_JSON_VALUE}) - public Message get(@CurrentUser UserInfo currentUser) { + @GetMapping(value = { "/get" }, produces = {MediaType.APPLICATION_JSON_VALUE}) + public Message get(@CurrentUser UserInfo currentUser) { UserInfo userInfo = userInfoService.findByUsername(currentUser.getUsername()); userInfo.trans(); - return new Message(userInfo); + return new Message<>(userInfo); } /** @@ -59,8 +60,7 @@ public class ProfileController { * @param result * @return */ - @ResponseBody - @RequestMapping(value={"/update"}, produces = {MediaType.APPLICATION_JSON_VALUE}) + @PutMapping(value={"/update"}, produces = {MediaType.APPLICATION_JSON_VALUE}) public Message update( @RequestBody UserInfo userInfo, @CurrentUser UserInfo currentUser,