Subversion Repositories SmartDukaan

Rev

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

Rev 26021 Rev 26022
Line 117... Line 117...
117
	@Autowired
117
	@Autowired
118
	private AuthService authService;
118
	private AuthService authService;
119
 
119
 
120
	@Autowired
120
	@Autowired
121
	private AuthRepository authRepository;
121
	private AuthRepository authRepository;
122
	
-
 
123
	public static final Map<String, String> nameEmail = new HashMap<>();
-
 
124
	static {
-
 
125
		nameEmail.put("Amod", "amod.sen@smartdukaan.com");
-
 
126
		nameEmail.put("Parmod", "parmod.kumar@smartdukaan.com");
-
 
127
		nameEmail.put("Anis", "md.anis@smartdukaan.com");
-
 
128
		nameEmail.put("Manoj", "manoj.singh@smartdukaan.com");
-
 
129
		nameEmail.put("Adeel", "adeel.yazdani@smartdukaan.com");
-
 
130
		//nameEmail.put("Mohinder", "mohinder.mutreja@smartdukaan.com");
-
 
131
		nameEmail.put("Dharmendar", "dharmender.verma@smartdukaan.com");
-
 
132
		nameEmail.put("Rajat", "rajat.gupta@smartdukaan.com");
-
 
133
		nameEmail.put("Ankit", "ankit.bhatia@smartdukaan.com");
-
 
134
		nameEmail.put("Rajit", "rajit.alag@smartdukaan.com");
-
 
135
		nameEmail.put("Gulshan", "gulshan.kumar@smartdukaan.com");
-
 
136
		nameEmail.put("VikasTripathi", "vikas.tripathi@smartdukaan.com");
-
 
137
		nameEmail.put("NitinKumar", "nitin.kumar@smartdukaan.com");
-
 
138
		nameEmail.put("DhirenderKumar", "dhirender.kumar@smartdukaan.com");
-
 
139
	}
-
 
140
 
122
 
141
	@RequestMapping(value = "/login", method = RequestMethod.GET)
123
	@RequestMapping(value = "/login", method = RequestMethod.GET)
142
	public String loginPage(HttpServletRequest request, HttpServletResponse response, Model model) throws Exception {
124
	public String loginPage(HttpServletRequest request, HttpServletResponse response, Model model) throws Exception {
143
		LOGGER.info("Context Path is {}", request.getContextPath());
125
		LOGGER.info("Context Path is {}", request.getContextPath());
144
		try {
126
		try {
Line 254... Line 236...
254
					AuthUser authUser = authRepository.selectByEmailOrMobile(emailIdOrMobileNumber);
236
					AuthUser authUser = authRepository.selectByEmailOrMobile(emailIdOrMobileNumber);
255
					if (authUser == null) {
237
					if (authUser == null) {
256
						throw new ProfitMandiBusinessException("Authentication", "Email or Mobile",
238
						throw new ProfitMandiBusinessException("Authentication", "Email or Mobile",
257
								"Invalid Email Or Mobile");
239
								"Invalid Email Or Mobile");
258
					}
240
					}
259
					emailId = authUser.getEmailId();
-
 
260
					if(nameEmail.values().contains(emailId)) {
-
 
261
						throw new ProfitMandiBusinessException("Authentication", "Unauthorised Access",
-
 
262
								"Access has been resticted");
-
 
263
					}
-
 
264
					name = authUser.getFirstName() + " " + authUser.getLastName();
241
					name = authUser.getFirstName() + " " + authUser.getLastName();
265
					authUser.setLastLoginTimestamp(LocalDateTime.now());
242
					authUser.setLastLoginTimestamp(LocalDateTime.now());
266
					authRepository.persist(authUser);
243
					authRepository.persist(authUser);
267
				}
244
				}
268
 
245