Compare commits
4 Commits
d83559e937
...
e0a7a3496f
| Author | SHA1 | Date | |
|---|---|---|---|
| e0a7a3496f | |||
| f35a3e03d7 | |||
| 9a1d7144a8 | |||
| f588e29b46 |
@@ -4,4 +4,5 @@ import com.example.demo.app.domain.model.ProfileModel;
|
||||
|
||||
public interface ProfileService {
|
||||
ProfileModel findOne(Long userId);
|
||||
void withdraw(Long userId);
|
||||
}
|
||||
|
||||
@@ -31,4 +31,16 @@ public class ProfileServiceImpl implements ProfileService{
|
||||
userEntity.getAnnualIncome(),
|
||||
userEntity.getMonthlyBudget());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void withdraw(Long userId) {
|
||||
UserEntity userEntity =userRepository.findById(userId).orElse(null);
|
||||
|
||||
if (userEntity == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
userEntity.setDeleteFlag(1);
|
||||
userRepository.save(userEntity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import jakarta.servlet.http.HttpSession;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
||||
import com.example.demo.app.domain.model.LoginModel;
|
||||
import com.example.demo.app.domain.model.ProfileModel;
|
||||
@@ -29,4 +30,28 @@ public class ProfileController {
|
||||
model.addAttribute("profileForm", profileForm);
|
||||
return "profile";
|
||||
}
|
||||
|
||||
@GetMapping("/profile/edit")
|
||||
public String showEditProfile() {
|
||||
return "profile_edit";
|
||||
}
|
||||
|
||||
@PostMapping("/withdraw")
|
||||
public String withdraw(HttpSession session) {
|
||||
|
||||
LoginModel loginUser =
|
||||
(LoginModel) session.getAttribute("loginUser");
|
||||
|
||||
profileService.withdraw(loginUser.getUserId());
|
||||
|
||||
session.invalidate();
|
||||
|
||||
return "redirect:/login";
|
||||
}
|
||||
|
||||
@PostMapping("/logout")
|
||||
public String logout(HttpSession session) {
|
||||
session.invalidate();
|
||||
return "redirect:/login";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,11 @@
|
||||
<title>認証</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<body class="pb-5 pt-5">
|
||||
|
||||
<div th:replace="~{header :: header}">
|
||||
</div>
|
||||
|
||||
<main>
|
||||
<h1>本人認証確認</h1>
|
||||
|
||||
@@ -48,6 +52,9 @@
|
||||
alert(/*[[${errorMessage}]]*/);
|
||||
</script>
|
||||
|
||||
<div th:replace="~{footer :: footer}">
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -5,7 +5,10 @@
|
||||
<title>エラー</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<body class="pb-5 pt-5">
|
||||
|
||||
<div th:replace="~{header :: header}">
|
||||
</div>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<body class="pb-5 pt-5">
|
||||
|
||||
<div th:replace="~{header :: header}"></div>
|
||||
|
||||
<h1>目標編集</h1>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<body class="pb-5 pt-5">
|
||||
<div th:replace="~{header :: header}"></div>
|
||||
|
||||
|
||||
|
||||
@@ -4,8 +4,9 @@
|
||||
<meta charset="UTF-8">
|
||||
<title>ログイン</title>
|
||||
</head>
|
||||
<body>
|
||||
<header></header>
|
||||
<body class="pb-5 pt-5">
|
||||
<div th:replace="~{header :: header}">
|
||||
</div>
|
||||
|
||||
<main>
|
||||
<h1>ログイン</h1>
|
||||
|
||||
@@ -4,8 +4,9 @@
|
||||
<meta charset="UTF-8">
|
||||
<title>パスワード再設定</title>
|
||||
</head>
|
||||
<body>
|
||||
<header></header>
|
||||
<body class="pb-5 pt-5">
|
||||
<div th:replace="~{header :: header}">
|
||||
</div>
|
||||
|
||||
<main>
|
||||
<h1>パスワード再設定</h1>
|
||||
|
||||
@@ -4,8 +4,10 @@
|
||||
<meta charset="UTF-8">
|
||||
<title>プロフィール</title>
|
||||
</head>
|
||||
<body>
|
||||
<header></header>
|
||||
<body class="pb-5 pt-5">
|
||||
|
||||
<div th:replace="~{header :: header}">
|
||||
</div>
|
||||
|
||||
<main>
|
||||
<div>
|
||||
@@ -51,13 +53,18 @@
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<form th:action="@{/login}" method="post">
|
||||
<form th:action="@{/logout}" method="post">
|
||||
<button type="submit">ログアウト</button>
|
||||
</form>
|
||||
|
||||
<form th:action="@{/aaa}" method="post">
|
||||
<form th:action="@{/withdraw}" method="post"
|
||||
onsubmit="return confirm('本当に脱退しますか?');">
|
||||
<button type="submit">脱退</button>
|
||||
</form>
|
||||
</main>
|
||||
|
||||
<div th:replace="~{footer :: footer}">
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -4,8 +4,9 @@
|
||||
<meta charset="UTF-8">
|
||||
<title>新規会員登録</title>
|
||||
</head>
|
||||
<body>
|
||||
<header></header>
|
||||
<body class="pb-5 pt-5">
|
||||
<div th:replace="~{header :: header}">
|
||||
</div>
|
||||
|
||||
<main>
|
||||
<h1>新規会員登録</h1>
|
||||
|
||||
@@ -4,8 +4,9 @@
|
||||
<meta charset="UTF-8">
|
||||
<title>新規会員登録確認</title>
|
||||
</head>
|
||||
<body>
|
||||
<header></header>
|
||||
<body class="pb-5 pt-5">
|
||||
<div th:replace="~{header :: header}">
|
||||
</div>
|
||||
|
||||
<main>
|
||||
<h1>新規会員登録確認</h1>
|
||||
|
||||
Reference in New Issue
Block a user