A self hosted chat application with end-to-end encrypted messaging.
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

package org.ros.chatto.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.ros.chatto.dto.UserRegistrationDTO;
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 UserRegistrationDTO());
return modelAndView;
}
@PostMapping("/perform_registration")
public ModelAndView performRegistration(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, @ModelAttribute("userDTO") UserRegistrationDTO userRegistrationDTO)
{
ModelAndView modelAndView = new ModelAndView("user/home");
userService.registerUser(userRegistrationDTO);
return modelAndView;
}
}