mirror of
https://gitee.com/dromara/MaxKey.git
synced 2025-12-07 17:38:32 +08:00
个人资料、密码修改优化
This commit is contained in:
parent
da099c632a
commit
e6853c1701
@ -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 => {
|
||||
|
||||
@ -28,13 +28,13 @@ import { BaseService } from './base.service';
|
||||
})
|
||||
export class PasswordService extends BaseService<ChangePassword> {
|
||||
constructor(private _httpClient: HttpClient) {
|
||||
super(_httpClient, '/config');
|
||||
super(_httpClient, '/users');
|
||||
}
|
||||
|
||||
public changePassword(body: NzSafeAny): Observable<Message<ChangePassword>> {
|
||||
return this.http.put<Message<ChangePassword>>('/config/changePassword', body);
|
||||
return this.http.put<Message<ChangePassword>>('/users/changePassword', body);
|
||||
}
|
||||
public passwordpolicy(): Observable<Message<ChangePassword>> {
|
||||
return this.http.put<Message<ChangePassword>>('/config/passwordpolicy',null);
|
||||
return this.http.get<Message<ChangePassword>>('/users/passwordpolicy', {});
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,10 +38,10 @@ export class UsersService extends BaseService<Users> {
|
||||
}
|
||||
|
||||
getProfile(): Observable<Message<Users>> {
|
||||
return this.http.get<Message<Users>>('/config/profile/get', {});
|
||||
return this.http.get<Message<Users>>('/users/profile/get', {});
|
||||
}
|
||||
|
||||
updateProfile(body: any): Observable<Message<Users>> {
|
||||
return this.http.put<Message<Users>>('/config/profile/update', body);
|
||||
return this.http.put<Message<Users>>('/users/profile/update', body);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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/**/**")
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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<UserInfo> get(@CurrentUser UserInfo currentUser) {
|
||||
UserInfo userInfo = userInfoService.findByUsername(currentUser.getUsername());
|
||||
userInfo.trans();
|
||||
return new Message<UserInfo>(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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user