mirror of https://github.com/halo-dev/halo
Create getEnvironments api.
parent
ff7ecc9d09
commit
41793365e2
|
@ -10,6 +10,10 @@ import run.halo.app.security.token.AuthToken;
|
|||
import run.halo.app.service.AdminService;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.lang.management.RuntimeMXBean;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Admin controller.
|
||||
|
@ -39,6 +43,15 @@ public class AdminController {
|
|||
return adminService.getCount();
|
||||
}
|
||||
|
||||
@GetMapping("environments")
|
||||
@ApiOperation("Gets environments info")
|
||||
public Map<String, Object> getEnvironments() {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
RuntimeMXBean runtimeMXBean = ManagementFactory.getRuntimeMXBean();
|
||||
result.put("startTime", runtimeMXBean.getStartTime());
|
||||
return result;
|
||||
}
|
||||
|
||||
@PostMapping("login")
|
||||
@ApiOperation("Login")
|
||||
@CacheLock(autoDelete = false)
|
||||
|
|
|
@ -85,7 +85,7 @@ public class AdminServiceImpl implements AdminService {
|
|||
|
||||
if (!userService.passwordMatch(user, loginParam.getPassword())) {
|
||||
// If the password is mismatch
|
||||
throw new BadRequestException("Username or password is incorrect");
|
||||
throw new BadRequestException("用户名或者密码不正确");
|
||||
}
|
||||
|
||||
if (SecurityContextHolder.getContext().isAuthenticated()) {
|
||||
|
|
Loading…
Reference in New Issue