devise 1.2.rc → 1.2.rc2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of devise might be problematic. Click here for more details.

Files changed (101) hide show
  1. data/.gitignore +10 -0
  2. data/.travis.yml +1 -0
  3. data/CHANGELOG.rdoc +45 -1
  4. data/Gemfile +29 -0
  5. data/Gemfile.lock +158 -0
  6. data/MIT-LICENSE +1 -1
  7. data/README.rdoc +25 -8
  8. data/Rakefile +34 -0
  9. data/TODO +4 -0
  10. data/app/controllers/devise/omniauth_callbacks_controller.rb +3 -3
  11. data/app/controllers/devise/registrations_controller.rb +4 -4
  12. data/app/controllers/devise/sessions_controller.rb +3 -2
  13. data/app/helpers/devise_helper.rb +6 -0
  14. data/config/locales/en.yml +2 -0
  15. data/devise.gemspec +25 -0
  16. data/lib/devise.rb +31 -5
  17. data/lib/devise/controllers/helpers.rb +30 -29
  18. data/lib/devise/controllers/internal_helpers.rb +6 -1
  19. data/lib/devise/controllers/rememberable.rb +52 -0
  20. data/lib/devise/encryptors/authlogic_sha512.rb +1 -1
  21. data/lib/devise/failure_app.rb +20 -4
  22. data/lib/devise/hooks/forgetable.rb +1 -4
  23. data/lib/devise/hooks/rememberable.rb +5 -44
  24. data/lib/devise/hooks/timeoutable.rb +1 -1
  25. data/lib/devise/models.rb +4 -2
  26. data/lib/devise/models/authenticatable.rb +13 -3
  27. data/lib/devise/models/confirmable.rb +3 -3
  28. data/lib/devise/models/database_authenticatable.rb +5 -3
  29. data/lib/devise/models/encryptable.rb +9 -2
  30. data/lib/devise/models/lockable.rb +18 -13
  31. data/lib/devise/models/recoverable.rb +9 -1
  32. data/lib/devise/models/registerable.rb +1 -1
  33. data/lib/devise/models/rememberable.rb +2 -5
  34. data/lib/devise/models/token_authenticatable.rb +4 -4
  35. data/lib/devise/omniauth.rb +3 -18
  36. data/lib/devise/omniauth/test_helpers.rb +14 -40
  37. data/lib/devise/omniauth/url_helpers.rb +6 -2
  38. data/lib/devise/rails.rb +3 -2
  39. data/lib/devise/rails/warden_compat.rb +5 -0
  40. data/lib/devise/schema.rb +3 -2
  41. data/lib/devise/strategies/authenticatable.rb +15 -1
  42. data/lib/devise/strategies/database_authenticatable.rb +1 -1
  43. data/lib/devise/strategies/rememberable.rb +6 -5
  44. data/lib/devise/strategies/token_authenticatable.rb +1 -1
  45. data/lib/devise/test_helpers.rb +3 -3
  46. data/lib/devise/version.rb +1 -1
  47. data/lib/generators/active_record/devise_generator.rb +2 -2
  48. data/lib/generators/active_record/templates/migration.rb +1 -0
  49. data/lib/generators/devise/devise_generator.rb +3 -1
  50. data/lib/generators/devise/orm_helpers.rb +1 -2
  51. data/lib/generators/devise/views_generator.rb +8 -45
  52. data/lib/generators/mongoid/devise_generator.rb +2 -2
  53. data/lib/generators/templates/devise.rb +19 -7
  54. data/test/controllers/helpers_test.rb +35 -5
  55. data/test/devise_test.rb +10 -0
  56. data/test/failure_app_test.rb +32 -3
  57. data/test/generators/active_record_generator_test.rb +24 -0
  58. data/test/generators/devise_generator_test.rb +33 -0
  59. data/test/generators/install_generator_test.rb +3 -4
  60. data/test/generators/mongoid_generator_test.rb +22 -0
  61. data/test/generators/views_generator_test.rb +13 -15
  62. data/test/indifferent_hash.rb +33 -0
  63. data/test/integration/authenticatable_test.rb +7 -0
  64. data/test/integration/omniauthable_test.rb +67 -32
  65. data/test/integration/registerable_test.rb +30 -0
  66. data/test/integration/rememberable_test.rb +16 -6
  67. data/test/integration/token_authenticatable_test.rb +43 -5
  68. data/test/models/confirmable_test.rb +20 -3
  69. data/test/models/encryptable_test.rb +1 -1
  70. data/test/models/lockable_test.rb +36 -15
  71. data/test/models/recoverable_test.rb +20 -11
  72. data/test/models/token_authenticatable_test.rb +19 -1
  73. data/test/models_test.rb +7 -0
  74. data/test/omniauth/test_helpers_test.rb +25 -0
  75. data/test/omniauth/url_helpers_test.rb +7 -0
  76. data/test/rails_app/Rakefile +10 -0
  77. data/test/rails_app/app/controllers/application_controller.rb +0 -1
  78. data/test/rails_app/app/controllers/users/omniauth_callbacks_controller.rb +7 -0
  79. data/test/rails_app/app/views/admins/index.html.erb +1 -0
  80. data/test/rails_app/app/views/admins/sessions/new.html.erb +2 -0
  81. data/test/rails_app/app/views/home/index.html.erb +1 -0
  82. data/test/rails_app/app/views/home/private.html.erb +1 -0
  83. data/test/rails_app/app/views/layouts/application.html.erb +24 -0
  84. data/test/rails_app/app/views/users/index.html.erb +1 -0
  85. data/test/rails_app/app/views/users/mailer/confirmation_instructions.erb +1 -0
  86. data/test/rails_app/app/views/users/sessions/new.html.erb +1 -0
  87. data/test/rails_app/config.ru +4 -0
  88. data/test/rails_app/config/application.rb +5 -0
  89. data/test/rails_app/config/database.yml +18 -0
  90. data/test/rails_app/config/initializers/devise.rb +18 -2
  91. data/test/rails_app/public/404.html +26 -0
  92. data/test/rails_app/public/422.html +26 -0
  93. data/test/rails_app/public/500.html +26 -0
  94. data/test/rails_app/public/favicon.ico +0 -0
  95. data/test/rails_app/script/rails +10 -0
  96. data/test/schema_test.rb +33 -0
  97. data/test/support/locale/en.yml +4 -0
  98. data/test/test_helper.rb +5 -2
  99. data/test/test_helpers_test.rb +33 -0
  100. metadata +71 -20
  101. data/test/generators/generators_test_helper.rb +0 -4
@@ -28,9 +28,9 @@ class RememberMeTest < ActionController::IntegrationTest
28
28
  end
29
29
 
30
30
  def cookie_expires(key)
31
- cookie = response.headers["Set-Cookie"].split("\n").grep(/^#{key}/).first
32
- cookie.split(";").map(&:strip).grep(/^expires=/)
33
- Time.parse($')
31
+ cookie = response.headers["Set-Cookie"].split("\n").grep(/^#{key}/).first
32
+ expires = cookie.split(";").map(&:strip).grep(/^expires=/).first
33
+ Time.parse(expires).utc
34
34
  end
35
35
 
36
36
  test 'do not remember the user if he has not checked remember me option' do
@@ -69,6 +69,17 @@ class RememberMeTest < ActionController::IntegrationTest
69
69
  assert_response :success
70
70
  assert warden.authenticated?(:user)
71
71
  assert warden.user(:user) == user
72
+ assert_match /remember_user_token[^\n]*HttpOnly\n/, response.headers["Set-Cookie"], "Expected Set-Cookie header in response to set HttpOnly flag on remember_user_token cookie."
73
+ end
74
+
75
+ test 'cookies are destroyed on unverified requests' do
76
+ swap ApplicationController, :allow_forgery_protection => true do
77
+ user = create_user_and_remember
78
+ get users_path
79
+ assert warden.authenticated?(:user)
80
+ post root_path, :authenticity_token => 'INVALID'
81
+ assert_not warden.authenticated?(:user)
82
+ end
72
83
  end
73
84
 
74
85
  test 'does not extend remember period through sign in' do
@@ -150,7 +161,6 @@ class RememberMeTest < ActionController::IntegrationTest
150
161
 
151
162
  get users_path
152
163
  assert_not warden.authenticated?(:user)
153
- assert_nil warden.cookies['remember_user_token']
154
164
  end
155
165
 
156
166
  test 'do not remember the admin anymore after forget' do
@@ -160,11 +170,11 @@ class RememberMeTest < ActionController::IntegrationTest
160
170
 
161
171
  get destroy_admin_session_path
162
172
  assert_not warden.authenticated?(:admin)
173
+ assert_nil admin.reload.remember_token
163
174
  assert_nil warden.cookies['remember_admin_token']
164
175
 
165
176
  get root_path
166
177
  assert_not warden.authenticated?(:admin)
167
- assert_nil warden.cookies['remember_admin_token']
168
178
  end
169
179
 
170
180
  test 'changing user password expires remember me token' do
@@ -176,4 +186,4 @@ class RememberMeTest < ActionController::IntegrationTest
176
186
  get users_path
177
187
  assert_not warden.authenticated?(:user)
178
188
  end
179
- end
189
+ end
@@ -76,15 +76,42 @@ class TokenAuthenticationTest < ActionController::IntegrationTest
76
76
  end
77
77
  end
78
78
 
79
+ test 'authenticate with valid authentication token key and do not store if stateless and timeoutable are enabled' do
80
+ swap Devise, :token_authentication_key => :secret_token, :stateless_token => true, :timeout_in => (0.1).second do
81
+ user = sign_in_as_new_user_with_token
82
+ assert warden.authenticated?(:user)
83
+
84
+ # Expiring does not work because we are setting the session value when accessing it
85
+ sleep 0.3
86
+
87
+ get_users_path_as_existing_user(user)
88
+ assert warden.authenticated?(:user)
89
+ end
90
+ end
91
+
92
+ test 'should not be subject to injection' do
93
+ swap Devise, :token_authentication_key => :secret_token do
94
+ user1 = create_user_with_authentication_token()
95
+
96
+ # Clean up user cache
97
+ @user = nil
98
+
99
+ user2 = create_user_with_authentication_token(:email => "another@test.com")
100
+ user2.update_attribute(:authentication_token, "ANOTHERTOKEN")
101
+
102
+ assert_not_equal user1, user2
103
+ visit users_path(Devise.token_authentication_key.to_s + '[$ne]' => user1.authentication_token)
104
+ assert_nil warden.user(:user)
105
+ end
106
+ end
107
+
79
108
  private
80
109
 
81
110
  def sign_in_as_new_user_with_token(options = {})
82
- options[:auth_token_key] ||= Devise.token_authentication_key
83
- options[:auth_token] ||= VALID_AUTHENTICATION_TOKEN
111
+ user = options.delete(:user) || create_user_with_authentication_token(options)
84
112
 
85
- user = create_user(options)
86
- user.authentication_token = VALID_AUTHENTICATION_TOKEN
87
- user.save
113
+ options[:auth_token_key] ||= Devise.token_authentication_key
114
+ options[:auth_token] ||= user.authentication_token
88
115
 
89
116
  if options[:http_auth]
90
117
  header = "Basic #{ActiveSupport::Base64.encode64("#{VALID_AUTHENTICATION_TOKEN}:X")}"
@@ -96,4 +123,15 @@ class TokenAuthenticationTest < ActionController::IntegrationTest
96
123
  user
97
124
  end
98
125
 
126
+ def create_user_with_authentication_token(options={})
127
+ user = create_user(options)
128
+ user.authentication_token = VALID_AUTHENTICATION_TOKEN
129
+ user.save
130
+ user
131
+ end
132
+
133
+ def get_users_path_as_existing_user(user)
134
+ sign_in_as_new_user_with_token(:user => user)
135
+ end
136
+
99
137
  end
@@ -51,7 +51,7 @@ class ConfirmableTest < ActiveSupport::TestCase
51
51
  assert_equal "was already confirmed, please try signing in", user.errors[:email].join
52
52
  end
53
53
 
54
- test 'should find and confirm an user automatically' do
54
+ test 'should find and confirm a user automatically' do
55
55
  user = create_user
56
56
  confirmed_user = User.confirm_by_token(user.confirmation_token)
57
57
  assert_equal confirmed_user, user
@@ -127,7 +127,7 @@ class ConfirmableTest < ActiveSupport::TestCase
127
127
  User.send_confirmation_instructions(:email => user.email)
128
128
  end
129
129
  end
130
-
130
+
131
131
  test 'should always have confirmation token when email is sent' do
132
132
  user = new_user
133
133
  user.instance_eval { def confirmation_required?; false end }
@@ -210,7 +210,7 @@ class ConfirmableTest < ActiveSupport::TestCase
210
210
  user.save
211
211
  assert_not user.reload.active?
212
212
  end
213
-
213
+
214
214
  test 'should be active without confirmation when confirmation is not required' do
215
215
  user = create_user
216
216
  user.instance_eval { def confirmation_required?; false end }
@@ -218,4 +218,21 @@ class ConfirmableTest < ActiveSupport::TestCase
218
218
  user.save
219
219
  assert user.reload.active?
220
220
  end
221
+
222
+ test 'should find a user to send email instructions for the user confirm it\'s email by authentication_keys' do
223
+ swap Devise, :authentication_keys => [:username, :email] do
224
+ user = create_user
225
+ confirm_user = User.send_confirmation_instructions(:email => user.email, :username => user.username)
226
+ assert_equal confirm_user, user
227
+ end
228
+ end
229
+
230
+ test 'should require all confirmation_keys' do
231
+ swap Devise, :confirmation_keys => [:username, :email] do
232
+ user = create_user
233
+ confirm_user = User.send_confirmation_instructions(:email => user.email)
234
+ assert_not confirm_user.persisted?
235
+ assert_equal "can't be blank", confirm_user.errors[:username].join
236
+ end
237
+ end
221
238
  end
@@ -31,7 +31,7 @@ class EncryptableTest < ActiveSupport::TestCase
31
31
 
32
32
  test 'should generate a base64 hash using SecureRandom for password salt' do
33
33
  swap_with_encryptor Admin, :sha1 do
34
- ActiveSupport::SecureRandom.expects(:base64).with(44).returns('friendly_token')
34
+ ActiveSupport::SecureRandom.expects(:base64).with(15).returns('friendly_token')
35
35
  assert_equal 'friendly_token', create_admin.password_salt
36
36
  end
37
37
  end
@@ -55,7 +55,7 @@ class LockableTest < ActiveSupport::TestCase
55
55
  assert_not user.active?
56
56
  end
57
57
 
58
- test "should unlock an user by cleaning locked_at, falied_attempts and unlock_token" do
58
+ test "should unlock a user by cleaning locked_at, falied_attempts and unlock_token" do
59
59
  user = create_user
60
60
  user.lock_access!
61
61
  assert_not_nil user.reload.locked_at
@@ -67,12 +67,6 @@ class LockableTest < ActiveSupport::TestCase
67
67
  assert_equal 0, user.reload.failed_attempts
68
68
  end
69
69
 
70
- test 'should not unlock an unlocked user' do
71
- user = create_user
72
- assert_not user.unlock_access!
73
- assert_match "was not locked", user.errors[:email].join
74
- end
75
-
76
70
  test "new user should not be locked and should have zero failed_attempts" do
77
71
  assert_not new_user.access_locked?
78
72
  assert_equal 0, create_user.failed_attempts
@@ -141,7 +135,7 @@ class LockableTest < ActiveSupport::TestCase
141
135
  end
142
136
  end
143
137
 
144
- test 'should find and unlock an user automatically' do
138
+ test 'should find and unlock a user automatically' do
145
139
  user = create_user
146
140
  user.lock_access!
147
141
  locked_user = User.unlock_access_by_token(user.unlock_token)
@@ -186,13 +180,13 @@ class LockableTest < ActiveSupport::TestCase
186
180
  end
187
181
  end
188
182
 
189
- test 'should require all authentication_keys' do
190
- swap Devise, :authentication_keys => [:username, :email] do
191
- user = create_user
192
- unlock_user = User.send_unlock_instructions(:email => user.email)
193
- assert_not unlock_user.persisted?
194
- assert_equal "can't be blank", unlock_user.errors[:username].join
195
- end
183
+ test 'should require all unlock_keys' do
184
+ swap Devise, :unlock_keys => [:username, :email] do
185
+ user = create_user
186
+ unlock_user = User.send_unlock_instructions(:email => user.email)
187
+ assert_not unlock_user.persisted?
188
+ assert_equal "can't be blank", unlock_user.errors[:username].join
189
+ end
196
190
  end
197
191
 
198
192
  test 'should not be able to send instructions if the user is not locked' do
@@ -201,4 +195,31 @@ class LockableTest < ActiveSupport::TestCase
201
195
  assert_not user.access_locked?
202
196
  assert_equal 'was not locked', user.errors[:email].join
203
197
  end
198
+
199
+ test 'should unlock account if lock has expired and increase attempts on failure' do
200
+ swap Devise, :unlock_in => 1.minute do
201
+ user = create_user
202
+ user.confirm!
203
+
204
+ user.failed_attempts = 2
205
+ user.locked_at = 2.minutes.ago
206
+
207
+ user.valid_for_authentication? { false }
208
+ assert_equal 1, user.failed_attempts
209
+ end
210
+ end
211
+
212
+ test 'should unlock account if lock has expired on success' do
213
+ swap Devise, :unlock_in => 1.minute do
214
+ user = create_user
215
+ user.confirm!
216
+
217
+ user.failed_attempts = 2
218
+ user.locked_at = 2.minutes.ago
219
+
220
+ user.valid_for_authentication? { true }
221
+ assert_equal 0, user.failed_attempts
222
+ assert_nil user.locked_at
223
+ end
224
+ end
204
225
  end
@@ -85,7 +85,7 @@ class RecoverableTest < ActiveSupport::TestCase
85
85
  assert_not reset_password_user.persisted?
86
86
  assert_equal "not found", reset_password_user.errors[:email].join
87
87
  end
88
-
88
+
89
89
  test 'should find a user to send instructions by authentication_keys' do
90
90
  swap Devise, :authentication_keys => [:username, :email] do
91
91
  user = create_user
@@ -93,14 +93,14 @@ class RecoverableTest < ActiveSupport::TestCase
93
93
  assert_equal reset_password_user, user
94
94
  end
95
95
  end
96
-
97
- test 'should require all authentication_keys' do
98
- swap Devise, :authentication_keys => [:username, :email] do
99
- user = create_user
100
- reset_password_user = User.send_reset_password_instructions(:email => user.email)
101
- assert_not reset_password_user.persisted?
102
- assert_equal "can't be blank", reset_password_user.errors[:username].join
103
- end
96
+
97
+ test 'should require all reset_password_keys' do
98
+ swap Devise, :reset_password_keys => [:username, :email] do
99
+ user = create_user
100
+ reset_password_user = User.send_reset_password_instructions(:email => user.email)
101
+ assert_not reset_password_user.persisted?
102
+ assert_equal "can't be blank", reset_password_user.errors[:username].join
103
+ end
104
104
  end
105
105
 
106
106
  test 'should reset reset_password_token before send the reset instructions email' do
@@ -125,18 +125,27 @@ class RecoverableTest < ActiveSupport::TestCase
125
125
  assert_equal reset_password_user, user
126
126
  end
127
127
 
128
- test 'should a new record with errors if no reset_password_token is found' do
128
+ test 'should return a new record with errors if no reset_password_token is found' do
129
129
  reset_password_user = User.reset_password_by_token(:reset_password_token => 'invalid_token')
130
130
  assert_not reset_password_user.persisted?
131
131
  assert_equal "is invalid", reset_password_user.errors[:reset_password_token].join
132
132
  end
133
133
 
134
- test 'should a new record with errors if reset_password_token is blank' do
134
+ test 'should return a new record with errors if reset_password_token is blank' do
135
135
  reset_password_user = User.reset_password_by_token(:reset_password_token => '')
136
136
  assert_not reset_password_user.persisted?
137
137
  assert_match "can't be blank", reset_password_user.errors[:reset_password_token].join
138
138
  end
139
139
 
140
+ test 'should return a new record with errors if password is blank' do
141
+ user = create_user
142
+ user.send :generate_reset_password_token!
143
+
144
+ reset_password_user = User.reset_password_by_token(:reset_password_token => user.reset_password_token, :password => '')
145
+ assert_not reset_password_user.errors.empty?
146
+ assert_match "can't be blank", reset_password_user.errors[:password].join
147
+ end
148
+
140
149
  test 'should reset successfully user password given the new password and confirmation' do
141
150
  user = create_user
142
151
  old_password = user.password
@@ -27,6 +27,12 @@ class TokenAuthenticatableTest < ActiveSupport::TestCase
27
27
  end
28
28
 
29
29
  test 'should return nil when authenticating an invalid user by authentication token' do
30
+ if DEVISE_ORM == :mongoid
31
+ raise 'There is an incompatibility between Devise and Mongoid' <<
32
+ ' that makes this test break. For more information, check' <<
33
+ ' this issue: https://github.com/mongoid/mongoid/issues/725'
34
+ end
35
+
30
36
  user = create_user
31
37
  user.ensure_authentication_token!
32
38
  user.confirm!
@@ -34,4 +40,16 @@ class TokenAuthenticatableTest < ActiveSupport::TestCase
34
40
  assert_nil authenticated_user
35
41
  end
36
42
 
37
- end
43
+ test 'should not be subject to injection' do
44
+ user1 = create_user
45
+ user1.ensure_authentication_token!
46
+ user1.confirm!
47
+
48
+ user2 = create_user
49
+ user2.ensure_authentication_token!
50
+ user2.confirm!
51
+
52
+ user = User.find_for_token_authentication(:auth_token => {'$ne' => user1.authentication_token})
53
+ assert_nil user
54
+ end
55
+ end
@@ -47,6 +47,13 @@ class ActiveRecordTest < ActiveSupport::TestCase
47
47
  assert_equal module_constants, (Admin.included_modules & module_constants).reverse
48
48
  end
49
49
 
50
+ test 'raise error on invalid module' do
51
+ assert_raise NameError do
52
+ # Mix valid an invalid modules.
53
+ Configurable.class_eval { devise :database_authenticatable, :doesnotexit }
54
+ end
55
+ end
56
+
50
57
  test 'set a default value for stretches' do
51
58
  assert_equal 15, Configurable.stretches
52
59
  end
@@ -0,0 +1,25 @@
1
+ require 'test_helper'
2
+
3
+ class OmniAuthTestHelpersTest < ActiveSupport::TestCase
4
+ test "Assert that stub! raises deprecation error" do
5
+ assert_raises Devise::OmniAuth::TestHelpers::DeprecationError do
6
+ Devise::OmniAuth::TestHelpers.stub!
7
+ end
8
+ end
9
+
10
+ test "Assert that reset_stubs! raises deprecation error" do
11
+ assert_raises Devise::OmniAuth::TestHelpers::DeprecationError do
12
+ Devise::OmniAuth::TestHelpers.reset_stubs!
13
+ end
14
+ end
15
+
16
+ test "Assert that short_circuit_authorizers! warns about deprecation" do
17
+ Devise::OmniAuth::TestHelpers.short_circuit_authorizers!
18
+ assert ::OmniAuth.config.test_mode
19
+ end
20
+
21
+ test "Assert that unshort_circuit_authorizers! warns about deprecation" do
22
+ Devise::OmniAuth::TestHelpers.unshort_circuit_authorizers!
23
+ assert ! ::OmniAuth.config.test_mode
24
+ end
25
+ end
@@ -44,4 +44,11 @@ class OmniAuthRoutesTest < ActionController::TestCase
44
44
  assert_equal "/users/auth/open_id",
45
45
  @controller.omniauth_authorize_path(:user, :open_id)
46
46
  end
47
+
48
+ test 'should set script name in the path if present' do
49
+ @request.env['SCRIPT_NAME'] = '/q'
50
+
51
+ assert_equal "/q/users/auth/facebook",
52
+ @controller.omniauth_authorize_path(:user, :facebook)
53
+ end
47
54
  end
@@ -0,0 +1,10 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ require 'rake'
7
+ require 'rake/testtask'
8
+ require 'rake/rdoctask'
9
+
10
+ Rails.application.load_tasks
@@ -3,7 +3,6 @@
3
3
 
4
4
  class ApplicationController < ActionController::Base
5
5
  protect_from_forgery
6
-
7
6
  before_filter :current_user
8
7
  before_filter :authenticate_user!, :if => :devise_controller?
9
8
  end
@@ -4,4 +4,11 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
4
4
  session["devise.facebook_data"] = data["extra"]["user_hash"]
5
5
  render :json => data
6
6
  end
7
+
8
+ def sign_in_facebook
9
+ user = User.find_by_email('user@test.com')
10
+ user.remember_me = true
11
+ sign_in user
12
+ render :text => ""
13
+ end
7
14
  end
@@ -0,0 +1 @@
1
+ Welcome Admin!
@@ -0,0 +1,2 @@
1
+ Welcome to "sessions/new" view!
2
+ <%= render :file => "devise/sessions/new" %>