I have an existing site that is working well with Authlogic login.
I'm trying to add Facebook login as an option, using the authlogic_facebook_connect plugin, but it's not working properly.
I'm following the instructions located here: http://github.com/jbasdf/authlogic_facebook_connect
On my registration form, I added the Facebook connect button using the procedure outlined, and when it is clicked, it is successfully posting to the form with the authenticity_token of the user, and nothing else, which I believe is the intended result. The controller code is extremely simple:
@new_user = User.new(params[:user])
@new_user.save
In my User model, I added the following before_connect method, which is never being called:
def before_connect(facebook_session)
self.email = facebook_session.user.email
reset_persistence_token
end
I know this is not being called, because even if I add a line like raise "Error'
to before_connect no error is occurring.
The actual save is failing, because of a number of authlogic's own internal validations. I'm getting:
- Email is too short (minimum is 6 characters)
- Email should look like an email address.
- Password is too short (minimum is 4 characters)
- Password confirmation is too short (minimum is 4 characters)
Of course these are all empty, because nothing is being posted, and no password is even expected. I assume Authlogic is running the password tests because I have a password field in the database, which I need to keep to get regular logins to work.
What am I doing wrong here?