views:

55

answers:

1

What is the proper way to register users automatically when they log in with openid?

I am using authlogic with an authlogic-oid gem (and an older version of openid_authentication). The stuff I read online so far seems to be obsolete.

Does anyone know the proper way to do it with the new gem?

What I do now is:

options = params[:user_session] || {}
[:openid_identifier].each { |k| options[k] = params[k] if params[k] }

@user_session = UserSession.new(options)
@user_session.save do |result|
  if result
    flash[:notice] = "Login successful! (#{result.inspect})"
    redirect_back_or_default account_url        
  else
    render :action => :new
  end
end

By the way, I don't see the Login Successful flash (but that is not that big of a deal).

A: 

Here is a version with working auto_register http://github.com/mreinsch/authlogic_openid/tree/master

glebm