title: Devise Omniauth "encrypted_password may not be NULL" for new user
body: <p>I am using Devise with Omniauth to have users sign into my app with Facebook. I used the Railscast tutorials to get it up and running. </p>
  
  <p>If a user is already a member of my site authenticating through facebook works fine. The problem comes in when authenticating a new user with facebook. When it goes to create a new user for my User model I get the "users.encrypted_password may not be NULL" error. I can't figure out how to pass over the password to the User model from Facebook information.</p>
  
  <p>This is what I have:</p>
  
  <p>authentations_controller.rb</p>
  
  <pre><code>class AuthenticationsController &lt; ApplicationController
   def index
    @authentications = current_user.authentications if current_user
   end
  
  def create
    omniauth = request.env["omniauth.auth"]
    authentication = Authentication.find_by_provider_and_uid(omniauth['provider'],   omniauth['uid'])
   if authentication
     flash[:notice] = "Signed in successfully."
     sign_in_and_redirect(:user, authentication.user)
   elsif current_user
     current_user.authentications.create!(:provider =&gt; omniauth['provider'], :uid =&gt; omniauth['uid'])
     flash[:notice] = "Authentication successful."
     redirect_to authentications_url
   else
     user = User.new
     user.apply_omniauth(omniauth)
     if user.save
       flash[:notice] = "Signed in successfully."
       sign_in_and_redirect(:user, user)
     else
       session[:omniauth] = omniauth.except('extra')
       redirect_to new_user_registration_url
     end
    end
  end
  </code></pre>
  
  <p>user.rb</p>
  
  <pre><code> def apply_omniauth(omniauth)
    self.email = omniauth['user_info']['email'] if email.blank?
    authentications.build(:provider =&gt; omniauth['provider'], :uid =&gt; omniauth['uid'])
   end
  
  
   def password_required?
     (authentications.empty? || !password.blank?) &amp;&amp; super
   end
  </code></pre>
  
  <p>Any help would be great, thanks in advance!</p>