Rev 21560 | Rev 21568 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
package com.spice.profitmandi.web.controller;import javax.servlet.http.HttpServletRequest;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Controller;import org.springframework.ui.ModelMap;import org.springframework.web.bind.annotation.ModelAttribute;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RequestMethod;import org.springframework.web.bind.annotation.RequestParam;import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;import com.spice.profitmandi.common.model.ProfitMandiConstants;import com.spice.profitmandi.web.model.FofoDetails;import com.spice.profitmandi.web.util.GoogleLoginUtil;@Controllerpublic class LoginController {@AutowiredGoogleLoginUtil googleLoginUtil;@RequestMapping(value = "/login", method = RequestMethod.GET)public String init(@ModelAttribute("model") ModelMap model) {return "login";}@RequestMapping(value = "/login", method = RequestMethod.POST)public String indexPage(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.TOKEN) String token){try{FofoDetails fofoDetails = googleLoginUtil.getFofoDetail(token);request.getSession().setAttribute(ProfitMandiConstants.FOFO_DETAILS, fofoDetails);return "redirect: dashboard";}catch(ProfitMandiBusinessException profitMandiBusinessException){return "redirect: error";}}}