Subversion Repositories SmartDukaan

Rev

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

Rev 22075 Rev 22079
Line 7... Line 7...
7
import javax.servlet.http.HttpServletResponse;
7
import javax.servlet.http.HttpServletResponse;
8
 
8
 
9
import org.slf4j.Logger;
9
import org.slf4j.Logger;
10
import org.slf4j.LoggerFactory;
10
import org.slf4j.LoggerFactory;
11
import org.springframework.beans.factory.annotation.Autowired;
11
import org.springframework.beans.factory.annotation.Autowired;
-
 
12
import org.springframework.beans.factory.annotation.Value;
12
import org.springframework.core.io.Resource;
13
import org.springframework.core.io.Resource;
13
import org.springframework.stereotype.Controller;
14
import org.springframework.stereotype.Controller;
14
import org.springframework.transaction.annotation.Transactional;
15
import org.springframework.transaction.annotation.Transactional;
15
import org.springframework.ui.Model;
16
import org.springframework.ui.Model;
16
import org.springframework.ui.ModelMap;
17
import org.springframework.ui.ModelMap;
Line 40... Line 41...
40
	MVCResponseSender mvcResponseSender;
41
	MVCResponseSender mvcResponseSender;
41
	
42
	
42
	@Autowired
43
	@Autowired
43
	CookiesProcessor cookiesProcessor;
44
	CookiesProcessor cookiesProcessor;
44
	
45
	
-
 
46
	@Value("${app.context.path}")
-
 
47
	private String appContextPath;
-
 
48
 
-
 
49
	@Value("${google.api.key}")
-
 
50
	private String googleApiKey;
-
 
51
	
45
	@RequestMapping(value = "/login", method = RequestMethod.GET)
52
	@RequestMapping(value = "/login", method = RequestMethod.GET)
46
	public String loginPage(HttpServletRequest request, Model model) throws Exception{
53
	public String loginPage(HttpServletRequest request, Model model) throws Exception{
47
		try{
54
		try{
48
			cookiesProcessor.getCookiesObject(request);
55
			cookiesProcessor.getCookiesObject(request);
49
			LOGGER.info("Request session is already exist, should be redirect to /dashboard");
56
			LOGGER.info("Request session is already exist, should be redirect to /dashboard");
50
			return "redirect:/dashboard";
57
			return "redirect:/dashboard";
51
		}catch(Exception | ProfitMandiBusinessException profitMandiBusinessException){
58
		}catch(Exception | ProfitMandiBusinessException profitMandiBusinessException){
52
			Resource resource = AppConfig.getResource();
-
 
53
			Properties properties = new Properties();
-
 
54
			properties.load(resource.getInputStream());
-
 
55
			model.addAttribute("googleApiKey", properties.getProperty("google.api.key"));
59
			model.addAttribute("googleApiKey", googleApiKey);
56
			model.addAttribute("appContextPath", properties.getProperty("app.context.path"));
60
			model.addAttribute("appContextPath", appContextPath);
57
			return "login";
61
			return "login";
58
		}
62
		}
59
	}
63
	}
60
	
64
	
61
	@RequestMapping(value = "/login", method = RequestMethod.POST)
65
	@RequestMapping(value = "/login", method = RequestMethod.POST)