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
John Niang 2024-10-12 12:21:09 +08:00 committed by GitHub
parent cecbfcfa4a
commit 9468e8741f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 1 deletions

View File

@ -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
));