mirror of https://github.com/halo-dev/halo
Add globalInfo into logout page (#6831)
#### What type of PR is this? /kind improvement /area core /milestone 2.20.x #### What this PR does / why we need it: This PR adds globalInfo data into logout template model. #### Which issue(s) this PR fixes: Fixes https://github.com/halo-dev/halo/issues/6821 #### Does this PR introduce a user-facing change? ```release-note None ```pull/6836/head
parent
cecbfcfa4a
commit
9468e8741f
|
@ -24,6 +24,7 @@ import org.springframework.web.reactive.function.server.RouterFunctions;
|
|||
import org.springframework.web.reactive.function.server.ServerResponse;
|
||||
import reactor.core.publisher.Mono;
|
||||
import run.halo.app.core.user.service.UserService;
|
||||
import run.halo.app.infra.actuator.GlobalInfoService;
|
||||
import run.halo.app.security.authentication.SecurityConfigurer;
|
||||
import run.halo.app.security.authentication.rememberme.RememberMeServices;
|
||||
import run.halo.app.theme.router.ModelConst;
|
||||
|
@ -59,7 +60,10 @@ public class LogoutSecurityConfigurer implements SecurityConfigurer {
|
|||
}
|
||||
|
||||
@Bean
|
||||
RouterFunction<ServerResponse> logoutPage(UserService userService) {
|
||||
RouterFunction<ServerResponse> logoutPage(
|
||||
UserService userService,
|
||||
GlobalInfoService globalInfoService
|
||||
) {
|
||||
return RouterFunctions.route()
|
||||
.GET("/logout", request -> {
|
||||
var user = ReactiveSecurityContextHolder.getContext()
|
||||
|
@ -69,6 +73,7 @@ public class LogoutSecurityConfigurer implements SecurityConfigurer {
|
|||
var exchange = request.exchange();
|
||||
var contextPath = exchange.getRequest().getPath().contextPath().value();
|
||||
return ServerResponse.ok().render("logout", Map.of(
|
||||
"globalInfo", globalInfoService.getGlobalInfo(),
|
||||
"action", contextPath + "/logout",
|
||||
"user", user
|
||||
));
|
||||
|
|
Loading…
Reference in New Issue