Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 7162

Show
Ignore:
Timestamp:
07/06/07 15:19:50 (1 year ago)
Author:
rick
Message:

* Allow -'s in #normalize_url [Rick]
* remove instance of mattr_accessor, it was breaking tests since they don't load ActiveSupport. Fix Timeout test [Rick]

Files:

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 
    15* Throw a InvalidOpenId exception instead of just a RuntimeError when the URL can't be normalized [DHH] 
    26 
  • plugins/open_id_authentication/lib/open_id_authentication.rb

    r7115 r7162  
    22  OPEN_ID_AUTHENTICATION_DIR = RAILS_ROOT + "/tmp/openids" 
    33   
    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 
    613 
    714  class InvalidOpenId < StandardError 
     
    5461    when %r{^https?://[^/]+$} 
    5562      url + "/" 
    56     when %r{^[.\d\w]+/.*$} 
     63    when %r{^[.\d\w-]+/.*$} 
    5764      "http://" + url 
    58     when %r{^[.\d\w]+$} 
     65    when %r{^[.\d\w-]+$} 
    5966      "http://" + url + "/" 
    6067    else 
  • plugins/open_id_authentication/README

    r7022 r7162  
    9292      def open_id_authentication 
    9393        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? 
    10295            if @current_user = @account.users.find_by_identity_url(identity_url) 
    10396              successful_login 
     
    10598              failed_login "Sorry, no user by that identity URL exists (#{identity_url})") 
    10699            end 
     100          else 
     101            failed_login result.message 
    107102          end 
    108103        end 
  • plugins/open_id_authentication/test/normalize_test.rb

    r7115 r7162  
    1414    "https://openid.aol.com/nextangler" => "https://openid.aol.com/nextangler", 
    1515    "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/" 
    1719  } 
    1820 
  • plugins/open_id_authentication/test/open_id_authentication_test.rb

    r6324 r7162  
    2929 
    3030  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." })) 
    3232 
    3333    @controller.send(:authenticate_with_open_id, "http://someone.example.com") do |result, identity_url|