trying to fix

This commit is contained in:
kaipher7
2026-03-11 19:38:28 -06:00
7 changed files with 114 additions and 59 deletions
@@ -18,12 +18,12 @@ public class SecurityConfig {
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
http http
.authorizeHttpRequests(auth -> auth .authorizeHttpRequests(auth -> auth
.requestMatchers("/login", "/css/**").permitAll() .requestMatchers("/login", "/register", "/css/**", "/images/**").permitAll()
.anyRequest().authenticated() .anyRequest().authenticated()
) )
.formLogin(form -> form .formLogin(form -> form
.loginPage("/login") .loginPage("/login")
// .defaultSuccessUrl("/", true) .defaultSuccessUrl("/", true)
.permitAll() .permitAll()
) )
.logout(logout -> logout.permitAll()); .logout(logout -> logout.permitAll());
@@ -1,15 +1,28 @@
package com.example.demo.controller; package com.example.demo.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import com.example.demo.service.RecipeService;
import com.example.demo.dto.RecipeDto;
import com.example.demo.entity.Recipe;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@Controller @Controller
public class SiteController { public class SiteController {
private final RecipeService recipeService;
public SiteController(RecipeService recipeService) {
this.recipeService = recipeService;
}
@GetMapping("/") @GetMapping("/")
public String viewHomePage(Model model) { public String viewHomePage(Model model) {
//model.addAttribute("allemplist", employeeServiceImpl.getAllEmployee()); //model.addAttribute("allemplist", employeeServiceImpl.getAllEmployee());
List<RecipeDto> recipes = recipeService.getAllRecipes();
model.addAttribute("recipes", recipes);
return "home"; return "home";
} }
@@ -17,4 +30,9 @@ public class SiteController {
public String viewLoginPage(Model model) { public String viewLoginPage(Model model) {
return "login"; return "login";
} }
@GetMapping("/register")
public String viewRegisterPage(Model model) {
return "create-account";
}
} }
@@ -76,6 +76,7 @@ public class RecipeServiceImpl implements RecipeService {
} }
@Override @Override
@Transactional
public RecipeDto saveRecipe(RecipeDto dto) { public RecipeDto saveRecipe(RecipeDto dto) {
User user = userRepository.findById(dto.getUserDto().getId()) User user = userRepository.findById(dto.getUserDto().getId())
@@ -74,7 +74,7 @@ body, html {
} }
.login-box rows { .login-box .rows {
display: flex; display: flex;
gap: 10px; gap: 10px;
align-items: center; align-items: center;
@@ -1,50 +1,58 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<<<<<<< HEAD
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Create Thyme Crunch Account</title> <title>Create Thyme Crunch Account</title>
<link rel="stylesheet" th:href="@{static/css/create-account.css}"> <link rel="stylesheet" th:href="@{static/css/create-account.css}">
=======
<meta charset="UTF-8">
<title>Create Thyme Crunch Account</title>
<link rel="stylesheet" th:href="@{css/create-account.css}">
>>>>>>> 738c6970dde9507734a43ead0f3e9aadd5b41e23
</head> </head>
<body> <body>
<header class="top-header"> <header class="top-header">
<<<<<<< HEAD
<img src="static/images/header_left.png" alt="Violin f-hole shape to the left of header." class="swirl"> <img src="static/images/header_left.png" alt="Violin f-hole shape to the left of header." class="swirl">
<h1 class="site-name">Thyme Crunch</h1> <h1 class="site-name">Thyme Crunch</h1>
<img src="static/images/header_right.png" alt="Violin f-hole shape to the right of header." class="swirl"> <img src="static/images/header_right.png" alt="Violin f-hole shape to the right of header." class="swirl">
=======
<img th:src="@{images/header_left.png}" alt="Violin f-hole shape to the left of header." class="swirl">
<h1 class="site-name">Thyme Crunch</h1>
<img th:src="@{images/header_right.png}" alt="Violin f-hole shape to the right of header." class="swirl">
</header>
>>>>>>> 738c6970dde9507734a43ead0f3e9aadd5b41e23
</header> <!-- Main Content -->
<main class="main-content">
<!-- Main Content -->
<main class="main-content">
<div class="login-box"> <div class="login-box">
<h2>Create Account</h2> <h2>Create Account</h2>
<form id="createUserForm"> <form id="createUserForm">
<div class="rows">
<div class="rows">
<label for="username">Username</label> <label for="username">Username</label>
<input type="text" id="username" required> <input type="text" id="username" required>
</div> </div>
<div class="rows"> <div class="rows">
<label for="email">Email</label> <label for="email">Email</label>
<input type="email" id="email" required> <input type="email" id="email" required>
</div> </div>
<div class="rows"> <div class="rows">
<label for="password">Password</label> <label for="password">Password</label>
<input type="password" id="password" required> <input type="password" id="password" required>
</div> </div>
<div class="rows"> <div class="rows">
<label for="confirmPassword">Confirm Password</label> <label for="confirmPassword">Confirm Password</label>
<input type="password" id="confirmPassword" required> <input type="password" id="confirmPassword" required>
</div> </div>
<p id="passwordError"></p> <p id="passwordError"></p>
<button type="submit">Create</button> <button type="submit">Create</button>
</form> </form>
</div> </div>
</main> </main>
</div>
</body> </body>
</html> </html>
+38 -9
View File
@@ -1,21 +1,35 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<<<<<<< HEAD
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Thyme Crunch Home</title> <title>Thyme Crunch Home</title>
<link rel="stylesheet" th:href="@{/css/home.css}"> <link rel="stylesheet" th:href="@{/css/home.css}">
=======
<meta charset="UTF-8">
<title>Thyme Crunch Home</title>
<link rel="stylesheet" th:href="@{css/home.css}">
>>>>>>> 738c6970dde9507734a43ead0f3e9aadd5b41e23
</head> </head>
<body> <body>
<header class="top-header"> <header class="top-header">
<<<<<<< HEAD
<img src="static/images/header_left.png" alt="Violin f-hole shape to the left of header." class="swirl"> <img src="static/images/header_left.png" alt="Violin f-hole shape to the left of header." class="swirl">
<h1 class="site-name">Thyme Crunch</h1> <h1 class="site-name">Thyme Crunch</h1>
<img src="static/images/header_right.png" alt="Violin f-hole shape to the right of header." class="swirl"> <img src="static/images/header_right.png" alt="Violin f-hole shape to the right of header." class="swirl">
</header> </header>
=======
<img th:src="@{images/header_left.png}" alt="Violin f-hole shape to the left of header." class="swirl">
<h1 class="site-name">Thyme Crunch</h1>
<img th:src="@{images/header_right.png}" alt="Violin f-hole shape to the right of header." class="swirl">
</header>
>>>>>>> 738c6970dde9507734a43ead0f3e9aadd5b41e23
<div class="container"> <div class="container">
<!--Navigation Bar --> <!--Navigation Bar -->
<nav class="sidebar-left"> <nav class="sidebar-left">
<<<<<<< HEAD
<ul> <ul>
<li><a href="#">Home</a></li> <li><a href="#">Home</a></li>
<li><a href="#">Explore</a></li> <li><a href="#">Explore</a></li>
@@ -37,6 +51,25 @@
<img src="static/images/create_icon.png" alt="Description of the icon"> <img src="static/images/create_icon.png" alt="Description of the icon">
</a> </a>
=======
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Explore</a></li>
<li><a href="#">Profile</a></li>
<li><a href="#">Saved</a></li>
<li>
<form th:action="@{/logout}" method="post">
<input type="image" th:src="@{images/logout_icon.png}" alt="Logout button" class="nav_icon"/>
</form>
</li>
</ul>
</nav>
<a href="#" target="_blank" class="create_icon">
<img src="images/create_icon.png" alt="Description of the icon">
</a>
>>>>>>> 738c6970dde9507734a43ead0f3e9aadd5b41e23
<!-- Main Content --> <!-- Main Content -->
<main class="main-content"> <main class="main-content">
@@ -48,22 +81,18 @@
<p th:text="${recipe.description}"></p> <p th:text="${recipe.description}"></p>
</div> </div>
<div class="card-right"> <div class="card-right">
<img th:src="@{${recipe.imageUrl}}" alt="${recipe.imageAltText}"> <div th:each="img : ${recipe.images}">
<p th:text="${recipe.cost}"></p> <img th:src="${img.imageUrl}" alt="Recipe Image"/>
</div>
</div> </div>
</div> </div>
</div> </div>
</main> </main>
<div class="container">
<!--New Bar --> <!--New Bar -->
<nav class="sidebar-right"> <nav class="sidebar-right">
<h1> NEW </h1> <h1> NEW </h1>
</nav> </nav>
</div>
</div>
</body> </body>
</html> </html>
+5 -6
View File
@@ -7,10 +7,10 @@
</head> </head>
<body> <body>
<header class="top-header"> <header class="top-header">
<img src="images/header_left.png" alt="Violin f-hole shape to the left of header." class="swirl"> <img th:src="@{images/header_left.png}" alt="Violin f-hole shape to the left of header." class="swirl">
<h1 class="site-name">Thyme Crunch</h1> <h1 class="site-name">Thyme Crunch</h1>
<img src="images/header_right.png" alt="Violin f-hole shape to the right of header." class="swirl"> <img th:src="@{images/header_right.png}" alt="Violin f-hole shape to the right of header." class="swirl">
</header> </header>
@@ -33,9 +33,8 @@
</form> </form>
</div> </div>
<div class="sign_up"> <div class="sign_up">
<h3> OR <a href="create-account.html"><b>SIGN UP</b></a> FOR AN ACCOUNT </h3> <h3> OR <a th:href="@{/register}"><b>SIGN UP</b></a> FOR AN ACCOUNT </h3>
</div> </div>
</main> </main>
</div> </body>
</body>
</html> </html>