Hello people!
I'm asking for help to solve a little problem concerning the usage of
the openid_authentication plugin. I'm following the README file included
by DHH, so I wrote this method in my SessionsController:
def open_id_authentication(identity_url)
# Pass optional :required and :optional keys to specify what sreg
fields you want.
# Be sure to yield registration, a third argument in the
#authenticate_with_open_id block.
authenticate_with_open_id(identity_url,
:required => [ :nickname, :email ],
:optional => :fullname) do |status, identity_url,
registration>
logger.debug "Received status #{status.inspect}"
if (status === :successful)
logger.debug "We got a successful answer"
end
case status
when :missing
logger.debug "Missing!"
failed_login "Sorry, the OpenID server couldn't be found"
when :canceled
logger.debug "Canceled!"
failed_login "OpenID verification was canceled"
when :failed
logger.debug "Failed!"
failed_login "Sorry, the OpenID verification failed"
when :successful
logger.debug "Correct!"
if @current_user =
@account.users.find_by_identity_url(identity_url)
assign_registration_attributes!(registration)
if current_user.save
successful_login
else
failed_login "Your OpenID profile registration failed: " +
@current_user.errors.full_messages.to_sentence
end
else
failed_login "Sorry, no user by that identity URL exists"
end
else
logger.debug "Something other ..."
end
end
end
If you look at the logger.debug calls, you'll see that when we get a
successful response, the logger "should" print "We got a successful
answer" and then "Correct!". But, in fact, it prints "We got a
successful answer" and then "Something other ...". So, apparently, the
status === :successful comparison is true, but the case ... when
:successful test is false, even if this statement uses the === operator.
What's wrong in this code? I really can't figure out ... and I really
need some "expert" help.
Thank you!
-daniele-