@@ -0,0 +1,2278 @@
+package stopheracleum.controller;%0A%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.stereotype.Controller;%0Aimport org.springframework.ui.Model;%0Aimport org.springframework.validation.BindingResult;%0Aimport org.springframework.web.bind.annotation.ModelAttribute;%0Aimport org.springframework.web.bind.annotation.RequestMapping;%0Aimport org.springframework.web.bind.annotation.RequestMethod;%0Aimport stopheracleum.model.User;%0Aimport stopheracleum.security.SecurityService;%0Aimport stopheracleum.service.UserService;%0Aimport stopheracleum.validator.UserValidator;%0A%0A/**%0A * Controller for %7B@link stopheracleum.model.User%7D's pages.%0A */%0A%0A@Controller%0Apublic class UserController %7B%0A%0A    @Autowired%0A    private UserService userService;%0A%0A    @Autowired%0A    private SecurityService securityService;%0A%0A    @Autowired%0A    private UserValidator userValidator;%0A%0A    @RequestMapping(value = %22/registration%22, method = RequestMethod.GET)%0A    public String registration(Model model) %7B%0A        model.addAttribute(%22userForm%22, new User());%0A%0A        return %22registration%22;%0A    %7D%0A%0A    @RequestMapping(value = %22/registration%22, method = RequestMethod.POST)%0A    public String registration(@ModelAttribute(%22userForm%22) User userForm, BindingResult bindingResult, Model model) %7B%0A        userValidator.validate(userForm, bindingResult);%0A%0A        if (bindingResult.hasErrors()) %7B%0A            return %22registration%22;%0A        %7D%0A%0A        userService.save(userForm);%0A%0A        securityService.autoLogin(userForm.getUsername(), userForm.getConfirmPassword());%0A%0A        return %22redirect:/welcome%22;%0A    %7D%0A%0A    @RequestMapping(value = %22/login%22, method = RequestMethod.GET)%0A    public String login(Model model, String error, String logout) %7B%0A        if (error != null) %7B%0A            model.addAttribute(%22error%22, %22Username or password is incorrect.%22);%0A        %7D%0A%0A        if (logout != null) %7B%0A            model.addAttribute(%22message%22, %22Logged out successfully.%22);%0A        %7D%0A%0A        return %22login%22;%0A    %7D%0A%0A    @RequestMapping(value = %7B%22/%22, %22/welcome%22%7D, method = RequestMethod.GET)%0A    public String welcome(Model model) %7B%0A        return %22welcome%22;%0A    %7D%0A%0A    @RequestMapping(value = %22/admin%22, method = RequestMethod.GET)%0A    public String admin(Model model) %7B%0A        return %22admin%22;%0A    %7D%0A%7D%0A

Add controller for user's pages