package sg.ncl;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
public class MainController {
    
    @RequestMapping(value="/", method=RequestMethod.GET)
    public String index(Model model) throws Exception {
        model.addAttribute("loginForm", new LoginForm());
        return "index";
    }
    
    @RequestMapping(value="/", method=RequestMethod.POST)
    public String loginSubmit(@ModelAttribute LoginForm loginForm, Model model) throws Exception {
        model.addAttribute("loginForm", loginForm);
        return "redirect:/dashboard";
    }
    
    @RequestMapping("/signup")
    public String signup(Model model) {
        // forms has to be added for other views, because the loginForm also exists on those pages
        model.addAttribute("loginForm", new LoginForm());
        return "signup";
    }
    
    @RequestMapping("/passwordreset")
    public String passwordreset(Model model) {
        model.addAttribute("loginForm", new LoginForm());
        return "passwordreset";
    }
    
    @RequestMapping("/dashboard")
    public String dashboard() {
        return "dashboard";
    }
    
    @RequestMapping(value="/logout", method=RequestMethod.GET)
    public String logout() {
        return "redirect:/";
    }
    
    @RequestMapping("/teams")
    public String teams() {
        return "teams";
    }
}
@@ -1572,9 +1572,769 @@
 ;%0A    %7D%0A
+    %0A    @RequestMapping(%22/team_application_submitted%22)%0A    public String teamAppSubmit() %7B%0A        return %22team_application_submitted%22;%0A    %7D%0A    %0A    @RequestMapping(%22/join_application_submitted%22)%0A    public String joinTeamAppSubmit() %7B%0A        return %22join_team_application_submitted%22;%0A    %7D%0A    %0A    @RequestMapping(%22/email_not_validated%22)%0A    public String emailNotValidated() %7B%0A        return %22email_not_validated%22;%0A    %7D%0A    %0A    @RequestMapping(%22/team_application_under_review%22)%0A    public String teamAppUnderReview() %7B%0A        return %22team_application_under_review%22;%0A    %7D%0A    %0A    @RequestMapping(%22/join_application_awaiting_approval%22)%0A    public String joinTeamAppAwaitingApproval() %7B%0A        return %22join_team_application_awaiting_approval%22;%0A    %7D%0A
 %7D

add request mapping for static pages (#DEV-83)