Package balu.pizza.webapp.controllers
Class PersonController
java.lang.Object
balu.pizza.webapp.controllers.PersonController
Users controller
-
Constructor Summary
ConstructorDescriptionPersonController
(UserUtil userUtil, PizzaService pizzaService, PersonValidator personValidator, PersonService personService) -
Method Summary
Modifier and TypeMethodDescriptionchangeUserInfo
(Person person, org.springframework.ui.Model model) Edit user information pageupdateUserInfo
(@Valid Person person, org.springframework.validation.BindingResult bindingResult, String rePassword, org.springframework.ui.Model model) Method for validating the information entered by the useruserPage
(org.springframework.ui.Model model) Personal user area
-
Constructor Details
-
PersonController
@Autowired public PersonController(UserUtil userUtil, PizzaService pizzaService, PersonValidator personValidator, PersonService personService) - Parameters:
userUtil
- Set users utilspizzaService
- Pizza servicepersonValidator
- User data validationpersonService
- User service
-
-
Method Details
-
userPage
Personal user area- Parameters:
model
-- Returns:
- Generates a page for the route /user/myPage
-
changeUserInfo
@GetMapping("/edit") public String changeUserInfo(@ModelAttribute("person") Person person, org.springframework.ui.Model model) Edit user information page- Parameters:
person
-model
-- Returns:
- Generates a page for the route /user/edit
-
updateUserInfo
@PatchMapping("/edit") public String updateUserInfo(@ModelAttribute("person") @Valid @Valid Person person, org.springframework.validation.BindingResult bindingResult, String rePassword, org.springframework.ui.Model model) Method for validating the information entered by the user- Parameters:
person
-bindingResult
-rePassword
-model
-- Returns:
- In case of successful validation - update the user information in the database
-