##// END OF EJS Templates
Prevent 500 error on login when there's a typo in OpenID URI scheme, such as http;// or http.//...
Jean-Baptiste Barth -
r3819:83e4cf3dd420
parent child
Show More
@@ -67,6 +67,13 class AccountControllerTest < ActionController::TestCase
67 assert_redirected_to 'my/page'
67 assert_redirected_to 'my/page'
68 end
68 end
69
69
70 def test_login_with_invalid_openid_provider
71 Setting.self_registration = '0'
72 Setting.openid = '1'
73 post :login, :openid_url => 'http;//openid.example.com/good_user'
74 assert_redirected_to home_url
75 end
76
70 def test_login_with_openid_for_existing_non_active_user
77 def test_login_with_openid_for_existing_non_active_user
71 Setting.self_registration = '2'
78 Setting.self_registration = '2'
72 Setting.openid = '1'
79 Setting.openid = '1'
@@ -89,7 +89,7 module OpenIdAuthentication
89
89
90 begin
90 begin
91 uri = URI.parse(identifier)
91 uri = URI.parse(identifier)
92 uri.scheme = uri.scheme.downcase # URI should do this
92 uri.scheme = uri.scheme.downcase if uri.scheme # URI should do this
93 identifier = uri.normalize.to_s
93 identifier = uri.normalize.to_s
94 rescue URI::InvalidURIError
94 rescue URI::InvalidURIError
95 raise InvalidOpenId.new("#{identifier} is not an OpenID identifier")
95 raise InvalidOpenId.new("#{identifier} is not an OpenID identifier")
General Comments 0
You need to be logged in to leave comments. Login now