end
else
# Existing record
- successful_authentication(user)
+ if user.active?
+ successful_authentication(user)
+ else
+ account_pending
+ end
end
end
end
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
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'