devise_rpx_connectable 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.textile CHANGED
@@ -144,7 +144,9 @@ There is some advanced features that you may use...
144
144
  <pre>
145
145
  Devise.setup do |config|
146
146
  ...
147
- config.rpx_auto_create_account = true # false if you don't want to create users automaticaly. True by default.
147
+ config.rpx_auto_create_account = true # false if you don't want to create users automaticaly. True by default.
148
+ config.rpx_additional_user_data = [:verifiedEmail, :url, :providerName,:photo] # default [], get some extra profile info from RPXnow, default only a few fields are available in the rpx_user object (https://rpxnow.com/docs#profile_data)
149
+ config.rpx_extended_user_data = true # false by default, extended data only available for Plus and Pro RPX users (https://rpxnow.com/docs#api_auth_info)
148
150
  end
149
151
  </pre>
150
152
 
@@ -170,6 +172,9 @@ h2. TODO
170
172
  h2. Contributors
171
173
 
172
174
  * "Paco Benavent":http://github.com/Knack
175
+ * "DohMoose":http://github.com/DohMoose
176
+ * "Chris de Bruin":http://github.com/chrisdebruin
177
+ * "Michael Bumann":http://github.com/bumi
173
178
 
174
179
  h2. Thanks
175
180
 
@@ -111,11 +111,14 @@ module Devise #:nodoc:
111
111
  # Devise.setup do |config|
112
112
  # config.rpx_identifier_field = :rpx_identifier
113
113
  # config.rpx_auto_create_account = true
114
+ # config.get_extended_user_data = true
114
115
  # end
115
116
  #
116
117
  ::Devise::Models.config(self,
117
118
  :rpx_identifier_field,
118
- :rpx_auto_create_account
119
+ :rpx_auto_create_account,
120
+ :rpx_extended_user_data,
121
+ :rpx_additional_user_data
119
122
  )
120
123
 
121
124
  # Alias don't work for some reason, so...a more Ruby-ish alias
@@ -18,8 +18,9 @@ module Devise #:nodoc:
18
18
  #
19
19
  def authenticate!
20
20
  klass = mapping.to
21
+ raise StandardError, "RPXNow API key is not defined, please see the documentation of RPXNow gem to setup it." unless RPXNow.api_key.present?
21
22
  begin
22
- rpx_user = (RPXNow.user_data(params[:token]) rescue nil)
23
+ rpx_user = (RPXNow.user_data(params[:token], :extended => klass.rpx_extended_user_data, :additional => klass.rpx_additional_user_data) rescue nil)
23
24
  fail!(:rpx_invalid) and return unless rpx_user
24
25
 
25
26
  if user = klass.authenticate_with_rpx(:identifier => rpx_user["identifier"])
@@ -48,7 +49,7 @@ module Devise #:nodoc:
48
49
 
49
50
  protected
50
51
  def valid_controller?
51
- params[:controller] == 'sessions'
52
+ params[:controller].to_s =~ /sessions/
52
53
  end
53
54
 
54
55
  def valid_params?
@@ -1,5 +1,5 @@
1
1
  module Devise
2
2
  module RpxConnectable
3
- VERSION = "0.1.2".freeze
3
+ VERSION = "0.1.3".freeze
4
4
  end
5
5
  end
@@ -60,7 +60,7 @@ module Devise #:nodoc:
60
60
  end
61
61
 
62
62
  def build_token_url(return_url)
63
- "#{return_url}?authenticity_token=#{form_authenticity_token}"
63
+ "#{return_url}?authenticity_token=#{Rack::Utils.escape(form_authenticity_token)}"
64
64
  end
65
65
 
66
66
  end
@@ -14,6 +14,12 @@ module Devise
14
14
  mattr_accessor :rpx_auto_create_account
15
15
  @@rpx_auto_create_account = true
16
16
 
17
+ mattr_accessor :rpx_extended_user_data
18
+ @@rpx_extended_user_data = true
19
+
20
+ mattr_accessor :rpx_additional_user_data
21
+ @@rpx_additional_user_data = []
22
+
17
23
  mattr_accessor :rpx_application_name
18
24
  @@rpx_application_name = nil
19
25
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devise_rpx_connectable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicolas Blanco
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-04-26 00:00:00 +02:00
12
+ date: 2010-06-02 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency