Subversion Repositories SmartDukaan

Rev

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

Rev 26743 Rev 27229
Line 225... Line 225...
225
		} else {
225
		} else {
226
			throw new ProfitMandiBusinessException("", "", "");
226
			throw new ProfitMandiBusinessException("", "", "");
227
		}
227
		}
228
		return "response";
228
		return "response";
229
	}
229
	}
-
 
230
	
-
 
231
	@RequestMapping(value = "/login-as-partner-readonly", method = RequestMethod.GET)
-
 
232
	public String readonlyLogin(HttpServletRequest request, Model model, HttpServletResponse response,
-
 
233
			@RequestParam int fofoId) throws Exception {
-
 
234
		LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
-
 
235
		if (roleManager.isAdmin(fofoDetails.getRoleIds())) {
-
 
236
			int userId = userAccountRepository.selectUserIdByRetailerId(fofoId);
-
 
237
			User user = userRepository.selectById(userId);
-
 
238
			Set<Integer> roleIds = userRoleRepository.selectByUserId(userId).stream().map(x -> x.getRoleId())
-
 
239
					.collect(Collectors.toSet());
-
 
240
			LoginDetails newFofoDetails = new LoginDetails();
-
 
241
			newFofoDetails.setFofoId(fofoId);
-
 
242
			newFofoDetails.setRoleIds(roleIds);
-
 
243
			newFofoDetails.setEmailId(user.getEmailId());
-
 
244
			newFofoDetails.setReadOnly(true);
-
 
245
			model.addAttribute("response", true);
-
 
246
			this.addCookiesToResponse(newFofoDetails, request, response);
-
 
247
		} else {
-
 
248
			throw new ProfitMandiBusinessException("", "", "");
-
 
249
		}
-
 
250
		return "response";
-
 
251
	}
230
 
252
 
231
	@RequestMapping(value = "/login", method = RequestMethod.POST)
253
	@RequestMapping(value = "/login", method = RequestMethod.POST)
232
	public String login(HttpServletRequest request, HttpServletResponse response,
254
	public String login(HttpServletRequest request, HttpServletResponse response,
233
			@RequestParam(name = ProfitMandiConstants.TOKEN) String token,
255
			@RequestParam(name = ProfitMandiConstants.TOKEN) String token,
234
			@RequestParam(name = ProfitMandiConstants.EMAIL_ID_OR_MOBILE_NUMBER, defaultValue = "") String emailIdOrMobileNumber,
256
			@RequestParam(name = ProfitMandiConstants.EMAIL_ID_OR_MOBILE_NUMBER, defaultValue = "") String emailIdOrMobileNumber,