Commit cfd9a0c6 authored by Maxym Borodenko's avatar Maxym Borodenko

Handle successful login only for users

parent cd99afd5
......@@ -65,6 +65,8 @@ public class AuthenticationSuccessListener implements ApplicationListener<Authen
LOG.info("Successful login attempt for username={} from IP={}", userName, wad.getRemoteAddress());
}
lockoutManager.handleSuccessfulLogin(userName);
if (principal instanceof BasicUser<?>) {
lockoutManager.handleSuccessfulLogin(userName);
}
}
}
......@@ -359,6 +359,10 @@ public abstract class BasicUserServiceImpl<R extends GrantedAuthority, T extends
@Transactional
public void updateLastLogin(String userName) throws NoUserFoundException {
T u = getUserByEmail(userName);
if (u == null) {
throw new NoUserFoundException("No such user.");
}
u.setLastLogin(new Date());
// Set account to expire 1 year after last login
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment