Changeset 7162
- Timestamp:
- 07/06/07 15:19:50 (1 year ago)
- Files:
-
- plugins/open_id_authentication/CHANGELOG (modified) (1 diff)
- plugins/open_id_authentication/lib/open_id_authentication.rb (modified) (2 diffs)
- plugins/open_id_authentication/README (modified) (2 diffs)
- plugins/open_id_authentication/test/normalize_test.rb (modified) (1 diff)
- plugins/open_id_authentication/test/open_id_authentication_test.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/open_id_authentication/CHANGELOG
r7115 r7162 1 * Allow -'s in #normalize_url [Rick] 2 3 * remove instance of mattr_accessor, it was breaking tests since they don't load ActiveSupport. Fix Timeout test [Rick] 4 1 5 * Throw a InvalidOpenId exception instead of just a RuntimeError when the URL can't be normalized [DHH] 2 6 plugins/open_id_authentication/lib/open_id_authentication.rb
r7115 r7162 2 2 OPEN_ID_AUTHENTICATION_DIR = RAILS_ROOT + "/tmp/openids" 3 3 4 @@store = :db 5 mattr_accessor :store 4 def self.store 5 @@store 6 end 7 8 def self.store=(value) 9 @@store = value 10 end 11 12 self.store = :db 6 13 7 14 class InvalidOpenId < StandardError … … 54 61 when %r{^https?://[^/]+$} 55 62 url + "/" 56 when %r{^[.\d\w ]+/.*$}63 when %r{^[.\d\w-]+/.*$} 57 64 "http://" + url 58 when %r{^[.\d\w ]+$}65 when %r{^[.\d\w-]+$} 59 66 "http://" + url + "/" 60 67 else plugins/open_id_authentication/README
r7022 r7162 92 92 def open_id_authentication 93 93 authenticate_with_open_id do |result, identity_url| 94 case result 95 when :missing 96 failed_login "Sorry, the OpenID server couldn't be found" 97 when :canceled 98 failed_login "OpenID verification was canceled" 99 when :failed 100 failed_login "Sorry, the OpenID verification failed" 101 when :successful 94 if result.successful? 102 95 if @current_user = @account.users.find_by_identity_url(identity_url) 103 96 successful_login … … 105 98 failed_login "Sorry, no user by that identity URL exists (#{identity_url})") 106 99 end 100 else 101 failed_login result.message 107 102 end 108 103 end plugins/open_id_authentication/test/normalize_test.rb
r7115 r7162 14 14 "https://openid.aol.com/nextangler" => "https://openid.aol.com/nextangler", 15 15 "loudthinking.com" => "http://loudthinking.com/", 16 "http://loudthinking.com" => "http://loudthinking.com/" 16 "http://loudthinking.com" => "http://loudthinking.com/", 17 "techno-weenie.net" => "http://techno-weenie.net/", 18 "http://techno-weenie.net" => "http://techno-weenie.net/" 17 19 } 18 20 plugins/open_id_authentication/test/open_id_authentication_test.rb
r6324 r7162 29 29 30 30 def test_authentication_should_fail_when_the_identity_server_times_out 31 @controller.stubs(:open_id_consumer).returns(stub(:begin => Proc.new { raise Timeout::Error }))31 @controller.stubs(:open_id_consumer).returns(stub(:begin => Proc.new { raise Timeout::Error, "Identity Server took too long." })) 32 32 33 33 @controller.send(:authenticate_with_open_id, "http://someone.example.com") do |result, identity_url|