Subversion Repositories SmartDukaan

Rev

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

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