| Line 54... |
Line 54... |
| 54 |
}
|
54 |
}
|
| 55 |
|
55 |
|
| 56 |
public String create() throws SecurityException, Exception {
|
56 |
public String create() throws SecurityException, Exception {
|
| 57 |
if (loginUser()) {
|
57 |
if (loginUser()) {
|
| 58 |
log.info(redirectUrl);
|
58 |
log.info(redirectUrl);
|
| 59 |
DataLogger.logData(EventType.LOGIN_SUCCESS, session.getId(), userinfo.getUserId(),
|
- |
|
| 60 |
this.request.getParameter("email"));
|
- |
|
| 61 |
return "redirect";
|
59 |
return "redirect";
|
| 62 |
} else {
|
60 |
} else {
|
| 63 |
addActionError(UserMessage.USER_AUTHENTICATION_FAILURE);
|
61 |
addActionError(UserMessage.USER_AUTHENTICATION_FAILURE);
|
| 64 |
DataLogger.logData(EventType.LOGIN_FAILED, session.getId(), userinfo.getUserId(), this.request.getParameter("email"));
|
62 |
DataLogger.logData(EventType.LOGIN_FAILED, session.getId(), userinfo.getUserId(), this.request.getParameter("email"));
|
| 65 |
return "login";
|
63 |
return "login";
|
| 66 |
}
|
64 |
}
|
| Line 82... |
Line 80... |
| 82 |
UserContextServiceClient userContextServiceClient = new UserContextServiceClient();
|
80 |
UserContextServiceClient userContextServiceClient = new UserContextServiceClient();
|
| 83 |
in.shop2020.model.v1.user.UserContextService.Client userClient = userContextServiceClient.getClient();
|
81 |
in.shop2020.model.v1.user.UserContextService.Client userClient = userContextServiceClient.getClient();
|
| 84 |
User user = userClient.authenticateUser(email, encryptedPassword);
|
82 |
User user = userClient.authenticateUser(email, encryptedPassword);
|
| 85 |
userClient.setUserAsLoggedIn(user.getUserId(),(new Date()).getTime());
|
83 |
userClient.setUserAsLoggedIn(user.getUserId(),(new Date()).getTime());
|
| 86 |
String pincode = userClient.getDefaultPincode(user.getUserId());
|
84 |
String pincode = userClient.getDefaultPincode(user.getUserId());
|
| 87 |
|
85 |
|
| 88 |
// TODO: setTotalItems shouldn't be a method on userinfo. This allows
|
86 |
// TODO: setTotalItems shouldn't be a method on userinfo. This allows
|
| 89 |
// for potentially updating the item count wrongly. The method setCartId
|
87 |
// for potentially updating the item count wrongly. The method setCartId
|
| 90 |
// should update the item count as well. Also, there can be a method
|
88 |
// should update the item count as well. Also, there can be a method
|
| 91 |
// called refreshItemCount() that automatically updates the number of
|
89 |
// called refreshItemCount() that automatically updates the number of
|
| 92 |
// items currently in the cart.
|
90 |
// items currently in the cart.
|
| Line 122... |
Line 120... |
| 122 |
userinfo.setPincode(pincode);
|
120 |
userinfo.setPincode(pincode);
|
| 123 |
userinfo.setCartId(user.getActiveCartId());
|
121 |
userinfo.setCartId(user.getActiveCartId());
|
| 124 |
int totalItems = userClient.getCart(user.getActiveCartId()).getLinesSize();
|
122 |
int totalItems = userClient.getCart(user.getActiveCartId()).getLinesSize();
|
| 125 |
userinfo.setTotalItems(totalItems);
|
123 |
userinfo.setTotalItems(totalItems);
|
| 126 |
System.out.println(userinfo);
|
124 |
System.out.println(userinfo);
|
| - |
|
125 |
DataLogger.logData(EventType.LOGIN_SUCCESS, session.getId(), userinfo.getUserId(),
|
| - |
|
126 |
this.request.getParameter("email"), user.getSource());
|
| 127 |
return true;
|
127 |
return true;
|
| 128 |
} catch (Exception e) {
|
128 |
} catch (Exception e) {
|
| 129 |
log.error(UserMessage.USER_AUTHENTICATION_FAILURE);
|
129 |
log.error(UserMessage.USER_AUTHENTICATION_FAILURE);
|
| 130 |
return false;
|
130 |
return false;
|
| 131 |
}
|
131 |
}
|
| 132 |
}
|
132 |
}
|