Skip to content
Snippets Groups Projects

Resolve "Header icons on unauthenticated pages" (1)

Files

@@ -17,7 +17,11 @@
*/
package nl.tudelft.submit.controller;
import nl.tudelft.labracore.api.dto.Person;
import nl.tudelft.labracore.lib.security.user.AuthenticatedPerson;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -28,30 +32,39 @@ public class HomeController {
/**
* Returns the home page.
*
* @return the link to the homepage template
* @param person The authenticated person, or null if the user is not authenticated
* @param model The model to add details to
* @return the link to the homepage template
*/
@GetMapping
public String homePage() {
public String homePage(@AuthenticatedPerson(required = false) Person person, Model model) {
model.addAttribute("authPerson", person);
return "index";
}
/**
* Returns the error page.
*
* @return the link to the error page
* @param person The authenticated person, or null if the user is not authenticated
* @param model The model to add details to
* @return the link to the error page
*/
@GetMapping("/error")
public String errorPage() {
public String errorPage(@AuthenticatedPerson(required = false) Person person, Model model) {
model.addAttribute("authPerson", person);
return "error";
}
/**
* Returns the privacy statement page.
*
* @return The privacy page template
* @param person The authenticated person, or null if the user is not authenticated
* @param model The model to add details to
* @return The privacy page template
*/
@GetMapping("/privacy")
public String getPrivacyStatement() {
public String getPrivacyStatement(@AuthenticatedPerson(required = false) Person person, Model model) {
model.addAttribute("authPerson", person);
return "privacy_statement";
}
Loading