title: Spring user account enabled/disabled
body: <p>I'm trying to see if a user who's trying to login has an enabled or disabled account, to do this I have a field in my <code>User</code> domain called <code>active</code> which is set to true if a user is enabled and vice versa.</p>
  
  <p>In my CustomUserDetailsService I have the following to see if a user who's logging in can log in:</p>
  
  <pre><code>public UserDetails loadUserByUsername(String login)
          throws UsernameNotFoundException {
  
      AdeyTrack.domain.User domainUser = userRepo.findByLogin(login);
  
      boolean enabled = domainUser.getActive(); // checking here if enabled
      boolean accountNonExpired = true;
      boolean credentialsNonExpired = true;
      boolean accountNonLocked = true;
  
      return new User(
              domainUser.getLogin(),
              domainUser.getPassword(),
              enabled,
              accountNonExpired, 
              credentialsNonExpired, 
              accountNonLocked,
              getAuthorities(domainUser.getRoles())
      );
  }
  </code></pre>
  
  <p>This works.</p>
  
  <p>I have two questions:  </p>
  
  <ol>
  <li>Am I doing this in the correct way?  </li>
  <li>At the moment if a user who is logging in has a disabled account, just gets a "incorrect username/password" error, can I do anything so that I can make a callback which informs the user that their account is disabled?</li>
  </ol>
  
  <p>Thanks.</p>