Fixed a bug in the OpenID login when a user signed up with OpenID but hasn't

been activated yet.

When logging in the user would come back to the login page with the back_url
of My Page.  This was caused by open_id_authenticate sending the user to My Page
and My Page redirecting the user back to the login page because they haven't
been activated.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2482 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Eric Davis 2009-02-20 00:16:45 +00:00
parent 9525e5f147
commit aed1787d51
2 changed files with 26 additions and 3 deletions

View File

@ -209,7 +209,11 @@ private
end
else
# Existing record
successful_authentication(user)
if user.active?
successful_authentication(user)
else
account_pending
end
end
end
end
@ -269,10 +273,14 @@ private
if user.save
# Sends an email to the administrators
Mailer.deliver_account_activation_request(user)
flash[:notice] = l(:notice_account_pending)
redirect_to :action => 'login'
account_pending
else
yield if block_given?
end
end
def account_pending
flash[:notice] = l(:notice_account_pending)
redirect_to :action => 'login'
end
end

View File

@ -80,6 +80,21 @@ class AccountControllerTest < Test::Unit::TestCase
assert_redirected_to 'my/page'
end
def test_login_with_openid_for_existing_non_active_user
Setting.self_registration = '2'
Setting.openid = '1'
existing_user = User.new(:firstname => 'Cool',
:lastname => 'User',
:mail => 'user@somedomain.com',
:identity_url => 'http://openid.example.com/good_user',
:status => User::STATUS_REGISTERED)
existing_user.login = 'cool_user'
assert existing_user.save!
post :login, :openid_url => existing_user.identity_url
assert_redirected_to 'login'
end
def test_login_with_openid_with_new_user_created
Setting.self_registration = '3'
Setting.openid = '1'