devise_token_auth 0.1.32.beta4 → 0.1.32.beta5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ class Mang < ActiveRecord::Base
2
+ # Include default devise modules.
3
+ devise :database_authenticatable, :registerable,
4
+ :recoverable, :rememberable, :trackable, :validatable,
5
+ :confirmable, :omniauthable
6
+ include DeviseTokenAuth::Concerns::User
7
+ end
@@ -0,0 +1,7 @@
1
+ class User < ActiveRecord::Base
2
+ # Include default devise modules.
3
+ devise :database_authenticatable, :registerable,
4
+ :recoverable, :rememberable, :trackable, :validatable,
5
+ :confirmable, :omniauthable
6
+ include DeviseTokenAuth::Concerns::User
7
+ end
@@ -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,9 @@
1
+ Rails.application.routes.draw do
2
+ mount_devise_token_auth_for 'User', at: 'auth'
3
+
4
+ mount_devise_token_auth_for 'Mang', at: 'mangs'
5
+ as :mang do
6
+ # Define routes for Mang within this block.
7
+ end
8
+ patch '/chong', to: 'bong#index'
9
+ 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
@@ -98,21 +98,21 @@ end
98
98
 
99
99
  test 'route method is appended to routes file' do
100
100
  assert_file 'config/routes.rb' do |routes|
101
- assert_match(/mount_devise_token_auth_for 'User', at: '\/auth'/, routes)
101
+ assert_match(/mount_devise_token_auth_for 'User', at: 'auth'/, routes)
102
102
  end
103
103
  end
104
104
 
105
105
  test 'subsequent runs do not modify file' do
106
106
  run_generator
107
107
  assert_file 'config/routes.rb' do |routes|
108
- matches = routes.scan(/mount_devise_token_auth_for 'User', at: '\/auth'/m).size
108
+ matches = routes.scan(/mount_devise_token_auth_for 'User', at: 'auth'/m).size
109
109
  assert_equal 1, matches
110
110
  end
111
111
  end
112
112
 
113
113
  describe 'subsequent models' do
114
114
  before do
115
- run_generator %w(Mang /mangs)
115
+ run_generator %w(Mang mangs)
116
116
  end
117
117
 
118
118
  test 'migration is created' do
@@ -121,7 +121,7 @@ end
121
121
 
122
122
  test 'route method is appended to routes file' do
123
123
  assert_file 'config/routes.rb' do |routes|
124
- assert_match(/mount_devise_token_auth_for 'Mang', at: '\/mangs'/, routes)
124
+ assert_match(/mount_devise_token_auth_for 'Mang', at: 'mangs'/, routes)
125
125
  end
126
126
  end
127
127
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devise_token_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.32.beta4
4
+ version: 0.1.32.beta5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lynn Hurley
@@ -205,8 +205,12 @@ files:
205
205
  - test/dummy/public/422.html
206
206
  - test/dummy/public/500.html
207
207
  - test/dummy/public/favicon.ico
208
- - test/dummy/tmp/generators/app/views/devise/mailer/confirmation_instructions.html.erb
209
- - test/dummy/tmp/generators/app/views/devise/mailer/reset_password_instructions.html.erb
208
+ - test/dummy/tmp/generators/app/models/mang.rb
209
+ - test/dummy/tmp/generators/app/models/user.rb
210
+ - test/dummy/tmp/generators/config/initializers/devise_token_auth.rb
211
+ - test/dummy/tmp/generators/config/routes.rb
212
+ - test/dummy/tmp/generators/db/migrate/20150209074449_devise_token_auth_create_mangs.rb
213
+ - test/dummy/tmp/generators/db/migrate/20150209074449_devise_token_auth_create_users.rb
210
214
  - test/dummy/tmp/restart.txt
211
215
  - test/fixtures/evil_users.yml
212
216
  - test/fixtures/mangs.yml
@@ -327,8 +331,12 @@ test_files:
327
331
  - test/dummy/public/favicon.ico
328
332
  - test/dummy/Rakefile
329
333
  - test/dummy/README.rdoc
330
- - test/dummy/tmp/generators/app/views/devise/mailer/confirmation_instructions.html.erb
331
- - test/dummy/tmp/generators/app/views/devise/mailer/reset_password_instructions.html.erb
334
+ - test/dummy/tmp/generators/app/models/mang.rb
335
+ - test/dummy/tmp/generators/app/models/user.rb
336
+ - test/dummy/tmp/generators/config/initializers/devise_token_auth.rb
337
+ - test/dummy/tmp/generators/config/routes.rb
338
+ - test/dummy/tmp/generators/db/migrate/20150209074449_devise_token_auth_create_mangs.rb
339
+ - test/dummy/tmp/generators/db/migrate/20150209074449_devise_token_auth_create_users.rb
332
340
  - test/dummy/tmp/restart.txt
333
341
  - test/fixtures/evil_users.yml
334
342
  - test/fixtures/mangs.yml
@@ -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']}).html_safe %></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).html_safe %></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>