title: Check if user is active before allowing user to sign in with devise (rails)
body: <p>I am using devise and created a User field called :active which is either true or false.  I have to manually make the user active (true) before the user is allowed to log in. At least that is the intent.  I have tried this...</p>
  
  <pre><code>class SessionsController &lt; Devise::SessionsController
    # POST /resource/sign_in
    def create
      "resource/signin CREATE"
      self.resource = warden.authenticate!(auth_options)
      unless resource.active?
        sign_out
        redirect_to :sorry_not_active_url
        return
      end
      set_flash_message(:notice, :signed_in) if is_navigational_format?
      sign_in(resource_name, resource)
      respond_with resource, :location =&gt; after_sign_in_path_for(resource)
    end  
  end
  </code></pre>
  
  <p>However this does not catch all the places where a user can log in, for example, when a user changes their password, the site automatically logs them in automatically after. However, if the user is not active, I do not want them to be allowed to log in, but rather be redirected to a sorry_not_active_url.</p>
  
  <p>What would be the best way to prevent the user from signing in if the user is not active?</p>
  
  <p>Thank you.</p>