Subversion Repositories SmartDukaan

Rev

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

Rev 2907 Rev 2935
Line 147... Line 147...
147
			if(uidString != null){
147
			if(uidString != null){
148
				try {
148
				try {
149
					Long receivedUID = Long.parseLong(desEncrypter.decrypt(uidString));
149
					Long receivedUID = Long.parseLong(desEncrypter.decrypt(uidString));
150
                    log.info("Invalid session with user cookie : " + receivedUID);
150
                    log.info("Invalid session with user cookie : " + receivedUID);
151
					userInfo = new UserSessionInfo(receivedUID, session.getId());
151
					userInfo = new UserSessionInfo(receivedUID, session.getId());
-
 
152
					if(userInfo.getUserId() == -1){
-
 
153
					    log.error("The User for the UID cookie has been deleted in our database. So cleaning up the UID cookie.");
-
 
154
					    expireUidCookie();
-
 
155
					}
152
				} catch (NumberFormatException nfe) {
156
				} catch (NumberFormatException nfe) {
153
					log.error("The UID cookie contains an unparseable userID");
157
					log.error("The UID cookie contains an unparseable userID");
154
					Cookie newUserCookie = new Cookie(UserInterceptor.USER_ID_COOKIE_NAME, "-1"); //The value here is immaterial
-
 
155
					newUserCookie.setMaxAge(0);                     // Expire this cookie now
-
 
156
					newUserCookie.setPath("/");
-
 
157
					newUserCookie.setDomain(cookieDomain);
-
 
158
					
-
 
159
					HttpServletResponse response = ServletActionContext.getResponse();
-
 
160
					response.addCookie(newUserCookie);
158
					expireUidCookie();
161
					
-
 
162
					userInfo = new UserSessionInfo();
159
					userInfo = new UserSessionInfo();
163
				}
160
				}
164
			}
161
			}
165
		}
162
		}
166
		else{
163
		else{
Line 168... Line 165...
168
			log.info("Invalid session without user cookie.");
165
			log.info("Invalid session without user cookie.");
169
		}
166
		}
170
		return userInfo;
167
		return userInfo;
171
	}
168
	}
172
 
169
 
-
 
170
    private void expireUidCookie() {
-
 
171
        Cookie newUserCookie = new Cookie(UserInterceptor.USER_ID_COOKIE_NAME, "-1"); //The value here is immaterial
-
 
172
        newUserCookie.setMaxAge(0);                     // Expire this cookie now
-
 
173
        newUserCookie.setPath("/");
-
 
174
        newUserCookie.setDomain(cookieDomain);
-
 
175
        
-
 
176
        HttpServletResponse response = ServletActionContext.getResponse();
-
 
177
        response.addCookie(newUserCookie);
-
 
178
    }
-
 
179
 
173
}
180
}
174
181