mirror of
https://gitlab.com/etc404/software-engineering-project.git
synced 2026-05-10 20:52:58 +00:00
trying to fix
This commit is contained in:
@@ -18,12 +18,12 @@ public class SecurityConfig {
|
||||
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
|
||||
http
|
||||
.authorizeHttpRequests(auth -> auth
|
||||
.requestMatchers("/login", "/css/**").permitAll()
|
||||
.requestMatchers("/login", "/register", "/css/**", "/images/**").permitAll()
|
||||
.anyRequest().authenticated()
|
||||
)
|
||||
.formLogin(form -> form
|
||||
.loginPage("/login")
|
||||
// .defaultSuccessUrl("/", true)
|
||||
.defaultSuccessUrl("/", true)
|
||||
.permitAll()
|
||||
)
|
||||
.logout(logout -> logout.permitAll());
|
||||
|
||||
@@ -1,15 +1,28 @@
|
||||
package com.example.demo.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
@Controller
|
||||
public class SiteController {
|
||||
|
||||
private final RecipeService recipeService;
|
||||
|
||||
public SiteController(RecipeService recipeService) {
|
||||
this.recipeService = recipeService;
|
||||
}
|
||||
@GetMapping("/")
|
||||
public String viewHomePage(Model model) {
|
||||
//model.addAttribute("allemplist", employeeServiceImpl.getAllEmployee());
|
||||
List<RecipeDto> recipes = recipeService.getAllRecipes();
|
||||
model.addAttribute("recipes", recipes);
|
||||
return "home";
|
||||
}
|
||||
|
||||
@@ -17,4 +30,9 @@ public class SiteController {
|
||||
public String viewLoginPage(Model model) {
|
||||
return "login";
|
||||
}
|
||||
|
||||
@GetMapping("/register")
|
||||
public String viewRegisterPage(Model model) {
|
||||
return "create-account";
|
||||
}
|
||||
}
|
||||
@@ -76,6 +76,7 @@ public class RecipeServiceImpl implements RecipeService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public RecipeDto saveRecipe(RecipeDto dto) {
|
||||
|
||||
User user = userRepository.findById(dto.getUserDto().getId())
|
||||
|
||||
@@ -74,7 +74,7 @@ body, html {
|
||||
|
||||
}
|
||||
|
||||
.login-box rows {
|
||||
.login-box .rows {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
|
||||
@@ -1,18 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<<<<<<< HEAD
|
||||
<meta charset="UTF-8">
|
||||
<title>Create Thyme Crunch Account</title>
|
||||
<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>
|
||||
<body>
|
||||
|
||||
<header class="top-header">
|
||||
<<<<<<< HEAD
|
||||
<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>
|
||||
<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
|
||||
|
||||
<!-- Main Content -->
|
||||
<main class="main-content">
|
||||
@@ -20,7 +31,6 @@
|
||||
<h2>Create Account</h2>
|
||||
|
||||
<form id="createUserForm">
|
||||
|
||||
<div class="rows">
|
||||
<label for="username">Username</label>
|
||||
<input type="text" id="username" required>
|
||||
@@ -40,11 +50,9 @@
|
||||
<p id="passwordError"></p>
|
||||
|
||||
<button type="submit">Create</button>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -1,21 +1,35 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<<<<<<< HEAD
|
||||
<meta charset="UTF-8">
|
||||
<title>Thyme Crunch Home</title>
|
||||
<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>
|
||||
<body>
|
||||
|
||||
<header class="top-header">
|
||||
<<<<<<< HEAD
|
||||
<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>
|
||||
<img src="static/images/header_right.png" alt="Violin f-hole shape to the right of header." class="swirl">
|
||||
</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">
|
||||
<!--Navigation Bar -->
|
||||
<nav class="sidebar-left">
|
||||
<<<<<<< HEAD
|
||||
<ul>
|
||||
<li><a href="#">Home</a></li>
|
||||
<li><a href="#">Explore</a></li>
|
||||
@@ -37,6 +51,25 @@
|
||||
<img src="static/images/create_icon.png" alt="Description of the icon">
|
||||
</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 class="main-content">
|
||||
@@ -48,22 +81,18 @@
|
||||
<p th:text="${recipe.description}"></p>
|
||||
</div>
|
||||
<div class="card-right">
|
||||
<img th:src="@{${recipe.imageUrl}}" alt="${recipe.imageAltText}">
|
||||
<p th:text="${recipe.cost}"></p>
|
||||
<div th:each="img : ${recipe.images}">
|
||||
<img th:src="${img.imageUrl}" alt="Recipe Image"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</main>
|
||||
|
||||
<div class="container">
|
||||
<!--New Bar -->
|
||||
<nav class="sidebar-right">
|
||||
<h1> NEW </h1>
|
||||
</nav>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
<body>
|
||||
|
||||
<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>
|
||||
<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>
|
||||
|
||||
@@ -33,9 +33,8 @@
|
||||
</form>
|
||||
</div>
|
||||
<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>
|
||||
</main>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user