This commit is contained in:
mepiphana2023
2024-04-25 15:40:41 +02:00
parent 8ebddc6d18
commit 8b252e7038
12 changed files with 202 additions and 144 deletions

View File

@@ -8,6 +8,7 @@ import fr.eni.enchere.bo.Article;
import fr.eni.enchere.bo.Categorie;
import fr.eni.enchere.bo.Retrait;
import fr.eni.enchere.bo.UserProfil;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
@@ -70,10 +71,11 @@ public class ArticleController {
//Création d'un article
@GetMapping("/new")
public String newArticleForm(Model model) {
public String newArticleForm(HttpServletRequest request, Model model) {
model.addAttribute("categories", categorieService.findAllCategories());
model.addAttribute("article", new Article());
model.addAttribute("retrait", new Retrait());
model.addAttribute("requestURI", request.getRequestURI());
//Récupérer l'utilisateur pour set le retrait à son adresse par defaut
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
String username = authentication.getName();