| Line 1... |
Line 1... |
| 1 |
package com.spice.profitmandi.web.controller;
|
1 |
package com.spice.profitmandi.web.controller;
|
| 2 |
|
2 |
|
| 3 |
import java.lang.reflect.Type;
|
3 |
import java.lang.reflect.Type;
|
| 4 |
import java.time.LocalDateTime;
|
4 |
import java.time.LocalDateTime;
|
| 5 |
import java.time.ZoneOffset;
|
- |
|
| 6 |
import java.util.ArrayList;
|
5 |
import java.util.ArrayList;
|
| 7 |
import java.util.Arrays;
|
6 |
import java.util.Arrays;
|
| 8 |
import java.util.HashMap;
|
7 |
import java.util.HashMap;
|
| 9 |
import java.util.HashSet;
|
8 |
import java.util.HashSet;
|
| 10 |
import java.util.List;
|
9 |
import java.util.List;
|
| Line 136... |
Line 135... |
| 136 |
nameEmail.put("Gulshan", "gulshan.kumar@smartdukaan.com");
|
135 |
nameEmail.put("Gulshan", "gulshan.kumar@smartdukaan.com");
|
| 137 |
nameEmail.put("PramodSharma", "parmod.sharma@smartdukaan.com");
|
136 |
nameEmail.put("PramodSharma", "parmod.sharma@smartdukaan.com");
|
| 138 |
}
|
137 |
}
|
| 139 |
|
138 |
|
| 140 |
@RequestMapping(value = "/login", method = RequestMethod.GET)
|
139 |
@RequestMapping(value = "/login", method = RequestMethod.GET)
|
| 141 |
public String loginPage(HttpServletRequest request, Model model) throws Exception {
|
140 |
public String loginPage(HttpServletRequest request, HttpServletResponse response, Model model) throws Exception {
|
| 142 |
LOGGER.info("Context Path is {}", request.getContextPath());
|
141 |
LOGGER.info("Context Path is {}", request.getContextPath());
|
| 143 |
try {
|
142 |
try {
|
| 144 |
LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
|
143 |
LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
|
| 145 |
LOGGER.info("Request session is already exist, should be redirect to as per roles assigned");
|
144 |
LOGGER.info("Request session is already exist, should be redirect to as per roles assigned");
|
| 146 |
String redirectUrl = null;
|
145 |
String redirectUrl = null;
|
| 147 |
|
146 |
|
| 148 |
Role roleRetailer = roleRepository.selectByName(RoleType.RETAILER.toString());
|
147 |
Role roleRetailer = roleRepository.selectByName(RoleType.RETAILER.toString());
|
| 149 |
Role roleFofo = roleRepository.selectByName(RoleType.RETAILER.toString());
|
148 |
Role roleFofo = roleRepository.selectByName(RoleType.RETAILER.toString());
|
| - |
|
149 |
FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoDetails.getFofoId());
|
| - |
|
150 |
if(!fofoStore.isActive()) {
|
| - |
|
151 |
cookiesProcessor.removeCookies(request, response);
|
| - |
|
152 |
throw new ProfitMandiBusinessException("", "", "");
|
| - |
|
153 |
}
|
| 150 |
Role roleFofoAdmin = roleRepository.selectByName(RoleType.RETAILER.toString());
|
154 |
Role roleFofoAdmin = roleRepository.selectByName(RoleType.RETAILER.toString());
|
| 151 |
if ((fofoDetails.getRoleIds().contains(roleRetailer.getId())
|
155 |
if ((fofoDetails.getRoleIds().contains(roleRetailer.getId())
|
| 152 |
&& fofoDetails.getRoleIds().contains(roleFofo.getId())
|
156 |
&& fofoDetails.getRoleIds().contains(roleFofo.getId())
|
| 153 |
|| (fofoDetails.getRoleIds().contains(roleFofoAdmin.getId())))) {
|
157 |
|| (fofoDetails.getRoleIds().contains(roleFofoAdmin.getId())))) {
|
| 154 |
redirectUrl = "/dashboard";
|
158 |
redirectUrl = "/dashboard";
|