diff --git a/stockMate/src/main/java/com/stockm8/controller/HomeController.java b/stockMate/src/main/java/com/stockm8/controller/HomeController.java
index bdd2290..b6079d1 100644
--- a/stockMate/src/main/java/com/stockm8/controller/HomeController.java
+++ b/stockMate/src/main/java/com/stockm8/controller/HomeController.java
@@ -3,7 +3,13 @@
import java.text.DateFormat;
import java.util.Date;
import java.util.Locale;
+import java.util.Properties;
+import javax.mail.Message;
+import javax.mail.PasswordAuthentication;
+import javax.mail.Session;
+import javax.mail.Transport;
+import javax.mail.internet.MimeMessage;
import javax.servlet.http.HttpSession;
import org.slf4j.Logger;
@@ -12,6 +18,8 @@
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
/**
* Handles requests for the application home page.
@@ -106,6 +114,90 @@ public String consultationGET(Model model, HttpSession session) throws Exception
return "consultation";
}
+
+ // 상담하기 email - POST
+ @RequestMapping(value = "/", method = RequestMethod.POST)
+ public String sendConsultation(
+ @RequestParam("company") String company,
+ @RequestParam("name") String name,
+ @RequestParam("contact") String contact,
+ @RequestParam("email") String email,
+ @RequestParam("inquiry") String inquiry,
+ RedirectAttributes rttr) {
+
+ final String fromEmail = "zzangmait@naver.com"; // 네이버 이메일 계정
+ final String password = "571TT3J3UMVY"; // 네이버 이메일 비밀번호
+
+ String toEmail = "zzangmait@naver.com"; // 수신 이메일 주소
+
+ // SMTP 설정
+ Properties props = new Properties();
+ props.put("mail.smtp.host", "smtp.naver.com");
+ props.put("mail.smtp.port", "465");
+ props.put("mail.smtp.auth", "true");
+ props.put("mail.smtp.ssl.enable", "true"); // SSL 활성화
+ props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
+
+ Session session = Session.getInstance(props, new javax.mail.Authenticator() {
+ protected PasswordAuthentication getPasswordAuthentication() {
+ return new PasswordAuthentication(fromEmail, password);
+ }
+ });
+
+ try {
+ // 이메일 내용 설정
+ MimeMessage message = new MimeMessage(session);
+ message.setFrom(new javax.mail.internet.InternetAddress(fromEmail));
+ message.addRecipient(Message.RecipientType.TO, new javax.mail.internet.InternetAddress(toEmail));
+ message.setSubject("상담 신청 정보");
+
+ // HTML 형식 이메일 본문
+ String content = ""
+ + "
"
+ + ""
+ + "
상담 신청 정보
"
+ + "
"
+ + " "
+ + " 회사명 | "
+ + " " + company + " | "
+ + "
"
+ + " "
+ + " 이름 | "
+ + " " + name + " | "
+ + "
"
+ + " "
+ + " 연락처 | "
+ + " " + contact + " | "
+ + "
"
+ + " "
+ + " 이메일 | "
+ + " " + email + " | "
+ + "
"
+ + " "
+ + " 문의 내용 | "
+ + " " + inquiry + " | "
+ + "
"
+ + "
"
+ + "
상담 신청해주셔서 감사합니다.
"
+ + "
"
+ + "";
+
+ // 이메일 본문을 HTML로 설정
+ message.setContent(content, "text/html; charset=UTF-8");
+
+ // 메일 전송
+ Transport.send(message);
+ rttr.addFlashAttribute("message", "상담 신청이 성공적으로 전송되었습니다.");
+ } catch (Exception e) {
+ e.printStackTrace();
+ rttr.addFlashAttribute("error", "이메일 전송에 실패했습니다. 다시 시도해주세요.");
+ }
+
+ // http://localhost:8088/로 리다이렉트
+ return "redirect:/";
+ }
+
+
// 회사소개 - /intro (GET)
@RequestMapping(value = "/intro", method = RequestMethod.GET)
public String introGET(Model model, HttpSession session) throws Exception {
@@ -118,4 +210,32 @@ public String introGET(Model model, HttpSession session) throws Exception {
// model.addAttribute("resultVO", resultVO);
return "/intro";
}
+
+ // 회사소개 - /price (GET)
+ @RequestMapping(value = "/price", method = RequestMethod.GET)
+ public String priceGET(Model model, HttpSession session) throws Exception {
+ Long userId = (Long) session.getAttribute("userId");
+// if (id == null) {
+// // 세션에 id가 없으면 에러 처리
+// return "redirect:/user/main";
+// }
+// UserVO resultVO = userService.getUser(userId);
+// model.addAttribute("resultVO", resultVO);
+ return "/price";
+ }
+
+
+ // 약도 - /minimap (GET)
+ @RequestMapping(value = "/minimap", method = RequestMethod.GET)
+ public String minimapGET(Model model, HttpSession session) throws Exception {
+ Long userId = (Long) session.getAttribute("userId");
+// if (id == null) {
+// // 세션에 id가 없으면 에러 처리
+// return "redirect:/user/main";
+// }
+// UserVO resultVO = userService.getUser(userId);
+// model.addAttribute("resultVO", resultVO);
+ return "/minimap";
+ }
+
}
diff --git a/stockMate/src/main/java/com/stockm8/controller/UserController.java b/stockMate/src/main/java/com/stockm8/controller/UserController.java
index 8f2c85b..2bb3c50 100644
--- a/stockMate/src/main/java/com/stockm8/controller/UserController.java
+++ b/stockMate/src/main/java/com/stockm8/controller/UserController.java
@@ -43,12 +43,10 @@ public class UserController {
@Autowired
private UserService userService;
-
- // http://localhost:8088 (o)
// http://localhost:8088/user/signup (o)
// http://localhost:8088/user/signin (o)
- // http://localhost:8088/user/main (o)
+ // http://localhost:8088/ (o)
// http://localhost:8088/user/info1 (o)
// http://localhost:8088/user/info2 (o)
// http://localhost:8088/dashboard (o)
@@ -253,7 +251,7 @@ public String changepassword1GET(HttpSession session) {
return "/user/changepassword1"; // 비밀번호 입력 페이지로 이동
}
- // 회원정보 수정
+
@RequestMapping(value = "/changepassword1", method = RequestMethod.POST)
public String changepassword2POST(@RequestParam("password") String password, RedirectAttributes rttr, HttpSession session) {
Long userId = (Long) session.getAttribute("userId");
@@ -283,7 +281,7 @@ public String changepassword2POST(@RequestParam("password") String password, Red
}
}
- // - GET
+
@RequestMapping(value = "/changepassword2", method = RequestMethod.GET)
public String changepassword2GET(@ModelAttribute("currentPassword") String currentPassword, Model model) {
if (currentPassword == null || currentPassword.isEmpty()) {
@@ -294,7 +292,6 @@ public String changepassword2GET(@ModelAttribute("currentPassword") String curre
return "/user/changepassword2"; // JSP 페이지 반환
}
- // - POST
@RequestMapping(value = "/changepassword2", method = RequestMethod.POST)
public void changePasswordPOST(
@RequestParam("newPassword") String newPassword,
@@ -340,96 +337,17 @@ public void changePasswordPOST(
}
}
- // 상담하기 email - GET
- @RequestMapping(value = "/sendConsultation", method = RequestMethod.POST)
- public String sendConsultation(
- @RequestParam("company") String company,
- @RequestParam("name") String name,
- @RequestParam("contact") String contact,
- @RequestParam("email") String email,
- @RequestParam("inquiry") String inquiry,
- RedirectAttributes rttr) {
-
- final String fromEmail = "zzangmait@naver.com"; // 네이버 이메일 계정
- final String password = "571TT3J3UMVY"; // 네이버 이메일 비밀번호
-
- String toEmail = "zzangmait@naver.com"; // 수신 이메일 주소
-
- // SMTP 설정
- Properties props = new Properties();
- props.put("mail.smtp.host", "smtp.naver.com");
- props.put("mail.smtp.port", "465");
- props.put("mail.smtp.auth", "true");
- props.put("mail.smtp.ssl.enable", "true"); // SSL 활성화
- props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
-
- Session session = Session.getInstance(props, new javax.mail.Authenticator() {
- protected PasswordAuthentication getPasswordAuthentication() {
- return new PasswordAuthentication(fromEmail, password);
- }
- });
- try {
- // 이메일 내용 설정
- MimeMessage message = new MimeMessage(session);
- message.setFrom(new javax.mail.internet.InternetAddress(fromEmail));
- message.addRecipient(Message.RecipientType.TO, new javax.mail.internet.InternetAddress(toEmail));
- message.setSubject("상담 신청 정보");
-
- // HTML 형식 이메일 본문
- String content = ""
- + ""
- + ""
- + "
상담 신청 정보
"
- + "
"
- + " "
- + " 회사명 | "
- + " " + company + " | "
- + "
"
- + " "
- + " 이름 | "
- + " " + name + " | "
- + "
"
- + " "
- + " 연락처 | "
- + " " + contact + " | "
- + "
"
- + " "
- + " 이메일 | "
- + " " + email + " | "
- + "
"
- + " "
- + " 문의 내용 | "
- + " " + inquiry + " | "
- + "
"
- + "
"
- + "
상담 신청해주셔서 감사합니다.
"
- + "
"
- + "";
-
- // 이메일 본문을 HTML로 설정
- message.setContent(content, "text/html; charset=UTF-8");
-
- // 메일 전송
- Transport.send(message);
- rttr.addFlashAttribute("message", "상담 신청이 성공적으로 전송되었습니다.");
- } catch (Exception e) {
- e.printStackTrace();
- rttr.addFlashAttribute("error", "이메일 전송에 실패했습니다. 다시 시도해주세요.");
- }
-
- return "redirect:/user/consultation";
- }
// 비밀번호 찾기 - GET
- @RequestMapping(value = "/findpassword", method = RequestMethod.GET)
+ @RequestMapping(value = "/findPassword", method = RequestMethod.GET)
public String findPasswordGet() {
- return "/user/findpassword"; // 비밀번호 찾기 페이지로 이동
+ return "/user/findPassword"; // 비밀번호 찾기 페이지로 이동
}
// 비밀번호 찾기 - POST
- @RequestMapping(value = "/findpassword", method = RequestMethod.POST)
+ @RequestMapping(value = "/findPassword", method = RequestMethod.POST)
public String findPasswordPost(@RequestParam("email") String email,
@RequestParam("name") String name,
Model model) {
@@ -446,13 +364,13 @@ public String findPasswordPost(@RequestParam("email") String email,
// 비밀번호가 일치하지 않으면 오류 메시지 추가
logger.info("비밀번호 찾기 실패: 이메일 또는 이름이 일치하지 않음"); // 실패 로그
model.addAttribute("errorMessage", "이메일 또는 이름이 일치하지 않습니다.");
- return "/user/findpassword"; // 비밀번호 찾기 페이지로 다시 이동
+ return "/user/findPassword"; // 비밀번호 찾기 페이지로 다시 이동
}
} catch (Exception e) {
e.printStackTrace();
logger.error("비밀번호 찾기 처리 중 오류 발생", e); // 예외 로그 추가
model.addAttribute("errorMessage", "비밀번호 찾기 처리 중 오류가 발생했습니다.");
- return "/user/findpassword"; // 오류 발생 시 비밀번호 찾기 페이지로 돌아감
+ return "/user/findPassword"; // 오류 발생 시 비밀번호 찾기 페이지로 돌아감
}
}
diff --git a/stockMate/src/main/webapp/WEB-INF/views/consultation.jsp b/stockMate/src/main/webapp/WEB-INF/views/consultation.jsp
index bf19f4f..6ca4a20 100644
--- a/stockMate/src/main/webapp/WEB-INF/views/consultation.jsp
+++ b/stockMate/src/main/webapp/WEB-INF/views/consultation.jsp
@@ -58,7 +58,7 @@
}
.form-container input, .form-container textarea, .form-container button {
- width: 95.3%;
+ width: 96%;
margin-bottom: 8px;
padding: 8px;
border: none;
@@ -80,6 +80,30 @@
background-color: #ffaa00;
}
+ .back-button {
+ display: flex;
+ justify-content: center; /* 수평 중앙 정렬 */
+ margin: 40px auto; /* 위아래 여백 추가 */
+}
+
+.back-button a {
+ text-decoration: none;
+ padding: 15px 30px;
+ background-color: #007BFF;
+ color: #fff;
+ border-radius: 10px;
+ font-size: 20px;
+ font-weight: bold;
+ font-family: 'Roboto', sans-serif;
+ transition: background-color 0.3s ease, transform 0.3s ease;
+}
+
+.back-button a:hover {
+ background-color: #0056b3;
+ transform: scale(1.05);
+}
+
+
.footer {
text-align: center;
margin-top: 10px;
@@ -124,7 +148,7 @@
상담문의
-
+