Subversion Repositories SmartDukaan

Rev

Rev 21560 | Rev 21568 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 21560 Rev 21561
Line 1... Line 1...
1
package com.spice.profitmandi.controller;
1
package com.spice.profitmandi.web.controller;
2
 
2
 
-
 
3
import javax.servlet.http.HttpServletRequest;
-
 
4
 
-
 
5
import org.springframework.beans.factory.annotation.Autowired;
3
import org.springframework.stereotype.Controller;
6
import org.springframework.stereotype.Controller;
4
import org.springframework.ui.ModelMap;
7
import org.springframework.ui.ModelMap;
5
import org.springframework.web.bind.annotation.ModelAttribute;
8
import org.springframework.web.bind.annotation.ModelAttribute;
6
import org.springframework.web.bind.annotation.RequestMapping;
9
import org.springframework.web.bind.annotation.RequestMapping;
7
import org.springframework.web.bind.annotation.RequestMethod;
10
import org.springframework.web.bind.annotation.RequestMethod;
-
 
11
import org.springframework.web.bind.annotation.RequestParam;
-
 
12
 
-
 
13
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
-
 
14
import com.spice.profitmandi.common.model.ProfitMandiConstants;
-
 
15
import com.spice.profitmandi.web.model.FofoDetails;
-
 
16
import com.spice.profitmandi.web.util.GoogleLoginUtil;
8
 
17
 
9
@Controller
18
@Controller
10
public class LoginController {
19
public class LoginController {
11
 
20
 
-
 
21
	@Autowired
-
 
22
	GoogleLoginUtil googleLoginUtil;
-
 
23
	
12
	@RequestMapping(value = "/login", method = RequestMethod.GET)
24
	@RequestMapping(value = "/login", method = RequestMethod.GET)
13
	public String init(@ModelAttribute("model") ModelMap model) {
25
	public String init(@ModelAttribute("model") ModelMap model) {
14
		return "login";
26
		return "login";
15
	}
27
	}
16
	
28
	
17
	@RequestMapping(value = "/login", method = RequestMethod.POST)
29
	@RequestMapping(value = "/login", method = RequestMethod.POST)
-
 
30
	public String indexPage(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.TOKEN) String token){
-
 
31
		try{
-
 
32
			FofoDetails fofoDetails = googleLoginUtil.getFofoDetail(token);
-
 
33
			request.getSession().setAttribute(ProfitMandiConstants.FOFO_DETAILS, fofoDetails);
18
	public String indexPage(){
34
			return "redirect: dashboard";
-
 
35
		}catch(ProfitMandiBusinessException profitMandiBusinessException){
19
		return "index";
36
			return "redirect: error";
-
 
37
		}
20
	}
38
	}
21
}
39
}