fix: /.well-known/change-password redirect works again

This commit is contained in:
MiniDigger | Martin 2024-11-23 11:51:15 +01:00
parent 2a97934a27
commit 149e4c158a

View File

@ -3,19 +3,19 @@ package io.papermc.hangar.controller;
import io.papermc.hangar.HangarComponent; import io.papermc.hangar.HangarComponent;
import io.papermc.hangar.security.annotations.Anyone; import io.papermc.hangar.security.annotations.Anyone;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
@Anyone @Anyone
@RestController @RestController
@RequestMapping("/.well-known") @RequestMapping("/.well-known")
public class WellKnownController extends HangarComponent { public class WellKnownController extends HangarComponent {
@GetMapping(path = "/change-password", produces = MediaType.TEXT_PLAIN_VALUE) @GetMapping(path = "/change-password")
public ModelAndView changePassword() { public ResponseEntity<Object> changePassword() {
return new ModelAndView("redirect:/auth/settings/account"); return ResponseEntity.status(301).header("location", "/auth/settings/account").build();
} }
@GetMapping(path = "/security.txt", produces = MediaType.TEXT_PLAIN_VALUE) @GetMapping(path = "/security.txt", produces = MediaType.TEXT_PLAIN_VALUE)