[EDIT] セッションチェック機能をつけました。
This commit is contained in:
@@ -6,6 +6,7 @@ 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;
|
||||||
|
|
||||||
|
import com.example.demo.aop.aspect.SessionCheck;
|
||||||
import com.example.demo.app.domain.model.AnalysisModel;
|
import com.example.demo.app.domain.model.AnalysisModel;
|
||||||
import com.example.demo.app.domain.model.LoginModel;
|
import com.example.demo.app.domain.model.LoginModel;
|
||||||
import com.example.demo.app.domain.service.AnalysisService;
|
import com.example.demo.app.domain.service.AnalysisService;
|
||||||
@@ -20,6 +21,7 @@ public class AnalysisController {
|
|||||||
|
|
||||||
private final AnalysisService analysisService;
|
private final AnalysisService analysisService;
|
||||||
|
|
||||||
|
@SessionCheck
|
||||||
@GetMapping("/analysis")
|
@GetMapping("/analysis")
|
||||||
public String showAnalysis(Model model, HttpSession session) {
|
public String showAnalysis(Model model, HttpSession session) {
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import org.springframework.ui.Model;
|
|||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
|
||||||
|
import com.example.demo.aop.aspect.SessionCheck;
|
||||||
import com.example.demo.app.domain.model.AuthenticationModel;
|
import com.example.demo.app.domain.model.AuthenticationModel;
|
||||||
import com.example.demo.app.domain.service.AuthenticationService;
|
import com.example.demo.app.domain.service.AuthenticationService;
|
||||||
import com.example.demo.app.infra.repository.QuestionRepository;
|
import com.example.demo.app.infra.repository.QuestionRepository;
|
||||||
@@ -21,6 +22,7 @@ public class AuthenticationController {
|
|||||||
private final AuthenticationService authenticationService;
|
private final AuthenticationService authenticationService;
|
||||||
private final QuestionRepository questionRepository;
|
private final QuestionRepository questionRepository;
|
||||||
|
|
||||||
|
@SessionCheck
|
||||||
@GetMapping("/authentication")
|
@GetMapping("/authentication")
|
||||||
public String showAuthentication(Model model) {
|
public String showAuthentication(Model model) {
|
||||||
|
|
||||||
@@ -30,6 +32,7 @@ public class AuthenticationController {
|
|||||||
return "authentication";
|
return "authentication";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SessionCheck
|
||||||
@PostMapping("/authentication")
|
@PostMapping("/authentication")
|
||||||
public String authenticate(
|
public String authenticate(
|
||||||
AuthenticationForm authenticationForm,
|
AuthenticationForm authenticationForm,
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
import com.example.demo.aop.aspect.SessionCheck;
|
||||||
import com.example.demo.app.domain.model.LoginModel;
|
import com.example.demo.app.domain.model.LoginModel;
|
||||||
import com.example.demo.app.domain.model.UserModel;
|
import com.example.demo.app.domain.model.UserModel;
|
||||||
import com.example.demo.app.domain.service.CourseInfoService;
|
import com.example.demo.app.domain.service.CourseInfoService;
|
||||||
@@ -38,7 +39,7 @@ public class CourseController {
|
|||||||
private final UserService userService;
|
private final UserService userService;
|
||||||
|
|
||||||
|
|
||||||
|
@SessionCheck
|
||||||
@PostMapping("/select/register")
|
@PostMapping("/select/register")
|
||||||
public String showSelectCourse(@ModelAttribute UserModel userModel, Model model) {
|
public String showSelectCourse(@ModelAttribute UserModel userModel, Model model) {
|
||||||
|
|
||||||
@@ -63,6 +64,7 @@ public class CourseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SessionCheck
|
||||||
@PostMapping("/select/change")
|
@PostMapping("/select/change")
|
||||||
public String showChangeCourse(Model model) {
|
public String showChangeCourse(Model model) {
|
||||||
|
|
||||||
@@ -87,6 +89,7 @@ public class CourseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SessionCheck
|
||||||
@PostMapping("/change")
|
@PostMapping("/change")
|
||||||
public String changeCourse(@RequestParam Long courseId) {
|
public String changeCourse(@RequestParam Long courseId) {
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.ModelAttribute;
|
|||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
import com.example.demo.aop.aspect.SessionCheck;
|
||||||
import com.example.demo.app.domain.model.GoalModel;
|
import com.example.demo.app.domain.model.GoalModel;
|
||||||
import com.example.demo.app.domain.model.LoginModel;
|
import com.example.demo.app.domain.model.LoginModel;
|
||||||
import com.example.demo.app.domain.service.GoalService;
|
import com.example.demo.app.domain.service.GoalService;
|
||||||
@@ -23,6 +24,7 @@ public class GoalController {
|
|||||||
|
|
||||||
private final GoalService goalService;
|
private final GoalService goalService;
|
||||||
|
|
||||||
|
@SessionCheck
|
||||||
@GetMapping("")
|
@GetMapping("")
|
||||||
public String getGoal(Model model, HttpSession session) {
|
public String getGoal(Model model, HttpSession session) {
|
||||||
|
|
||||||
@@ -37,6 +39,7 @@ public class GoalController {
|
|||||||
return "goal_view";
|
return "goal_view";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SessionCheck
|
||||||
@GetMapping("/edit")
|
@GetMapping("/edit")
|
||||||
public String editGoal(Model model, HttpSession session) {
|
public String editGoal(Model model, HttpSession session) {
|
||||||
|
|
||||||
@@ -50,6 +53,7 @@ public class GoalController {
|
|||||||
return "goal_edit";
|
return "goal_edit";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SessionCheck
|
||||||
@PostMapping("/update")
|
@PostMapping("/update")
|
||||||
public String updateGoal(@ModelAttribute GoalForm goalForm, HttpSession session) {
|
public String updateGoal(@ModelAttribute GoalForm goalForm, HttpSession session) {
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import org.springframework.ui.Model;
|
|||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
|
||||||
|
import com.example.demo.aop.aspect.SessionCheck;
|
||||||
import com.example.demo.app.domain.model.LoginModel;
|
import com.example.demo.app.domain.model.LoginModel;
|
||||||
import com.example.demo.app.domain.model.ProfileModel;
|
import com.example.demo.app.domain.model.ProfileModel;
|
||||||
import com.example.demo.app.domain.service.ProfileService;
|
import com.example.demo.app.domain.service.ProfileService;
|
||||||
@@ -19,6 +20,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
public class ProfileController {
|
public class ProfileController {
|
||||||
private final ProfileService profileService;
|
private final ProfileService profileService;
|
||||||
|
|
||||||
|
@SessionCheck
|
||||||
@GetMapping("/profile")
|
@GetMapping("/profile")
|
||||||
public String profile(Model model, HttpSession session) {
|
public String profile(Model model, HttpSession session) {
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||||
@@ -31,6 +33,7 @@ public class ProfileController {
|
|||||||
return "profile";
|
return "profile";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SessionCheck
|
||||||
@GetMapping("/profile/edit")
|
@GetMapping("/profile/edit")
|
||||||
public String showEditProfile() {
|
public String showEditProfile() {
|
||||||
return "profile_edit";
|
return "profile_edit";
|
||||||
@@ -49,6 +52,7 @@ public class ProfileController {
|
|||||||
return "redirect:/login";
|
return "redirect:/login";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/logout")
|
@PostMapping("/logout")
|
||||||
public String logout(HttpSession session) {
|
public String logout(HttpSession session) {
|
||||||
session.invalidate();
|
session.invalidate();
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.ModelAttribute;
|
|||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
import com.example.demo.aop.aspect.SessionCheck;
|
||||||
import com.example.demo.app.domain.model.LoginModel;
|
import com.example.demo.app.domain.model.LoginModel;
|
||||||
import com.example.demo.app.domain.service.CategoryService;
|
import com.example.demo.app.domain.service.CategoryService;
|
||||||
import com.example.demo.app.domain.service.GoalService;
|
import com.example.demo.app.domain.service.GoalService;
|
||||||
@@ -41,6 +42,7 @@ public class TransactionController {
|
|||||||
private final UserService userService;
|
private final UserService userService;
|
||||||
|
|
||||||
// 一覧画面
|
// 一覧画面
|
||||||
|
@SessionCheck
|
||||||
@GetMapping("/transaction/list")
|
@GetMapping("/transaction/list")
|
||||||
public String transactionList(
|
public String transactionList(
|
||||||
@RequestParam(required = false, defaultValue = "0") String years,
|
@RequestParam(required = false, defaultValue = "0") String years,
|
||||||
@@ -124,6 +126,7 @@ public class TransactionController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 詳細画面
|
// 詳細画面
|
||||||
|
@SessionCheck
|
||||||
@GetMapping("/transaction/detail")
|
@GetMapping("/transaction/detail")
|
||||||
public String findOne(@RequestParam(required = false) LocalDate todayDates, Model model, HttpSession session) {
|
public String findOne(@RequestParam(required = false) LocalDate todayDates, Model model, HttpSession session) {
|
||||||
|
|
||||||
@@ -176,6 +179,7 @@ public class TransactionController {
|
|||||||
return "transaction_detail";
|
return "transaction_detail";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SessionCheck
|
||||||
@GetMapping("/transaction/create")
|
@GetMapping("/transaction/create")
|
||||||
public String createOneGet(@RequestParam(defaultValue = "") LocalDate today,
|
public String createOneGet(@RequestParam(defaultValue = "") LocalDate today,
|
||||||
Model model) {
|
Model model) {
|
||||||
@@ -200,6 +204,7 @@ public class TransactionController {
|
|||||||
return "transaction_create";
|
return "transaction_create";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SessionCheck
|
||||||
@PostMapping("/transaction/create")
|
@PostMapping("/transaction/create")
|
||||||
public String createOnePost(@ModelAttribute TransactionForm transactionForm, @RequestParam LocalDate today,
|
public String createOnePost(@ModelAttribute TransactionForm transactionForm, @RequestParam LocalDate today,
|
||||||
Model model,
|
Model model,
|
||||||
@@ -215,6 +220,7 @@ public class TransactionController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SessionCheck
|
||||||
@GetMapping("/transaction/update")
|
@GetMapping("/transaction/update")
|
||||||
public String updateOneGet(@RequestParam Long transactionId, @RequestParam(defaultValue = "") LocalDate today,
|
public String updateOneGet(@RequestParam Long transactionId, @RequestParam(defaultValue = "") LocalDate today,
|
||||||
Model model) {
|
Model model) {
|
||||||
@@ -246,6 +252,7 @@ public class TransactionController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SessionCheck
|
||||||
@PostMapping("/transaction/update")
|
@PostMapping("/transaction/update")
|
||||||
public String updateOnePost(@RequestParam Long transactionId, @ModelAttribute TransactionForm transactionForm,
|
public String updateOnePost(@RequestParam Long transactionId, @ModelAttribute TransactionForm transactionForm,
|
||||||
@RequestParam LocalDate today, Model model,
|
@RequestParam LocalDate today, Model model,
|
||||||
@@ -264,6 +271,7 @@ public class TransactionController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SessionCheck
|
||||||
@PostMapping("/transaction/delete")
|
@PostMapping("/transaction/delete")
|
||||||
public String deleteOne(@RequestParam Long transactionId, @RequestParam LocalDate today) {
|
public String deleteOne(@RequestParam Long transactionId, @RequestParam LocalDate today) {
|
||||||
|
|
||||||
@@ -271,6 +279,7 @@ public class TransactionController {
|
|||||||
return "redirect:/transaction/detail?todayDates=" + today;
|
return "redirect:/transaction/detail?todayDates=" + today;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SessionCheck
|
||||||
@GetMapping("/menu")
|
@GetMapping("/menu")
|
||||||
public String menu(HttpSession session, Model model,
|
public String menu(HttpSession session, Model model,
|
||||||
@RequestParam(required = false, defaultValue = "0") String years,
|
@RequestParam(required = false, defaultValue = "0") String years,
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import com.example.demo.app.presentation.form.UserForm;
|
|||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class UserController {
|
public class UserController {
|
||||||
|
|||||||
Reference in New Issue
Block a user