Skip to content

Commit fcce292

Browse files
Use UrlBuilder instead of hardcoded url value
1 parent 2641d39 commit fcce292

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/java/com/accolite/pru/health/AuthApp/controller/WebController.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@
44
import org.springframework.ui.ModelMap;
55
import org.springframework.web.bind.annotation.GetMapping;
66
import org.springframework.web.bind.annotation.RequestParam;
7+
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
8+
import org.springframework.web.util.UriComponentsBuilder;
79

810
@Controller
911
public class WebController {
1012

1113
@GetMapping("/password/reset")
1214
public String resetPassword(@RequestParam(value = "token") String token, ModelMap model) {
13-
String url = "/api/auth/password/reset?token=" + token;
15+
UriComponentsBuilder urlBuilder = ServletUriComponentsBuilder.fromCurrentContextPath()
16+
.path("/api/auth/password/reset");
17+
String url = urlBuilder.queryParam("token", token).toUriString();
1418
model.addAttribute("url", url);
1519
return "reset-password";
1620
}

0 commit comments

Comments
 (0)