| Line 1... |
Line 1... |
| 1 |
package com.spice.profitmandi.web.controller;
|
1 |
package com.spice.profitmandi.web.controller;
|
| 2 |
|
2 |
|
| 3 |
import javax.servlet.http.HttpServletRequest;
|
3 |
import javax.servlet.http.HttpServletRequest;
|
| 4 |
|
4 |
|
| - |
|
5 |
import org.hibernate.tool.schema.extract.internal.ForeignKeyInformationImpl;
|
| - |
|
6 |
import org.slf4j.Logger;
|
| - |
|
7 |
import org.slf4j.LoggerFactory;
|
| 5 |
import org.springframework.beans.factory.annotation.Autowired;
|
8 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 6 |
import org.springframework.stereotype.Controller;
|
9 |
import org.springframework.stereotype.Controller;
|
| 7 |
import org.springframework.ui.ModelMap;
|
10 |
import org.springframework.ui.ModelMap;
|
| 8 |
import org.springframework.web.bind.annotation.ModelAttribute;
|
11 |
import org.springframework.web.bind.annotation.ModelAttribute;
|
| 9 |
import org.springframework.web.bind.annotation.RequestMapping;
|
12 |
import org.springframework.web.bind.annotation.RequestMapping;
|
| Line 16... |
Line 19... |
| 16 |
import com.spice.profitmandi.web.util.GoogleLoginUtil;
|
19 |
import com.spice.profitmandi.web.util.GoogleLoginUtil;
|
| 17 |
|
20 |
|
| 18 |
@Controller
|
21 |
@Controller
|
| 19 |
public class LoginController {
|
22 |
public class LoginController {
|
| 20 |
|
23 |
|
| - |
|
24 |
private static final Logger LOGGER = LoggerFactory.getLogger(LoginController.class);
|
| - |
|
25 |
|
| 21 |
@Autowired
|
26 |
@Autowired
|
| 22 |
GoogleLoginUtil googleLoginUtil;
|
27 |
GoogleLoginUtil googleLoginUtil;
|
| 23 |
|
28 |
|
| 24 |
@RequestMapping(value = "/login", method = RequestMethod.GET)
|
29 |
@RequestMapping(value = "/login", method = RequestMethod.GET)
|
| 25 |
public String init(@ModelAttribute("model") ModelMap model) {
|
30 |
public String loginPage(@ModelAttribute("model") ModelMap model) {
|
| 26 |
return "login";
|
31 |
return "login";
|
| 27 |
}
|
32 |
}
|
| 28 |
|
33 |
|
| 29 |
@RequestMapping(value = "/login", method = RequestMethod.POST)
|
34 |
@RequestMapping(value = "/login", method = RequestMethod.POST)
|
| 30 |
public String indexPage(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.TOKEN) String token){
|
35 |
public String login(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.TOKEN) String token){
|
| 31 |
try{
|
36 |
try{
|
| 32 |
FofoDetails fofoDetails = googleLoginUtil.getFofoDetail(token);
|
37 |
FofoDetails fofoDetails = googleLoginUtil.getFofoDetail(token);
|
| 33 |
request.getSession().setAttribute(ProfitMandiConstants.FOFO_DETAILS, fofoDetails);
|
38 |
request.getSession().setAttribute(ProfitMandiConstants.FOFO_DETAILS, fofoDetails);
|
| 34 |
return "redirect: dashboard";
|
39 |
return "redirect: dashboard";
|
| 35 |
}catch(ProfitMandiBusinessException profitMandiBusinessException){
|
40 |
}catch(ProfitMandiBusinessException profitMandiBusinessException){
|
| - |
|
41 |
LOGGER.error("Error : ", profitMandiBusinessException);
|
| 36 |
return "redirect: error";
|
42 |
return "redirect: error";
|
| 37 |
}
|
43 |
}
|
| 38 |
}
|
44 |
}
|
| 39 |
}
|
45 |
}
|