| Line 4... |
Line 4... |
| 4 |
|
4 |
|
| 5 |
import in.shop2020.model.v1.user.User;
|
5 |
import in.shop2020.model.v1.user.User;
|
| 6 |
import in.shop2020.model.v1.user.UserContextService.Client;
|
6 |
import in.shop2020.model.v1.user.UserContextService.Client;
|
| 7 |
import in.shop2020.serving.services.UserSessionInfo;
|
7 |
import in.shop2020.serving.services.UserSessionInfo;
|
| 8 |
import in.shop2020.serving.utils.DesEncrypter;
|
8 |
import in.shop2020.serving.utils.DesEncrypter;
|
| 9 |
import in.shop2020.thrift.clients.UserContextServiceClient;
|
9 |
import in.shop2020.thrift.clients.UserClient;
|
| 10 |
|
10 |
|
| 11 |
import javax.servlet.http.Cookie;
|
11 |
import javax.servlet.http.Cookie;
|
| 12 |
import javax.servlet.http.HttpServletRequest;
|
12 |
import javax.servlet.http.HttpServletRequest;
|
| 13 |
import javax.servlet.http.HttpServletResponse;
|
13 |
import javax.servlet.http.HttpServletResponse;
|
| 14 |
import javax.servlet.http.HttpSession;
|
14 |
import javax.servlet.http.HttpSession;
|
| Line 44... |
Line 44... |
| 44 |
UserSessionInfo userInfo = null;
|
44 |
UserSessionInfo userInfo = null;
|
| 45 |
Cookie userinfoCookie = cookiesMap.get(UserInterceptor.USER_INFO_COOKIE_NAME);
|
45 |
Cookie userinfoCookie = cookiesMap.get(UserInterceptor.USER_INFO_COOKIE_NAME);
|
| 46 |
//FIXME Remove the if part once we are done with solving the side effected of deleting anonymous users.
|
46 |
//FIXME Remove the if part once we are done with solving the side effected of deleting anonymous users.
|
| 47 |
if(userinfoCookie!=null){
|
47 |
if(userinfoCookie!=null){
|
| 48 |
userInfo = UserSessionInfo.getUserSessionInfoFromCookieValue(userinfoCookie.getValue());
|
48 |
userInfo = UserSessionInfo.getUserSessionInfoFromCookieValue(userinfoCookie.getValue());
|
| 49 |
UserContextServiceClient ucsc = new UserContextServiceClient();
|
49 |
UserClient ucsc = new UserClient();
|
| 50 |
Client userClient = ucsc.getClient();
|
50 |
Client userClient = ucsc.getClient();
|
| 51 |
User existingUser = userClient.getUserById(userInfo.getUserId());
|
51 |
User existingUser = userClient.getUserById(userInfo.getUserId());
|
| 52 |
if(existingUser == null || existingUser.getUserId() == -1){
|
52 |
if(existingUser == null || existingUser.getUserId() == -1){
|
| 53 |
userInfo = new UserSessionInfo(session.getId());
|
53 |
userInfo = new UserSessionInfo(session.getId());
|
| 54 |
request.setAttribute(UserInterceptor.USER_INFO_COOKIE_NAME, userInfo);
|
54 |
request.setAttribute(UserInterceptor.USER_INFO_COOKIE_NAME, userInfo);
|