@Override
public UserDetails loadUserByUsername(String email)
throws UsernameNotFoundException {
try{
Affiliate affiliate = userService.getAffiliateByEmail(email);
if(affiliate==null) throw new EmptyResultDataAccessException(1);
CartUserDetails userDetails = new CartUserDetails();
userDetails.userId = affiliate.getId();
userDetails.salt = affiliate.getSalt();
userDetails.password = affiliate.getPassword();
userDetails.username = affiliate.getEmail();
userDetails.enabled = affiliate.getStatus()==1;
logger.debug("Found user email={}, enabled={}", email, userDetails.enabled);
return userDetails;