Subversion Repositories SmartDukaan

Rev

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

Rev 22148 Rev 22155
Line 81... Line 81...
81
			model.addAttribute("googleApiKey", googleApiKey);
81
			model.addAttribute("googleApiKey", googleApiKey);
82
			model.addAttribute("appContextPath", request.getContextPath());
82
			model.addAttribute("appContextPath", request.getContextPath());
83
			return "login";
83
			return "login";
84
		}
84
		}
85
	}
85
	}
-
 
86
	@RequestMapping(value = "/", method = RequestMethod.GET)
-
 
87
	public String home(){
-
 
88
		return "redirect:/	login";
-
 
89
	}
86
	
90
	
87
	@RequestMapping(value = "/login", method = RequestMethod.POST)
91
	@RequestMapping(value = "/login", method = RequestMethod.POST)
88
	public String login(HttpServletRequest request, HttpServletResponse response, @RequestParam(name = ProfitMandiConstants.TOKEN) String token, Model model) throws Exception{
92
	public String login(HttpServletRequest request, HttpServletResponse response, @RequestParam(name = ProfitMandiConstants.TOKEN) String token, Model model) throws Exception{
89
		LoginDetails fofoDetails = new LoginDetails();
93
		LoginDetails fofoDetails = new LoginDetails();
90
		Set<RoleType> roleTypes = new HashSet<>();
94
		Set<RoleType> roleTypes = new HashSet<>();
Line 94... Line 98...
94
		try{
98
		try{
95
			//if role is retailer then FOFO_ID is retailerId else it is userid as normal user's wont have retailer id. 
99
			//if role is retailer then FOFO_ID is retailerId else it is userid as normal user's wont have retailer id. 
96
			String emailId = googleTokenUtil.getEmailId(token);
100
			String emailId = googleTokenUtil.getEmailId(token);
97
			fofoDetails.setEmailId(emailId);
101
			fofoDetails.setEmailId(emailId);
98
			fofoDetails.setFofoId(-1);
102
			fofoDetails.setFofoId(-1);
-
 
103
			fofoDetails.setFofo(false);
99
			User user = null;
104
			User user = null;
100
			try{
105
			try{
101
				user = userRepository.selectByEmailId(emailId);
106
				user = userRepository.selectByEmailId(emailId);
102
				fofoDetails.setFofoId(user.getId());
107
				fofoDetails.setFofoId(user.getId());
103
				try {
108
				try {