devise_token_auth 0.1.30 → 0.1.31.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +51 -8
- data/app/controllers/devise_token_auth/registrations_controller.rb +2 -2
- data/app/models/devise_token_auth/concerns/user.rb +8 -4
- data/lib/devise_token_auth/version.rb +1 -1
- data/lib/generators/devise_token_auth/install_generator.rb +4 -0
- data/lib/generators/devise_token_auth/templates/user.rb +4 -0
- data/test/controllers/devise_token_auth/omniauth_callbacks_controller_test.rb +10 -0
- data/test/controllers/devise_token_auth/registrations_controller_test.rb +45 -0
- data/test/controllers/devise_token_auth/sessions_controller_test.rb +28 -0
- data/test/dummy/app/models/only_email_user.rb +5 -0
- data/test/dummy/app/models/unregisterable_user.rb +7 -0
- data/test/dummy/config/routes.rb +4 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20141222035835_devise_token_auth_create_only_email_users.rb +54 -0
- data/test/dummy/db/migrate/20141222053502_devise_token_auth_create_unregisterable_users.rb +54 -0
- data/test/dummy/db/schema.rb +46 -1
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +602 -0
- data/test/dummy/log/test.log +47403 -0
- data/test/dummy/tmp/generators/app/models/mang.rb +7 -0
- data/test/dummy/tmp/generators/app/models/user.rb +7 -0
- data/test/dummy/tmp/generators/config/initializers/devise_token_auth.rb +22 -0
- data/test/dummy/tmp/generators/config/routes.rb +9 -0
- data/test/dummy/tmp/generators/db/migrate/20141222060432_devise_token_auth_create_mangs.rb +54 -0
- data/test/dummy/tmp/generators/db/migrate/20141222060432_devise_token_auth_create_users.rb +54 -0
- data/test/fixtures/only_email_users.yml +9 -0
- data/test/models/only_email_user_test.rb +35 -0
- metadata +28 -8
- data/test/dummy/tmp/generators/app/views/devise/mailer/confirmation_instructions.html.erb +0 -5
- data/test/dummy/tmp/generators/app/views/devise/mailer/reset_password_instructions.html.erb +0 -8
@@ -0,0 +1,22 @@
|
|
1
|
+
DeviseTokenAuth.setup do |config|
|
2
|
+
# By default the authorization headers will change after each request. The
|
3
|
+
# client is responsible for keeping track of the changing tokens. Change
|
4
|
+
# this to false to prevent the Authorization header from changing after
|
5
|
+
# each request.
|
6
|
+
#config.change_headers_on_each_request = true
|
7
|
+
|
8
|
+
# By default, users will need to re-authenticate after 2 weeks. This setting
|
9
|
+
# determines how long tokens will remain valid after they are issued.
|
10
|
+
#config.token_lifespan = 2.weeks
|
11
|
+
|
12
|
+
# Sometimes it's necessary to make several requests to the API at the same
|
13
|
+
# time. In this case, each request in the batch will need to share the same
|
14
|
+
# auth token. This setting determines how far apart the requests can be while
|
15
|
+
# still using the same auth token.
|
16
|
+
#config.batch_request_buffer_throttle = 5.seconds
|
17
|
+
|
18
|
+
# This route will be the prefix for all oauth2 redirect callbacks. For
|
19
|
+
# example, using the default '/omniauth', the github oauth2 provider will
|
20
|
+
# redirect successful authentications to '/omniauth/github/callback'
|
21
|
+
#config.omniauth_prefix = "/omniauth"
|
22
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
class DeviseTokenAuthCreateMangs < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table(:mangs) do |t|
|
4
|
+
## Required
|
5
|
+
t.string :provider, :null => false
|
6
|
+
t.string :uid, :null => false, :default => ""
|
7
|
+
|
8
|
+
## Database authenticatable
|
9
|
+
t.string :encrypted_password, :null => false, :default => ""
|
10
|
+
|
11
|
+
## Recoverable
|
12
|
+
t.string :reset_password_token
|
13
|
+
t.datetime :reset_password_sent_at
|
14
|
+
|
15
|
+
## Rememberable
|
16
|
+
t.datetime :remember_created_at
|
17
|
+
|
18
|
+
## Trackable
|
19
|
+
t.integer :sign_in_count, :default => 0, :null => false
|
20
|
+
t.datetime :current_sign_in_at
|
21
|
+
t.datetime :last_sign_in_at
|
22
|
+
t.string :current_sign_in_ip
|
23
|
+
t.string :last_sign_in_ip
|
24
|
+
|
25
|
+
## Confirmable
|
26
|
+
t.string :confirmation_token
|
27
|
+
t.datetime :confirmed_at
|
28
|
+
t.datetime :confirmation_sent_at
|
29
|
+
t.string :unconfirmed_email # Only if using reconfirmable
|
30
|
+
|
31
|
+
## Lockable
|
32
|
+
# t.integer :failed_attempts, :default => 0, :null => false # Only if lock strategy is :failed_attempts
|
33
|
+
# t.string :unlock_token # Only if unlock strategy is :email or :both
|
34
|
+
# t.datetime :locked_at
|
35
|
+
|
36
|
+
## User Info
|
37
|
+
t.string :name
|
38
|
+
t.string :nickname
|
39
|
+
t.string :image
|
40
|
+
t.string :email
|
41
|
+
|
42
|
+
## Tokens
|
43
|
+
t.text :tokens
|
44
|
+
|
45
|
+
t.timestamps
|
46
|
+
end
|
47
|
+
|
48
|
+
add_index :mangs, :email
|
49
|
+
add_index :mangs, [:uid, :provider], :unique => true
|
50
|
+
add_index :mangs, :reset_password_token, :unique => true
|
51
|
+
# add_index :mangs, :confirmation_token, :unique => true
|
52
|
+
# add_index :mangs, :unlock_token, :unique => true
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
class DeviseTokenAuthCreateUsers < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table(:users) do |t|
|
4
|
+
## Required
|
5
|
+
t.string :provider, :null => false
|
6
|
+
t.string :uid, :null => false, :default => ""
|
7
|
+
|
8
|
+
## Database authenticatable
|
9
|
+
t.string :encrypted_password, :null => false, :default => ""
|
10
|
+
|
11
|
+
## Recoverable
|
12
|
+
t.string :reset_password_token
|
13
|
+
t.datetime :reset_password_sent_at
|
14
|
+
|
15
|
+
## Rememberable
|
16
|
+
t.datetime :remember_created_at
|
17
|
+
|
18
|
+
## Trackable
|
19
|
+
t.integer :sign_in_count, :default => 0, :null => false
|
20
|
+
t.datetime :current_sign_in_at
|
21
|
+
t.datetime :last_sign_in_at
|
22
|
+
t.string :current_sign_in_ip
|
23
|
+
t.string :last_sign_in_ip
|
24
|
+
|
25
|
+
## Confirmable
|
26
|
+
t.string :confirmation_token
|
27
|
+
t.datetime :confirmed_at
|
28
|
+
t.datetime :confirmation_sent_at
|
29
|
+
t.string :unconfirmed_email # Only if using reconfirmable
|
30
|
+
|
31
|
+
## Lockable
|
32
|
+
# t.integer :failed_attempts, :default => 0, :null => false # Only if lock strategy is :failed_attempts
|
33
|
+
# t.string :unlock_token # Only if unlock strategy is :email or :both
|
34
|
+
# t.datetime :locked_at
|
35
|
+
|
36
|
+
## User Info
|
37
|
+
t.string :name
|
38
|
+
t.string :nickname
|
39
|
+
t.string :image
|
40
|
+
t.string :email
|
41
|
+
|
42
|
+
## Tokens
|
43
|
+
t.text :tokens
|
44
|
+
|
45
|
+
t.timestamps
|
46
|
+
end
|
47
|
+
|
48
|
+
add_index :users, :email
|
49
|
+
add_index :users, [:uid, :provider], :unique => true
|
50
|
+
add_index :users, :reset_password_token, :unique => true
|
51
|
+
# add_index :users, :confirmation_token, :unique => true
|
52
|
+
# add_index :users, :unlock_token, :unique => true
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<% timestamp = DateTime.parse(2.weeks.ago.to_s).to_time.strftime("%F %T") %>
|
2
|
+
<% @email = Faker::Internet.email %>
|
3
|
+
user:
|
4
|
+
uid: "<%= @email %>"
|
5
|
+
email: "<%= @email %>"
|
6
|
+
provider: 'email'
|
7
|
+
created_at: '<%= timestamp %>'
|
8
|
+
updated_at: '<%= timestamp %>'
|
9
|
+
encrypted_password: <%= User.new.send(:password_digest, 'secret123') %>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class OnlyEmailUserTest < ActiveSupport::TestCase
|
4
|
+
describe OnlyEmailUser do
|
5
|
+
test 'trackable is disabled' do
|
6
|
+
refute OnlyEmailUser.method_defined?(:sign_in_count)
|
7
|
+
refute OnlyEmailUser.method_defined?(:current_sign_in_at)
|
8
|
+
refute OnlyEmailUser.method_defined?(:last_sign_in_at)
|
9
|
+
refute OnlyEmailUser.method_defined?(:current_sign_in_ip)
|
10
|
+
refute OnlyEmailUser.method_defined?(:last_sign_in_ip)
|
11
|
+
end
|
12
|
+
|
13
|
+
test 'confirmable is disabled' do
|
14
|
+
refute OnlyEmailUser.method_defined?(:confirmation_token)
|
15
|
+
refute OnlyEmailUser.method_defined?(:confirmed_at)
|
16
|
+
refute OnlyEmailUser.method_defined?(:confirmation_sent_at)
|
17
|
+
refute OnlyEmailUser.method_defined?(:unconfirmed_email)
|
18
|
+
end
|
19
|
+
|
20
|
+
test 'lockable is disabled' do
|
21
|
+
refute OnlyEmailUser.method_defined?(:failed_attempts)
|
22
|
+
refute OnlyEmailUser.method_defined?(:unlock_token)
|
23
|
+
refute OnlyEmailUser.method_defined?(:locked_at)
|
24
|
+
end
|
25
|
+
|
26
|
+
test 'recoverable is disabled' do
|
27
|
+
refute OnlyEmailUser.method_defined?(:reset_password_token)
|
28
|
+
refute OnlyEmailUser.method_defined?(:reset_password_sent_at)
|
29
|
+
end
|
30
|
+
|
31
|
+
test 'rememberable is disabled' do
|
32
|
+
refute OnlyEmailUser.method_defined?(:remember_created_at)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise_token_auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.31.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lynn Hurley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -154,6 +154,8 @@ files:
|
|
154
154
|
- test/dummy/app/helpers/application_helper.rb
|
155
155
|
- test/dummy/app/models/evil_user.rb
|
156
156
|
- test/dummy/app/models/mang.rb
|
157
|
+
- test/dummy/app/models/only_email_user.rb
|
158
|
+
- test/dummy/app/models/unregisterable_user.rb
|
157
159
|
- test/dummy/app/models/user.rb
|
158
160
|
- test/dummy/app/views/layouts/application.html.erb
|
159
161
|
- test/dummy/bin/bundle
|
@@ -191,6 +193,8 @@ files:
|
|
191
193
|
- test/dummy/db/migrate/20140829044006_add_operating_thetan_to_user.rb
|
192
194
|
- test/dummy/db/migrate/20140916224624_add_favorite_color_to_mangs.rb
|
193
195
|
- test/dummy/db/migrate/20140928231203_devise_token_auth_create_evil_users.rb
|
196
|
+
- test/dummy/db/migrate/20141222035835_devise_token_auth_create_only_email_users.rb
|
197
|
+
- test/dummy/db/migrate/20141222053502_devise_token_auth_create_unregisterable_users.rb
|
194
198
|
- test/dummy/db/schema.rb
|
195
199
|
- test/dummy/db/test.sqlite3
|
196
200
|
- test/dummy/log/development.log
|
@@ -199,15 +203,21 @@ files:
|
|
199
203
|
- test/dummy/public/422.html
|
200
204
|
- test/dummy/public/500.html
|
201
205
|
- test/dummy/public/favicon.ico
|
202
|
-
- test/dummy/tmp/generators/app/
|
203
|
-
- test/dummy/tmp/generators/app/
|
206
|
+
- test/dummy/tmp/generators/app/models/mang.rb
|
207
|
+
- test/dummy/tmp/generators/app/models/user.rb
|
208
|
+
- test/dummy/tmp/generators/config/initializers/devise_token_auth.rb
|
209
|
+
- test/dummy/tmp/generators/config/routes.rb
|
210
|
+
- test/dummy/tmp/generators/db/migrate/20141222060432_devise_token_auth_create_mangs.rb
|
211
|
+
- test/dummy/tmp/generators/db/migrate/20141222060432_devise_token_auth_create_users.rb
|
204
212
|
- test/dummy/tmp/restart.txt
|
205
213
|
- test/fixtures/evil_users.yml
|
206
214
|
- test/fixtures/mangs.yml
|
215
|
+
- test/fixtures/only_email_users.yml
|
207
216
|
- test/fixtures/users.yml
|
208
217
|
- test/integration/navigation_test.rb
|
209
218
|
- test/lib/generators/devise_token_auth/install_generator_test.rb
|
210
219
|
- test/lib/generators/devise_token_auth/install_views_generator_test.rb
|
220
|
+
- test/models/only_email_user_test.rb
|
211
221
|
- test/models/user_test.rb
|
212
222
|
- test/test_helper.rb
|
213
223
|
homepage: http://github.com/lynndylanhurley/devise_token_auth
|
@@ -225,9 +235,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
225
235
|
version: '0'
|
226
236
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
227
237
|
requirements:
|
228
|
-
- - "
|
238
|
+
- - ">"
|
229
239
|
- !ruby/object:Gem::Version
|
230
|
-
version:
|
240
|
+
version: 1.3.1
|
231
241
|
requirements: []
|
232
242
|
rubyforge_project:
|
233
243
|
rubygems_version: 2.2.2
|
@@ -266,6 +276,8 @@ test_files:
|
|
266
276
|
- test/dummy/app/helpers/application_helper.rb
|
267
277
|
- test/dummy/app/models/evil_user.rb
|
268
278
|
- test/dummy/app/models/mang.rb
|
279
|
+
- test/dummy/app/models/only_email_user.rb
|
280
|
+
- test/dummy/app/models/unregisterable_user.rb
|
269
281
|
- test/dummy/app/models/user.rb
|
270
282
|
- test/dummy/app/views/layouts/application.html.erb
|
271
283
|
- test/dummy/bin/bundle
|
@@ -303,6 +315,8 @@ test_files:
|
|
303
315
|
- test/dummy/db/migrate/20140829044006_add_operating_thetan_to_user.rb
|
304
316
|
- test/dummy/db/migrate/20140916224624_add_favorite_color_to_mangs.rb
|
305
317
|
- test/dummy/db/migrate/20140928231203_devise_token_auth_create_evil_users.rb
|
318
|
+
- test/dummy/db/migrate/20141222035835_devise_token_auth_create_only_email_users.rb
|
319
|
+
- test/dummy/db/migrate/20141222053502_devise_token_auth_create_unregisterable_users.rb
|
306
320
|
- test/dummy/db/schema.rb
|
307
321
|
- test/dummy/db/test.sqlite3
|
308
322
|
- test/dummy/log/development.log
|
@@ -313,14 +327,20 @@ test_files:
|
|
313
327
|
- test/dummy/public/favicon.ico
|
314
328
|
- test/dummy/Rakefile
|
315
329
|
- test/dummy/README.rdoc
|
316
|
-
- test/dummy/tmp/generators/app/
|
317
|
-
- test/dummy/tmp/generators/app/
|
330
|
+
- test/dummy/tmp/generators/app/models/mang.rb
|
331
|
+
- test/dummy/tmp/generators/app/models/user.rb
|
332
|
+
- test/dummy/tmp/generators/config/initializers/devise_token_auth.rb
|
333
|
+
- test/dummy/tmp/generators/config/routes.rb
|
334
|
+
- test/dummy/tmp/generators/db/migrate/20141222060432_devise_token_auth_create_mangs.rb
|
335
|
+
- test/dummy/tmp/generators/db/migrate/20141222060432_devise_token_auth_create_users.rb
|
318
336
|
- test/dummy/tmp/restart.txt
|
319
337
|
- test/fixtures/evil_users.yml
|
320
338
|
- test/fixtures/mangs.yml
|
339
|
+
- test/fixtures/only_email_users.yml
|
321
340
|
- test/fixtures/users.yml
|
322
341
|
- test/integration/navigation_test.rb
|
323
342
|
- test/lib/generators/devise_token_auth/install_generator_test.rb
|
324
343
|
- test/lib/generators/devise_token_auth/install_views_generator_test.rb
|
344
|
+
- test/models/only_email_user_test.rb
|
325
345
|
- test/models/user_test.rb
|
326
346
|
- test/test_helper.rb
|
@@ -1,5 +0,0 @@
|
|
1
|
-
<p>Welcome <%= @email %>!</p>
|
2
|
-
|
3
|
-
<p>You can confirm your account email through the link below:</p>
|
4
|
-
|
5
|
-
<p><%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token, config: message['client-config'].to_s, redirect_url: message['redirect-url']) %></p>
|
@@ -1,8 +0,0 @@
|
|
1
|
-
<p>Hello <%= @resource.email %>!</p>
|
2
|
-
|
3
|
-
<p>Someone has requested a link to change your password. You can do this through the link below.</p>
|
4
|
-
|
5
|
-
<p><%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token, config: message['client-config'].to_s, redirect_url: message['redirect-url'].to_s) %></p>
|
6
|
-
|
7
|
-
<p>If you didn't request this, please ignore this email.</p>
|
8
|
-
<p>Your password won't change until you access the link above and create a new one.</p>
|