This repository has been archived on 2026-01-12. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
ptp/src/main/java/edu/msudenver/tsp/website/controller/UserCreationController.java

40 lines
1.7 KiB
Java

package edu.msudenver.tsp.website.controller;
import edu.msudenver.tsp.website.forms.UserCreationForm;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
@Slf4j
@Controller
@AllArgsConstructor
@RequestMapping("/createuser")
public class UserCreationController {
@GetMapping({"/",""})
public ModelAndView createUserPage() {
LOG.info("Received request to display the user creation page: returning model with name 'User'");
return new ModelAndView("User");
}
@PostMapping({"/",""})
public String registerUser(@Validated final UserCreationForm userCreationForm, final Model model) {
model.addAttribute("userID", userCreationForm.getUserID());
model.addAttribute("username", userCreationForm.getUsername());
model.addAttribute("password", userCreationForm.getPassword());
model.addAttribute("confirmPassword", userCreationForm.getConfirmPassword());
model.addAttribute("emailAddress", userCreationForm.getEmailAddress());
model.addAttribute("firstName", userCreationForm.getFirstName());
model.addAttribute("lastName", userCreationForm.getLastName());
model.addAttribute("referrer", userCreationForm.getReferrer());
model.addAttribute("TnCAgreement", userCreationForm.isAgreedToTerms());
return "successfulRegistration";
}
}