| Line 72... |
Line 72... |
| 72 |
@Autowired
|
72 |
@Autowired
|
| 73 |
private UserAccountRepository userAccountRepository;
|
73 |
private UserAccountRepository userAccountRepository;
|
| 74 |
|
74 |
|
| 75 |
@Autowired
|
75 |
@Autowired
|
| 76 |
private RestClient restClient;
|
76 |
private RestClient restClient;
|
| - |
|
77 |
|
| 77 |
|
78 |
|
| 78 |
public Map<String, Object> process(GoogleLoginRequest googleLoginRequest) throws ProfitMandiBusinessException {
|
79 |
public Map<String, Object> process(GoogleLoginRequest googleLoginRequest) throws ProfitMandiBusinessException {
|
| 79 |
LOGGER.info("1");
|
80 |
LOGGER.info("1");
|
| 80 |
Map<String, String> params = new HashMap<>();
|
81 |
Map<String, String> params = new HashMap<>();
|
| 81 |
params.put(ProfitMandiConstants.ACCESS_TOKEN, googleLoginRequest.getToken());
|
82 |
params.put(ProfitMandiConstants.ACCESS_TOKEN, googleLoginRequest.getToken());
|
| 82 |
Map<String, String> headers = new HashMap<>(1);
|
83 |
Map<String, String> headers = new HashMap<>(1);
|
| Line 95... |
Line 96... |
| 95 |
if (emails.isArray()) {
|
96 |
if (emails.isArray()) {
|
| 96 |
Iterator<JsonNode> emailsIterator = emails.elements();
|
97 |
Iterator<JsonNode> emailsIterator = emails.elements();
|
| 97 |
if (emailsIterator.hasNext()) {
|
98 |
if (emailsIterator.hasNext()) {
|
| 98 |
JsonNode email = emailsIterator.next();
|
99 |
JsonNode email = emailsIterator.next();
|
| 99 |
if (email.has("value")) {
|
100 |
if (email.has("value")) {
|
| - |
|
101 |
if(ProfitMandiConstants.BLOCKED_EMAILS.contains(email.get("value").asText())) {
|
| - |
|
102 |
throw new ProfitMandiBusinessException("User Account", email.get("value").asText(), "User is temporarily suspended.");
|
| - |
|
103 |
}
|
| 100 |
socialUser.setEmailId(email.get("value").asText());
|
104 |
socialUser.setEmailId(email.get("value").asText());
|
| 101 |
}
|
105 |
}
|
| 102 |
}
|
106 |
}
|
| 103 |
}
|
107 |
}
|
| 104 |
// socialUser.setEmailId(rootNode.get("email").asText());
|
108 |
// socialUser.setEmailId(rootNode.get("email").asText());
|
| Line 167... |
Line 171... |
| 167 |
user = userRepository.selectByEmailId(socialUser.getEmailId());
|
171 |
user = userRepository.selectByEmailId(socialUser.getEmailId());
|
| 168 |
} catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
172 |
} catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
| 169 |
responseMap.put(ProfitMandiConstants.TOKEN, JWTUtil.create(socialUser.getEmailId()));
|
173 |
responseMap.put(ProfitMandiConstants.TOKEN, JWTUtil.create(socialUser.getEmailId()));
|
| 170 |
responseMap.put(ProfitMandiConstants.REGISTERED, false);
|
174 |
responseMap.put(ProfitMandiConstants.REGISTERED, false);
|
| 171 |
}
|
175 |
}
|
| 172 |
}
|
176 |
} else {
|
| 173 |
if (user != null) {
|
- |
|
| 174 |
// Set<Role> roles = user.getRoles();
|
- |
|
| 175 |
List<Integer> roleIds = userRoleRepository.selectRoleIdsByUserId(user.getId());
|
177 |
List<Integer> roleIds = userRoleRepository.selectRoleIdsByUserId(user.getId());
|
| 176 |
int retailerId = userAccountRepository.selectRetailerIdByUserId(user.getId());
|
178 |
int retailerId = userAccountRepository.selectRetailerIdByUserId(user.getId());
|
| 177 |
// Set<Role> roles = new HashSet<>();
|
- |
|
| 178 |
String[] roleTypes = new String[roleIds.size()];
|
179 |
String[] roleTypes = new String[roleIds.size()];
|
| 179 |
int index = 0;
|
180 |
int index = 0;
|
| 180 |
for (int roleId : roleIds) {
|
181 |
for (int roleId : roleIds) {
|
| 181 |
roleTypes[index++] = String.valueOf(roleId);
|
182 |
roleTypes[index++] = String.valueOf(roleId);
|
| 182 |
}
|
183 |
}
|