fix flow for loggedout checkout
This commit is contained in:
		@ -29,9 +29,16 @@ public class RequestController {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping("/login")
 | 
			
		||||
    public String loginPost(HttpServletResponse response) {
 | 
			
		||||
    public String loginPost(HttpServletResponse response, @RequestParam(value = "goto", required = false) String gto) {
 | 
			
		||||
        response.addCookie(new Cookie("login", "true"));
 | 
			
		||||
      return "redirect:/";
 | 
			
		||||
 | 
			
		||||
        System.out.println(gto);
 | 
			
		||||
 | 
			
		||||
        if (gto != null && gto.startsWith("/")) {
 | 
			
		||||
            return "redirect:" + gto;
 | 
			
		||||
        } else {
 | 
			
		||||
            return "redirect:/";
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping("/logout")
 | 
			
		||||
@ -75,8 +82,12 @@ public class RequestController {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping("/shop/articles/{id}")
 | 
			
		||||
     public String shopArticlesByIdBuy() {
 | 
			
		||||
         return "redirect:/shop/checkout";
 | 
			
		||||
     public String shopArticlesByIdBuy(@RequestAttribute("customer") Boolean isCustomer, @PathVariable("id") Integer id) {
 | 
			
		||||
        if (isCustomer) {
 | 
			
		||||
            return "redirect:/shop/checkout";
 | 
			
		||||
        } else {
 | 
			
		||||
            return "redirect:/login?goto=%2Fshop%2Farticles%2F"+id;
 | 
			
		||||
        }
 | 
			
		||||
     }
 | 
			
		||||
 | 
			
		||||
    @GetMapping("/user/")
 | 
			
		||||
 | 
			
		||||
@ -10,7 +10,7 @@
 | 
			
		||||
<body>
 | 
			
		||||
   <!-- <nav th:replace="/fragments/header :: header">Header</nav> -->
 | 
			
		||||
    <main class="content-width modal">
 | 
			
		||||
      <form class="detailgrid s hero " method="post" th:action="@{/login}">
 | 
			
		||||
      <form class="detailgrid s hero " method="post">
 | 
			
		||||
         <div class="s">
 | 
			
		||||
            <label for="username">Email Adresse</label>
 | 
			
		||||
            <input class="full-width" type="text" name="username" placeholder="Email Adresse" id="username" required>
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user