You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.2 KiB
34 lines
1.2 KiB
package org.ros.chatto.controller;
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import org.ros.chatto.model.UserDTO;
|
|
import org.ros.chatto.service.UserService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
@Controller
|
|
public class RegisterController {
|
|
|
|
@Autowired
|
|
private UserService userService;
|
|
@GetMapping("/registration")
|
|
public ModelAndView registrationForm()
|
|
{
|
|
ModelAndView modelAndView = new ModelAndView("registration");
|
|
modelAndView.addObject("userDTO",new UserDTO());
|
|
return modelAndView;
|
|
}
|
|
@PostMapping("/perform_registration")
|
|
public ModelAndView performRegistration(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, @ModelAttribute("userDTO") UserDTO userDTO)
|
|
{
|
|
ModelAndView modelAndView = new ModelAndView("user/home");
|
|
userService.registerUser(userDTO);
|
|
return modelAndView;
|
|
}
|
|
}
|