| Line 207... |
Line 207... |
| 207 |
.collect(Collectors.toSet());
|
207 |
.collect(Collectors.toSet());
|
| 208 |
LoginDetails newFofoDetails = new LoginDetails();
|
208 |
LoginDetails newFofoDetails = new LoginDetails();
|
| 209 |
newFofoDetails.setFofoId(fofoId);
|
209 |
newFofoDetails.setFofoId(fofoId);
|
| 210 |
newFofoDetails.setRoleIds(roleIds);
|
210 |
newFofoDetails.setRoleIds(roleIds);
|
| 211 |
newFofoDetails.setEmailId(user.getEmailId());
|
211 |
newFofoDetails.setEmailId(user.getEmailId());
|
| 212 |
model.addAttribute("response", true);
|
212 |
model.addAttribute("response1", true);
|
| 213 |
this.addCookiesToResponse(newFofoDetails, request, response);
|
213 |
this.addCookiesToResponse(newFofoDetails, request, response);
|
| 214 |
} else {
|
214 |
} else {
|
| 215 |
throw new ProfitMandiBusinessException("", "", "");
|
215 |
throw new ProfitMandiBusinessException("", "", "");
|
| 216 |
}
|
216 |
}
|
| 217 |
return "response";
|
217 |
return "response";
|
| Line 229... |
Line 229... |
| 229 |
LoginDetails newFofoDetails = new LoginDetails();
|
229 |
LoginDetails newFofoDetails = new LoginDetails();
|
| 230 |
newFofoDetails.setFofoId(fofoId);
|
230 |
newFofoDetails.setFofoId(fofoId);
|
| 231 |
newFofoDetails.setRoleIds(roleIds);
|
231 |
newFofoDetails.setRoleIds(roleIds);
|
| 232 |
newFofoDetails.setEmailId(user.getEmailId());
|
232 |
newFofoDetails.setEmailId(user.getEmailId());
|
| 233 |
newFofoDetails.setReadOnly(true);
|
233 |
newFofoDetails.setReadOnly(true);
|
| 234 |
model.addAttribute("response", true);
|
234 |
model.addAttribute("response1", true);
|
| 235 |
this.addCookiesToResponse(newFofoDetails, request, response);
|
235 |
this.addCookiesToResponse(newFofoDetails, request, response);
|
| 236 |
} else {
|
236 |
} else {
|
| 237 |
throw new ProfitMandiBusinessException("", "", "");
|
237 |
throw new ProfitMandiBusinessException("", "", "");
|
| 238 |
}
|
238 |
}
|
| 239 |
return "response";
|
239 |
return "response";
|
| Line 286... |
Line 286... |
| 286 |
if (user == null) {
|
286 |
if (user == null) {
|
| 287 |
try {
|
287 |
try {
|
| 288 |
user = userRepository.selectBySecondryEmailId(emailId);
|
288 |
user = userRepository.selectBySecondryEmailId(emailId);
|
| 289 |
} catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
289 |
} catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
| 290 |
LOGGER.error("User not found with given emailId", profitMandiBusinessException);
|
290 |
LOGGER.error("User not found with given emailId", profitMandiBusinessException);
|
| 291 |
model.addAttribute("response", mvcResponseSender.createResponseString("RTLR_OK_1002", true,
|
291 |
model.addAttribute("response1", mvcResponseSender.createResponseString("RTLR_OK_1002", true,
|
| 292 |
request.getContextPath() + "/login", "Email"));
|
292 |
request.getContextPath() + "/login", "Email"));
|
| 293 |
return "response";
|
293 |
return "response";
|
| 294 |
}
|
294 |
}
|
| 295 |
}
|
295 |
}
|
| 296 |
if (user != null) {
|
296 |
if (user != null) {
|
| Line 331... |
Line 331... |
| 331 |
if (redirectUrl.equals("/dashboard")) {
|
331 |
if (redirectUrl.equals("/dashboard")) {
|
| 332 |
user.setLoginTimestamp(LocalDateTime.now());
|
332 |
user.setLoginTimestamp(LocalDateTime.now());
|
| 333 |
this.addCookiesToResponse(fofoDetails, request, response);
|
333 |
this.addCookiesToResponse(fofoDetails, request, response);
|
| 334 |
LOGGER.info("Requested token email_id is valid, user login to system, shoud be redirect to {}",
|
334 |
LOGGER.info("Requested token email_id is valid, user login to system, shoud be redirect to {}",
|
| 335 |
redirectUrl);
|
335 |
redirectUrl);
|
| 336 |
model.addAttribute("response", mvcResponseSender.createResponseString("RTLR_OK_1002", true,
|
336 |
model.addAttribute("response1", mvcResponseSender.createResponseString("RTLR_OK_1002", true,
|
| 337 |
request.getContextPath() + redirectUrl, name));
|
337 |
request.getContextPath() + redirectUrl, name));
|
| 338 |
} else {
|
338 |
} else {
|
| 339 |
LOGGER.error("Requested token email_id is not valid, please try to login");
|
339 |
LOGGER.error("Requested token email_id is not valid, please try to login");
|
| 340 |
/**
|
340 |
/**
|
| 341 |
* TODO:Amit This redirect should be handle.
|
341 |
* TODO:Amit This redirect should be handle.
|
| Line 344... |
Line 344... |
| 344 |
"RTLR_1000");
|
344 |
"RTLR_1000");
|
| 345 |
}
|
345 |
}
|
| 346 |
return "response";
|
346 |
return "response";
|
| 347 |
} catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
347 |
} catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
| 348 |
LOGGER.error("Error : ", profitMandiBusinessException);
|
348 |
LOGGER.error("Error : ", profitMandiBusinessException);
|
| 349 |
model.addAttribute("response",
|
349 |
model.addAttribute("response1",
|
| 350 |
mvcResponseSender.createResponseString(profitMandiBusinessException.getCode(), false, "/error"));
|
350 |
mvcResponseSender.createResponseString(profitMandiBusinessException.getCode(), false, "/error"));
|
| 351 |
return "response";
|
351 |
return "response";
|
| 352 |
} catch (Exception e) {
|
352 |
} catch (Exception e) {
|
| 353 |
e.printStackTrace();
|
353 |
e.printStackTrace();
|
| 354 |
model.addAttribute("response",
|
354 |
model.addAttribute("response1",
|
| 355 |
mvcResponseSender.createResponseString(
|
355 |
mvcResponseSender.createResponseString(
|
| 356 |
"You are not authorised! " + "Please contact the team if you feel this is incorrect", false,
|
356 |
"You are not authorised! " + "Please contact the team if you feel this is incorrect", false,
|
| 357 |
"/error"));
|
357 |
"/error"));
|
| 358 |
return "response";
|
358 |
return "response";
|
| 359 |
}
|
359 |
}
|
| Line 363... |
Line 363... |
| 363 |
public String forgetPasswordPage(
|
363 |
public String forgetPasswordPage(
|
| 364 |
@RequestParam(name = ProfitMandiConstants.EMAIL_ID, defaultValue = "") String emailId, Model model)
|
364 |
@RequestParam(name = ProfitMandiConstants.EMAIL_ID, defaultValue = "") String emailId, Model model)
|
| 365 |
throws Exception {
|
365 |
throws Exception {
|
| 366 |
LOGGER.info(emailId);
|
366 |
LOGGER.info(emailId);
|
| 367 |
authService.resetPassword(emailId);
|
367 |
authService.resetPassword(emailId);
|
| 368 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
368 |
model.addAttribute("response1", mvcResponseSender.createResponseString(true));
|
| 369 |
LOGGER.info("completed");
|
369 |
LOGGER.info("completed");
|
| 370 |
return "response";
|
370 |
return "response";
|
| 371 |
}
|
371 |
}
|
| 372 |
|
372 |
|
| 373 |
private void addCookiesToResponse(LoginDetails fofoDetails, HttpServletRequest request,
|
373 |
private void addCookiesToResponse(LoginDetails fofoDetails, HttpServletRequest request,
|
| Line 434... |
Line 434... |
| 434 |
if (fs.getLatitude() == null) {
|
434 |
if (fs.getLatitude() == null) {
|
| 435 |
fs.setLatitude(location.getLatitude());
|
435 |
fs.setLatitude(location.getLatitude());
|
| 436 |
fs.setLongitude(location.getLongitude());
|
436 |
fs.setLongitude(location.getLongitude());
|
| 437 |
fofoStoreRepository.persist(fs);
|
437 |
fofoStoreRepository.persist(fs);
|
| 438 |
}
|
438 |
}
|
| 439 |
model.addAttribute("response", response);
|
439 |
model.addAttribute("response1", response);
|
| 440 |
} catch (Exception e) {
|
440 |
} catch (Exception e) {
|
| 441 |
LOGGER.error("FofoStore Code not found of fofoId {}", loginDetails.getFofoId());
|
441 |
LOGGER.error("FofoStore Code not found of fofoId {}", loginDetails.getFofoId());
|
| 442 |
}
|
442 |
}
|
| 443 |
return "response";
|
443 |
return "response";
|
| 444 |
}
|
444 |
}
|