title: Devise - Rails 4 - Not able to login
body: <p>I just started using Rails 4. I got <code>devise</code> setup with custom fields. I'm able to login after I register, but I'm not able to login from the login page. The user registration goes in fine, and I have <code>username</code>, <code>password</code> etc in the database table. </p>
  
  <p>Can somebody tell me what I'm missing? My User model is very basic.
  Here is how it looks like -</p>
  
  <pre><code>class User &lt; ActiveRecord::Base
    # Include default devise modules. Others available are:
    # :token_authenticatable, :confirmable,
    # :lockable, :timeoutable and :omniauthable
    devise :database_authenticatable, :registerable,
           :recoverable, :rememberable, :trackable, :validatable
  
    validates :username, :uniqueness =&gt; true, :presence =&gt; {:message =&gt; '- Username cannot be blank'}
    validates :first_name, :presence =&gt; { :message =&gt; " - Firstname cannot be blank!"}    
  
    private
      def user_params
          params.require().permit(:first_name, :last_name, :username, :email, :password, :password_confirmation)
      end
  end
  </code></pre>
  
  <p>I've checked my view and I'm passing the right parameters. </p>
  
  <p>I have the following in my application controller -</p>
  
  <pre><code>class ApplicationController &lt; ActionController::Base
    # Prevent CSRF attacks by raising an exception.
    # For APIs, you may want to use :null_session instead.
    protect_from_forgery with: :exception
  
    layout :layout_by_resource
  
    before_filter :configure_permitted_params, if: :devise_controller?
  
    def layout_by_resource
      if devise_controller?
          "devise"
      else
          "application"       
      end
    end
  
    protected
  
    def configure_permitted_params
      devise_parameter_sanitizer.for(:sign_up) {|u| u.permit(:username, :first_name, :last_name, :password, :password_confirmation, :email) }
    end
  
  end
  </code></pre>
  
  <p>I checked the database table and I do have <code>username</code> and <code>password</code> (encrypted_password that is). I have my authentication keys set to <code>username</code>.</p>
  
  <p>Not sure what I'm missing here. I have <code>devise 3.0.0</code></p>