added sanity check for non-existent or empty last-login value

This commit is contained in:
Michael Ströder 2021-02-23 01:37:18 +01:00
parent 8b5f3fe967
commit b0671c4d4c

View file

@ -40,7 +40,9 @@ public class LastLoginEventListenerProvider implements EventListenerProvider {
Map<String, List<String>> userAttrs = user.getAttributes();
if (userAttrs.containsKey("last-login")) {
String userLastLogin = userAttrs.get("last-login").get(0);
user.setSingleAttribute("prior-login", userLastLogin);
if (userLastLogin != null && !userLastLogin.isEmpty()) {
user.setSingleAttribute("prior-login", userLastLogin);
}
}
// Use current server time for login event