Skip to content

Commit

Permalink
LPS-108642 SF simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Sierra Andrés authored and brianchandotcom committed Mar 13, 2020
1 parent 8f072ee commit 9fe453b
Showing 1 changed file with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4808,7 +4808,7 @@ public User updatePassword(
null, ServiceContextThreadLocal.getServiceContext());
}

_invalidateTicket(user.getCompanyId(), User.class.getName(), userId);
_invalidateTicket(user);

return user;
}
Expand Down Expand Up @@ -4843,7 +4843,7 @@ public User updatePasswordManually(

user = userPersistence.update(user);

_invalidateTicket(user.getCompanyId(), User.class.getName(), userId);
_invalidateTicket(user);

return user;
}
Expand Down Expand Up @@ -6896,19 +6896,17 @@ private String _getLocalizedValue(
return localizedValueMap.get(fallbackLocale);
}

private void _invalidateTicket(
long companyId, String className, long classPK)
throws PortalException {

private void _invalidateTicket(User user) throws PortalException {
List<Ticket> tickets = ticketLocalService.getTickets(
companyId, className, classPK, TicketConstants.TYPE_PASSWORD);
user.getCompanyId(), User.class.getName(), user.getUserId(),
TicketConstants.TYPE_PASSWORD);

for (Ticket ticket : tickets) {
if (!ticket.isExpired()) {
ticketLocalService.updateTicket(
ticket.getTicketId(), className, classPK,
TicketConstants.TYPE_PASSWORD, ticket.getExtraInfo(),
new Date());
ticket.getTicketId(), User.class.getName(),
user.getUserId(), TicketConstants.TYPE_PASSWORD,
ticket.getExtraInfo(), new Date());
}
}
}
Expand Down

0 comments on commit 9fe453b

Please sign in to comment.