Skip to content
Snippets Groups Projects

Resolve "Header icons on unauthenticated pages" (1)

5 files
+ 99
8
Compare changes
  • Side-by-side
  • Inline

Files

@@ -17,7 +17,11 @@
@@ -17,7 +17,11 @@
*/
*/
package nl.tudelft.submit.controller;
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.stereotype.Controller;
 
import org.springframework.ui.Model;
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;
@@ -28,30 +32,39 @@ public class HomeController {
@@ -28,30 +32,39 @@ public class HomeController {
/**
/**
* Returns the home page.
* 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
@GetMapping
public String homePage() {
public String homePage(@AuthenticatedPerson(required = false) Person person, Model model) {
 
model.addAttribute("authPerson", person);
return "index";
return "index";
}
}
/**
/**
* Returns the error page.
* 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")
@GetMapping("/error")
public String errorPage() {
public String errorPage(@AuthenticatedPerson(required = false) Person person, Model model) {
 
model.addAttribute("authPerson", person);
return "error";
return "error";
}
}
/**
/**
* Returns the privacy statement page.
* 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")
@GetMapping("/privacy")
public String getPrivacyStatement() {
public String getPrivacyStatement(@AuthenticatedPerson(required = false) Person person, Model model) {
 
model.addAttribute("authPerson", person);
return "privacy_statement";
return "privacy_statement";
}
}
Loading