Permalink
Browse files

Mod: change TaoBao to Taobao

Fix: sort error in generate_sign
  • Loading branch information...
1 parent f5c6834 commit 43290f920eac0e61181a3208c2d0e959d0184353 @nowa nowa committed Aug 23, 2011
@@ -57,7 +57,7 @@ module Strategies
autoload :Renren, 'omniauth/strategies/oauth2/renren'
autoload :Salesforce, 'omniauth/strategies/oauth2/salesforce'
autoload :SoundCloud, 'omniauth/strategies/oauth2/sound_cloud'
- autoload :TaoBao, 'omniauth/strategies/oauth2/taobao'
+ autoload :Taobao, 'omniauth/strategies/oauth2/taobao'
autoload :Teambox, 'omniauth/strategies/oauth2/teambox'
autoload :ThirtySevenSignals, 'omniauth/strategies/oauth2/thirty_seven_signals'
autoload :Viadeo, 'omniauth/strategies/oauth2/viadeo'
@@ -10,7 +10,7 @@ module Strategies
#
# @example Basic Usage
# use OmniAuth::Strategies::TaoBao, 'client_id', 'client_secret'
- class TaoBao < OmniAuth::Strategies::OAuth2
+ class Taobao < OmniAuth::Strategies::OAuth2
# @param [Rack Application] app standard middleware application parameter
# @param [String] client_id the app key at taobao open platform
# @param [String] client_secret the app secret at taobao open platform
@@ -71,7 +71,8 @@ def user_info
end
def generate_sign(params)
- str = client_secret + (params.sort.collect { |k, v| "#{k}#{v}" }).join + client_secret
+ # params.sort.collect { |k, v| "#{k}#{v}" }
+ str = client_secret + params.sort {|a,b| "#{a[0]}"<=>"#{b[0]}"}.flatten.join + client_secret
params['sign'] = Digest::MD5.hexdigest(str).upcase!
params
end
@@ -1,5 +1,5 @@
require 'spec_helper'
-describe OmniAuth::Strategies::TaoBao do
+describe OmniAuth::Strategies::Taobao do
it_should_behave_like "an oauth2 strategy"
end

0 comments on commit 43290f9

Please sign in to comment.