Permalink
Browse files

Fix the case where aMember pro seems to mistakenly auth users on thei…

…r email address
  • Loading branch information...
1 parent 13561ec commit 52bcde5cb7f8a14fbf5d65e794609daf1faa740f @meanphil committed Jul 15, 2012
Showing with 9 additions and 1 deletion.
  1. +9 −1 lib/omniauth/strategies/amember_pro.rb
@@ -25,8 +25,16 @@ def callback_phase
api = AmemberApiWrapper.new(options)
if api.login!(username, password)
+ # If the user logs in with their email address, aMember seems to
+ # think it's a valid login, but then we can't filter the user
+ # for their info. So if user_info returns nil in that event,
+ # just pretent it was the wrong username in the first place.
@raw_info = api.user_info
- super
+ if @raw_info.nil?
+ super
+ else
+ fail!(:invalid_credentials)
+ end
else
fail!(:invalid_credentials)
end

0 comments on commit 52bcde5

Please sign in to comment.