From c854debbe746074d6ec00dcf2abb072fa26cb46e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=A0=95=EB=AF=BC?= Date: Wed, 31 Jul 2024 15:11:49 +0900 Subject: [PATCH] feat: cors --- .../com/edufocus/edufocus/user/config/WebConfiguration.java | 3 ++- .../com/edufocus/edufocus/user/controller/UserController.java | 2 ++ .../edufocus/edufocus/user/model/service/UserServiceImpl.java | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/com/edufocus/edufocus/user/config/WebConfiguration.java b/backend/src/main/java/com/edufocus/edufocus/user/config/WebConfiguration.java index 6eed008..b95ccb1 100644 --- a/backend/src/main/java/com/edufocus/edufocus/user/config/WebConfiguration.java +++ b/backend/src/main/java/com/edufocus/edufocus/user/config/WebConfiguration.java @@ -26,7 +26,7 @@ public class WebConfiguration implements WebMvcConfigurer { public void addCorsMappings(CorsRegistry registry) { registry .addMapping("/**") - .allowedOrigins("https://i11a701.p.ssafy.io/", "http://localhost:5173", "http://localhost:4173","http://localhost:5080") + .allowedOrigins("https://i11a701.p.ssafy.io/", "http://localhost:5173", "http://localhost:4173","http://localhost:5080","http://192.168.*:5173") .allowedMethods(HttpMethod.GET.name(), HttpMethod.POST.name(), HttpMethod.PUT.name(), HttpMethod.DELETE.name(), HttpMethod.HEAD.name(), HttpMethod.OPTIONS.name(), HttpMethod.PATCH.name()) @@ -35,6 +35,7 @@ public class WebConfiguration implements WebMvcConfigurer { .maxAge(1800); // Pre-flight Caching } + @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/img/**").addResourceLocations("classpath:/static/assets/img/"); diff --git a/backend/src/main/java/com/edufocus/edufocus/user/controller/UserController.java b/backend/src/main/java/com/edufocus/edufocus/user/controller/UserController.java index 2f3abf4..77d1774 100644 --- a/backend/src/main/java/com/edufocus/edufocus/user/controller/UserController.java +++ b/backend/src/main/java/com/edufocus/edufocus/user/controller/UserController.java @@ -35,6 +35,8 @@ public class UserController { public ResponseEntity join(@RequestBody User user) throws Exception { + System.out.println("@@@@@"); + log.info("@@@@@@@@@@@@@@@@"); userService.join(user); return ResponseEntity.ok("User registered successfully"); } diff --git a/backend/src/main/java/com/edufocus/edufocus/user/model/service/UserServiceImpl.java b/backend/src/main/java/com/edufocus/edufocus/user/model/service/UserServiceImpl.java index 06ee58a..dd8667a 100644 --- a/backend/src/main/java/com/edufocus/edufocus/user/model/service/UserServiceImpl.java +++ b/backend/src/main/java/com/edufocus/edufocus/user/model/service/UserServiceImpl.java @@ -23,7 +23,7 @@ public class UserServiceImpl implements UserService { private final UserRepository userRepository; - private final JavaMailSender mailSender; + private final JavaMailSender mailSender;//private final PasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); public void join(User user)