package ciai; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import java.util.Map; @Controller @RequestMapping(value = "/") public class AppController { @RequestMapping(value = "") public String root() { return "index"; } @RequestMapping(value = "/student/{number}") public String pagestudent() { return "index"; } @RequestMapping(value = "/professor/{number}") public String pageprofessor() { return "index"; } @RequestMapping(value = "/guest") public String pageguest() { return "index"; } @RequestMapping(value = "auth/student", method = RequestMethod.POST) public @ResponseBody Boolean authStudent(@RequestParam Map requestParams) throws Exception{ String userName=requestParams.get("email"); String password=requestParams.get("password"); if(userName.equals("student@gmail.com") && password.equals("12345")){ return true; } return false; } @RequestMapping(value = "auth/professor", method = RequestMethod.POST) public @ResponseBody Boolean authProfessor(@RequestParam Map requestParams) throws Exception{ String userName=requestParams.get("username"); String password=requestParams.get("password"); if(userName.equals("prof1") && password.equals("12345")){ return true; } return false; } }