OpenID register on login (authlogic_openid)

Posted by Glex on Stack Overflow See other posts from Stack Overflow or by Glex
Published on 2010-03-07T18:00:31Z Indexed on 2010/03/27 22:23 UTC
Read the original article Hit count: 403

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).

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about openid