@RequestMapping(value = "/login", method = RequestMethod.POST)
    public ModelAndView login(
            @RequestParam String email,
            @RequestParam String password) throws ApplicationException {

        ModelAndView model = new ModelAndView();

        if (null == email || null == password || "".equalsIgnoreCase(email) || "".equalsIgnoreCase(password)) {
            throw new ApplicationException("Username/password cannot be empty");
        }

        Credential credential = credentialService.findByEmail(email);
        if (null == credential) {
            throw new ApplicationException("Invalid login email. Please try again");
        }

        boolean isValidLogin = Utility.isValidLogin(credential, password);

        if (!isValidLogin) {
            throw new ApplicationException("Invalid username/password. Please try again");
        }

        Candidate candidate = candidateService.findByEmail(email);
        Iterable<JobOpening> jobOpenings = jobOpeningService.findAll();
        model.addObject("candidate", candidate);
        model.addObject("jobOpenings", jobOpenings);
        model.setViewName(ViewNames.INDEX_REDIRECT);
        return model;
    }