]> source.dussan.org Git - redmine.git/commitdiff
Prevent 500 error on login when there's a typo in OpenID URI scheme, such as http...
authorJean-Baptiste Barth <jeanbaptiste.barth@gmail.com>
Tue, 10 Aug 2010 21:12:32 +0000 (21:12 +0000)
committerJean-Baptiste Barth <jeanbaptiste.barth@gmail.com>
Tue, 10 Aug 2010 21:12:32 +0000 (21:12 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3933 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/functional/account_controller_test.rb
vendor/plugins/open_id_authentication/lib/open_id_authentication.rb

index 2a8c9c66bf8da992f7ec6fd5354278208545e610..1d66d01d37e34be823726617d8b745b7bd10e918 100644 (file)
@@ -67,6 +67,13 @@ class AccountControllerTest < ActionController::TestCase
     assert_redirected_to 'my/page'
   end
 
+  def test_login_with_invalid_openid_provider
+    Setting.self_registration = '0'
+    Setting.openid = '1'
+    post :login, :openid_url => 'http;//openid.example.com/good_user'
+    assert_redirected_to home_url
+  end
+  
   def test_login_with_openid_for_existing_non_active_user
     Setting.self_registration = '2'
     Setting.openid = '1'
index 22481136e01f9150001ae745af9ed2e701a8e707..70418fde7ea7ff008b15f94ce52ab54a567fe2a9 100644 (file)
@@ -89,7 +89,7 @@ module OpenIdAuthentication
 
       begin
         uri = URI.parse(identifier)
-        uri.scheme = uri.scheme.downcase  # URI should do this
+        uri.scheme = uri.scheme.downcase if uri.scheme # URI should do this
         identifier = uri.normalize.to_s
       rescue URI::InvalidURIError
         raise InvalidOpenId.new("#{identifier} is not an OpenID identifier")