| Line 38... |
Line 38... |
| 38 |
@RequestMapping(value = "/login", method = RequestMethod.GET)
|
38 |
@RequestMapping(value = "/login", method = RequestMethod.GET)
|
| 39 |
public String loginPage(HttpServletRequest request, @ModelAttribute("model") ModelMap model) throws Exception{
|
39 |
public String loginPage(HttpServletRequest request, @ModelAttribute("model") ModelMap model) throws Exception{
|
| 40 |
try{
|
40 |
try{
|
| 41 |
cookiesFetcher.getCookiesObject(request);
|
41 |
cookiesFetcher.getCookiesObject(request);
|
| 42 |
LOGGER.info("Request session is already exist, should be redirect to /dashboard");
|
42 |
LOGGER.info("Request session is already exist, should be redirect to /dashboard");
|
| 43 |
model.addAttribute("loginResponse", mvcResponseSender.createResponseString("RTLR_OK_1001", true, "/dashboard"));
|
- |
|
| 44 |
return "response";
|
43 |
return "redirect:/dashboard";
|
| 45 |
}catch(ProfitMandiBusinessException profitMandiBusinessException){
|
44 |
}catch(ProfitMandiBusinessException profitMandiBusinessException){
|
| 46 |
return "login";
|
45 |
return "login";
|
| 47 |
}
|
46 |
}
|
| 48 |
}
|
47 |
}
|
| 49 |
|
48 |
|
| 50 |
@RequestMapping(value = "/login", method = RequestMethod.POST)
|
49 |
@RequestMapping(value = "/login", method = RequestMethod.POST)
|
| 51 |
public String login(HttpServletRequest request, HttpServletResponse response, @RequestParam(name = ProfitMandiConstants.TOKEN) String token, @ModelAttribute ModelMap model) throws Exception{
|
50 |
public String login(HttpServletRequest request, HttpServletResponse response, @RequestParam(name = ProfitMandiConstants.TOKEN) String token, @ModelAttribute ModelMap model) throws Exception{
|
| 52 |
try{
|
51 |
try{
|
| 53 |
FofoDetails fofoDetails = googleLoginUtil.getFofoDetail(token);
|
52 |
FofoDetails fofoDetails = googleLoginUtil.getFofoDetail(token);
|
| 54 |
Cookie cookieFofoId = new Cookie(ProfitMandiConstants.FOFO_ID, String.valueOf(fofoDetails.getFofoId()));
|
53 |
Cookie cookieFofoId = new Cookie(ProfitMandiConstants.FOFO_ID, String.valueOf(fofoDetails.getFofoId()));
|
| 55 |
cookieFofoId.setDomain("localhost");
|
54 |
cookieFofoId.setDomain(request.getServerName());
|
| 56 |
cookieFofoId.setMaxAge(30);
|
55 |
cookieFofoId.setMaxAge(30);
|
| 57 |
Cookie cookieEmailId = new Cookie(ProfitMandiConstants.EMAIL_ID, fofoDetails.getEmailId());
|
56 |
Cookie cookieEmailId = new Cookie(ProfitMandiConstants.EMAIL_ID, fofoDetails.getEmailId());
|
| 58 |
cookieEmailId.setDomain("localhost");
|
57 |
cookieEmailId.setDomain(request.getServerName());
|
| 59 |
cookieEmailId.setMaxAge(30);
|
58 |
cookieEmailId.setMaxAge(30);
|
| 60 |
response.addCookie(cookieFofoId);
|
59 |
response.addCookie(cookieFofoId);
|
| 61 |
response.addCookie(cookieEmailId);
|
60 |
response.addCookie(cookieEmailId);
|
| 62 |
LOGGER.info("Requested token email_id is valid, user login to system, shoud be redirect to /dashboard");
|
61 |
LOGGER.info("Requested token email_id is valid, user login to system, shoud be redirect to /dashboard");
|
| 63 |
model.addAttribute("loginResponse", mvcResponseSender.createResponseString("RTLR_OK_1002", true, "/dashboard"));
|
62 |
model.addAttribute("loginResponse", mvcResponseSender.createResponseString("RTLR_OK_1002", true, "/dashboard"));
|