devise_token_auth_skycocker_fork 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +13 -0
  3. data/README.md +97 -0
  4. data/Rakefile +42 -0
  5. data/app/controllers/devise_token_auth/application_controller.rb +79 -0
  6. data/app/controllers/devise_token_auth/concerns/resource_finder.rb +44 -0
  7. data/app/controllers/devise_token_auth/concerns/set_user_by_token.rb +178 -0
  8. data/app/controllers/devise_token_auth/confirmations_controller.rb +39 -0
  9. data/app/controllers/devise_token_auth/omniauth_callbacks_controller.rb +239 -0
  10. data/app/controllers/devise_token_auth/passwords_controller.rb +185 -0
  11. data/app/controllers/devise_token_auth/registrations_controller.rb +198 -0
  12. data/app/controllers/devise_token_auth/sessions_controller.rb +131 -0
  13. data/app/controllers/devise_token_auth/token_validations_controller.rb +31 -0
  14. data/app/controllers/devise_token_auth/unlocks_controller.rb +89 -0
  15. data/app/models/devise_token_auth/concerns/active_record_support.rb +34 -0
  16. data/app/models/devise_token_auth/concerns/mongoid_support.rb +19 -0
  17. data/app/models/devise_token_auth/concerns/user.rb +262 -0
  18. data/app/models/devise_token_auth/concerns/user_omniauth_callbacks.rb +28 -0
  19. data/app/validators/devise_token_auth/email_validator.rb +23 -0
  20. data/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
  21. data/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
  22. data/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
  23. data/app/views/devise_token_auth/omniauth_external_window.html.erb +38 -0
  24. data/config/locales/da-DK.yml +50 -0
  25. data/config/locales/de.yml +49 -0
  26. data/config/locales/en.yml +50 -0
  27. data/config/locales/es.yml +49 -0
  28. data/config/locales/fr.yml +49 -0
  29. data/config/locales/it.yml +46 -0
  30. data/config/locales/ja.yml +46 -0
  31. data/config/locales/nl.yml +30 -0
  32. data/config/locales/pl.yml +48 -0
  33. data/config/locales/pt-BR.yml +46 -0
  34. data/config/locales/pt.yml +48 -0
  35. data/config/locales/ro.yml +46 -0
  36. data/config/locales/ru.yml +50 -0
  37. data/config/locales/sq.yml +46 -0
  38. data/config/locales/sv.yml +50 -0
  39. data/config/locales/uk.yml +59 -0
  40. data/config/locales/vi.yml +50 -0
  41. data/config/locales/zh-CN.yml +46 -0
  42. data/config/locales/zh-HK.yml +48 -0
  43. data/config/locales/zh-TW.yml +48 -0
  44. data/lib/devise_token_auth.rb +13 -0
  45. data/lib/devise_token_auth/blacklist.rb +2 -0
  46. data/lib/devise_token_auth/controllers/helpers.rb +161 -0
  47. data/lib/devise_token_auth/controllers/url_helpers.rb +10 -0
  48. data/lib/devise_token_auth/engine.rb +90 -0
  49. data/lib/devise_token_auth/errors.rb +8 -0
  50. data/lib/devise_token_auth/rails/routes.rb +116 -0
  51. data/lib/devise_token_auth/url.rb +41 -0
  52. data/lib/devise_token_auth/version.rb +5 -0
  53. data/lib/generators/devise_token_auth/USAGE +31 -0
  54. data/lib/generators/devise_token_auth/install_generator.rb +91 -0
  55. data/lib/generators/devise_token_auth/install_generator_helpers.rb +98 -0
  56. data/lib/generators/devise_token_auth/install_mongoid_generator.rb +46 -0
  57. data/lib/generators/devise_token_auth/install_views_generator.rb +18 -0
  58. data/lib/generators/devise_token_auth/templates/devise_token_auth.rb +50 -0
  59. data/lib/generators/devise_token_auth/templates/devise_token_auth_create_users.rb.erb +56 -0
  60. data/lib/generators/devise_token_auth/templates/user.rb.erb +9 -0
  61. data/lib/generators/devise_token_auth/templates/user_mongoid.rb.erb +63 -0
  62. data/lib/tasks/devise_token_auth_tasks.rake +6 -0
  63. data/test/controllers/custom/custom_confirmations_controller_test.rb +25 -0
  64. data/test/controllers/custom/custom_omniauth_callbacks_controller_test.rb +33 -0
  65. data/test/controllers/custom/custom_passwords_controller_test.rb +79 -0
  66. data/test/controllers/custom/custom_registrations_controller_test.rb +63 -0
  67. data/test/controllers/custom/custom_sessions_controller_test.rb +39 -0
  68. data/test/controllers/custom/custom_token_validations_controller_test.rb +42 -0
  69. data/test/controllers/demo_group_controller_test.rb +151 -0
  70. data/test/controllers/demo_mang_controller_test.rb +284 -0
  71. data/test/controllers/demo_user_controller_test.rb +629 -0
  72. data/test/controllers/devise_token_auth/confirmations_controller_test.rb +127 -0
  73. data/test/controllers/devise_token_auth/omniauth_callbacks_controller_test.rb +376 -0
  74. data/test/controllers/devise_token_auth/passwords_controller_test.rb +639 -0
  75. data/test/controllers/devise_token_auth/registrations_controller_test.rb +880 -0
  76. data/test/controllers/devise_token_auth/sessions_controller_test.rb +541 -0
  77. data/test/controllers/devise_token_auth/token_validations_controller_test.rb +102 -0
  78. data/test/controllers/devise_token_auth/unlocks_controller_test.rb +196 -0
  79. data/test/controllers/overrides/confirmations_controller_test.rb +47 -0
  80. data/test/controllers/overrides/omniauth_callbacks_controller_test.rb +53 -0
  81. data/test/controllers/overrides/passwords_controller_test.rb +64 -0
  82. data/test/controllers/overrides/registrations_controller_test.rb +46 -0
  83. data/test/controllers/overrides/sessions_controller_test.rb +35 -0
  84. data/test/controllers/overrides/token_validations_controller_test.rb +43 -0
  85. data/test/dummy/README.rdoc +28 -0
  86. data/test/dummy/app/active_record/lockable_user.rb +7 -0
  87. data/test/dummy/app/active_record/mang.rb +5 -0
  88. data/test/dummy/app/active_record/only_email_user.rb +7 -0
  89. data/test/dummy/app/active_record/scoped_user.rb +9 -0
  90. data/test/dummy/app/active_record/unconfirmable_user.rb +9 -0
  91. data/test/dummy/app/active_record/unregisterable_user.rb +9 -0
  92. data/test/dummy/app/active_record/user.rb +6 -0
  93. data/test/dummy/app/controllers/application_controller.rb +18 -0
  94. data/test/dummy/app/controllers/auth_origin_controller.rb +7 -0
  95. data/test/dummy/app/controllers/custom/confirmations_controller.rb +13 -0
  96. data/test/dummy/app/controllers/custom/omniauth_callbacks_controller.rb +13 -0
  97. data/test/dummy/app/controllers/custom/passwords_controller.rb +39 -0
  98. data/test/dummy/app/controllers/custom/registrations_controller.rb +39 -0
  99. data/test/dummy/app/controllers/custom/sessions_controller.rb +29 -0
  100. data/test/dummy/app/controllers/custom/token_validations_controller.rb +19 -0
  101. data/test/dummy/app/controllers/demo_group_controller.rb +15 -0
  102. data/test/dummy/app/controllers/demo_mang_controller.rb +14 -0
  103. data/test/dummy/app/controllers/demo_user_controller.rb +27 -0
  104. data/test/dummy/app/controllers/overrides/confirmations_controller.rb +28 -0
  105. data/test/dummy/app/controllers/overrides/omniauth_callbacks_controller.rb +16 -0
  106. data/test/dummy/app/controllers/overrides/passwords_controller.rb +35 -0
  107. data/test/dummy/app/controllers/overrides/registrations_controller.rb +29 -0
  108. data/test/dummy/app/controllers/overrides/sessions_controller.rb +36 -0
  109. data/test/dummy/app/controllers/overrides/token_validations_controller.rb +23 -0
  110. data/test/dummy/app/helpers/application_helper.rb +1058 -0
  111. data/test/dummy/app/models/concerns/favorite_color.rb +19 -0
  112. data/test/dummy/app/mongoid/lockable_user.rb +38 -0
  113. data/test/dummy/app/mongoid/mang.rb +53 -0
  114. data/test/dummy/app/mongoid/only_email_user.rb +33 -0
  115. data/test/dummy/app/mongoid/scoped_user.rb +57 -0
  116. data/test/dummy/app/mongoid/unconfirmable_user.rb +51 -0
  117. data/test/dummy/app/mongoid/unregisterable_user.rb +54 -0
  118. data/test/dummy/app/mongoid/user.rb +56 -0
  119. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  120. data/test/dummy/config.ru +18 -0
  121. data/test/dummy/config/application.rb +48 -0
  122. data/test/dummy/config/application.yml.bk +0 -0
  123. data/test/dummy/config/boot.rb +11 -0
  124. data/test/dummy/config/environment.rb +7 -0
  125. data/test/dummy/config/environments/development.rb +46 -0
  126. data/test/dummy/config/environments/production.rb +84 -0
  127. data/test/dummy/config/environments/test.rb +50 -0
  128. data/test/dummy/config/initializers/assets.rb +10 -0
  129. data/test/dummy/config/initializers/backtrace_silencers.rb +9 -0
  130. data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
  131. data/test/dummy/config/initializers/devise.rb +17 -0
  132. data/test/dummy/config/initializers/devise_token_auth.rb +24 -0
  133. data/test/dummy/config/initializers/figaro.rb +3 -0
  134. data/test/dummy/config/initializers/filter_parameter_logging.rb +6 -0
  135. data/test/dummy/config/initializers/inflections.rb +18 -0
  136. data/test/dummy/config/initializers/mime_types.rb +6 -0
  137. data/test/dummy/config/initializers/omniauth.rb +10 -0
  138. data/test/dummy/config/initializers/session_store.rb +5 -0
  139. data/test/dummy/config/initializers/wrap_parameters.rb +16 -0
  140. data/test/dummy/config/routes.rb +55 -0
  141. data/test/dummy/config/spring.rb +3 -0
  142. data/test/dummy/db/migrate/20140715061447_devise_token_auth_create_users.rb +65 -0
  143. data/test/dummy/db/migrate/20140715061805_devise_token_auth_create_mangs.rb +64 -0
  144. data/test/dummy/db/migrate/20140829044006_add_operating_thetan_to_user.rb +8 -0
  145. data/test/dummy/db/migrate/20140916224624_add_favorite_color_to_mangs.rb +7 -0
  146. data/test/dummy/db/migrate/20141222035835_devise_token_auth_create_only_email_users.rb +62 -0
  147. data/test/dummy/db/migrate/20141222053502_devise_token_auth_create_unregisterable_users.rb +63 -0
  148. data/test/dummy/db/migrate/20150708104536_devise_token_auth_create_unconfirmable_users.rb +63 -0
  149. data/test/dummy/db/migrate/20160103235141_devise_token_auth_create_scoped_users.rb +63 -0
  150. data/test/dummy/db/migrate/20160629184441_devise_token_auth_create_lockable_users.rb +63 -0
  151. data/test/dummy/db/schema.rb +200 -0
  152. data/test/dummy/lib/migration_database_helper.rb +43 -0
  153. data/test/dummy/tmp/generators/app/models/user.rb +9 -0
  154. data/test/dummy/tmp/generators/config/initializers/devise_token_auth.rb +50 -0
  155. data/test/dummy/tmp/generators/db/migrate/20181030122248_devise_token_auth_create_users.rb +56 -0
  156. data/test/factories/users.rb +40 -0
  157. data/test/lib/devise_token_auth/blacklist_test.rb +11 -0
  158. data/test/lib/devise_token_auth/url_test.rb +26 -0
  159. data/test/lib/generators/devise_token_auth/install_generator_test.rb +217 -0
  160. data/test/lib/generators/devise_token_auth/install_generator_with_namespace_test.rb +222 -0
  161. data/test/lib/generators/devise_token_auth/install_views_generator_test.rb +25 -0
  162. data/test/models/concerns/mongoid_support_test.rb +31 -0
  163. data/test/models/only_email_user_test.rb +37 -0
  164. data/test/models/user_test.rb +140 -0
  165. data/test/support/controllers/routes.rb +43 -0
  166. data/test/test_helper.rb +103 -0
  167. metadata +443 -0
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ include MigrationDatabaseHelper
4
+
5
+ class DeviseTokenAuthCreateMangs < ActiveRecord::Migration[4.2]
6
+ def change
7
+ create_table(:mangs) do |t|
8
+ ## Database authenticatable
9
+ t.string :email
10
+ t.string :encrypted_password, null: false, default: ''
11
+
12
+ ## Recoverable
13
+ t.string :reset_password_token
14
+ t.datetime :reset_password_sent_at
15
+ t.string :reset_password_redirect_url
16
+ t.boolean :allow_password_change, default: false
17
+
18
+ ## Rememberable
19
+ t.datetime :remember_created_at
20
+
21
+ ## Trackable
22
+ t.integer :sign_in_count, default: 0, null: false
23
+ t.datetime :current_sign_in_at
24
+ t.datetime :last_sign_in_at
25
+ t.string :current_sign_in_ip
26
+ t.string :last_sign_in_ip
27
+
28
+ ## Confirmable
29
+ t.string :confirmation_token
30
+ t.datetime :confirmed_at
31
+ t.datetime :confirmation_sent_at
32
+ t.string :unconfirmed_email # Only if using reconfirmable
33
+
34
+ ## Lockable
35
+ # t.integer :failed_attempts, :default => 0, :null => false # Only if lock strategy is :failed_attempts
36
+ # t.string :unlock_token # Only if unlock strategy is :email or :both
37
+ # t.datetime :locked_at
38
+
39
+ ## User Info
40
+ t.string :name
41
+ t.string :nickname
42
+ t.string :image
43
+
44
+ ## unique oauth id
45
+ t.string :provider
46
+ t.string :uid, null: false, default: ''
47
+
48
+ ## Tokens
49
+ if json_supported_database?
50
+ t.json :tokens
51
+ else
52
+ t.text :tokens
53
+ end
54
+
55
+ t.timestamps
56
+ end
57
+
58
+ add_index :mangs, :email
59
+ add_index :mangs, [:uid, :provider], unique: true
60
+ add_index :mangs, :reset_password_token, unique: true
61
+ add_index :mangs, :confirmation_token, unique: true
62
+ # add_index :mangs, :unlock_token, :unique => true
63
+ end
64
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddOperatingThetanToUser < ActiveRecord::Migration[4.2]
4
+ def change
5
+ add_column :users, :operating_thetan, :integer
6
+ add_column :users, :favorite_color, :string
7
+ end
8
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddFavoriteColorToMangs < ActiveRecord::Migration[4.2]
4
+ def change
5
+ add_column :mangs, :favorite_color, :string
6
+ end
7
+ end
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ include MigrationDatabaseHelper
4
+
5
+ class DeviseTokenAuthCreateOnlyEmailUsers < ActiveRecord::Migration[4.2]
6
+ def change
7
+ create_table(:only_email_users) do |t|
8
+ ## Required
9
+ t.string :provider, null: false
10
+ t.string :uid, null: false, default: ''
11
+
12
+ ## Database authenticatable
13
+ t.string :encrypted_password, null: false, default: ''
14
+
15
+ ## Recoverable
16
+ #t.string :reset_password_token
17
+ #t.datetime :reset_password_sent_at
18
+
19
+ ## Rememberable
20
+ #t.datetime :remember_created_at
21
+
22
+ ## Trackable
23
+ #t.integer :sign_in_count, :default => 0, :null => false
24
+ #t.datetime :current_sign_in_at
25
+ #t.datetime :last_sign_in_at
26
+ #t.string :current_sign_in_ip
27
+ #t.string :last_sign_in_ip
28
+
29
+ ## Confirmable
30
+ #t.string :confirmation_token
31
+ #t.datetime :confirmed_at
32
+ #t.datetime :confirmation_sent_at
33
+ #t.string :unconfirmed_email # Only if using reconfirmable
34
+
35
+ ## Lockable
36
+ # t.integer :failed_attempts, :default => 0, :null => false # Only if lock strategy is :failed_attempts
37
+ # t.string :unlock_token # Only if unlock strategy is :email or :both
38
+ # t.datetime :locked_at
39
+
40
+ ## User Info
41
+ t.string :name
42
+ t.string :nickname
43
+ t.string :image
44
+ t.string :email
45
+
46
+ ## Tokens
47
+ if json_supported_database?
48
+ t.json :tokens
49
+ else
50
+ t.text :tokens
51
+ end
52
+
53
+ t.timestamps
54
+ end
55
+
56
+ add_index :only_email_users, :email
57
+ add_index :only_email_users, [:uid, :provider], unique: true
58
+ #add_index :only_email_users, :reset_password_token, :unique => true
59
+ # add_index :only_email_users, :confirmation_token, :unique => true
60
+ # add_index :only_email_users, :unlock_token, :unique => true
61
+ end
62
+ end
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ include MigrationDatabaseHelper
4
+
5
+ class DeviseTokenAuthCreateUnregisterableUsers < ActiveRecord::Migration[4.2]
6
+ def change
7
+ create_table(:unregisterable_users) do |t|
8
+ ## Required
9
+ t.string :provider, null: false
10
+ t.string :uid, null: false, default: ''
11
+
12
+ ## Database authenticatable
13
+ t.string :encrypted_password, null: false, default: ''
14
+
15
+ ## Recoverable
16
+ t.string :reset_password_token
17
+ t.datetime :reset_password_sent_at
18
+ t.boolean :allow_password_change, default: false
19
+
20
+ ## Rememberable
21
+ t.datetime :remember_created_at
22
+
23
+ ## Trackable
24
+ t.integer :sign_in_count, default: 0, null: false
25
+ t.datetime :current_sign_in_at
26
+ t.datetime :last_sign_in_at
27
+ t.string :current_sign_in_ip
28
+ t.string :last_sign_in_ip
29
+
30
+ ## Confirmable
31
+ t.string :confirmation_token
32
+ t.datetime :confirmed_at
33
+ t.datetime :confirmation_sent_at
34
+ t.string :unconfirmed_email # Only if using reconfirmable
35
+
36
+ ## Lockable
37
+ # t.integer :failed_attempts, :default => 0, :null => false # Only if lock strategy is :failed_attempts
38
+ # t.string :unlock_token # Only if unlock strategy is :email or :both
39
+ # t.datetime :locked_at
40
+
41
+ ## User Info
42
+ t.string :name
43
+ t.string :nickname
44
+ t.string :image
45
+ t.string :email
46
+
47
+ ## Tokens
48
+ if json_supported_database?
49
+ t.json :tokens
50
+ else
51
+ t.text :tokens
52
+ end
53
+
54
+ t.timestamps
55
+ end
56
+
57
+ add_index :unregisterable_users, :email
58
+ add_index :unregisterable_users, [:uid, :provider], unique: true
59
+ add_index :unregisterable_users, :reset_password_token, unique: true
60
+ # add_index :unregisterable_users, :confirmation_token, :unique => true
61
+ # add_index :unregisterable_users, :unlock_token, :unique => true
62
+ end
63
+ end
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ include MigrationDatabaseHelper
4
+
5
+ class DeviseTokenAuthCreateUnconfirmableUsers < ActiveRecord::Migration[4.2]
6
+ def change
7
+ create_table(:unconfirmable_users) do |t|
8
+ ## Required
9
+ t.string :provider, null: false
10
+ t.string :uid, null: false, default: ''
11
+
12
+ ## Database authenticatable
13
+ t.string :encrypted_password, null: false, default: ''
14
+
15
+ ## Recoverable
16
+ t.string :reset_password_token
17
+ t.datetime :reset_password_sent_at
18
+ t.boolean :allow_password_change, default: false
19
+
20
+ ## Rememberable
21
+ t.datetime :remember_created_at
22
+
23
+ ## Trackable
24
+ t.integer :sign_in_count, default: 0, null: false
25
+ t.datetime :current_sign_in_at
26
+ t.datetime :last_sign_in_at
27
+ t.string :current_sign_in_ip
28
+ t.string :last_sign_in_ip
29
+
30
+ ## Confirmable
31
+ # t.string :confirmation_token
32
+ # t.datetime :confirmed_at
33
+ # t.datetime :confirmation_sent_at
34
+ # t.string :unconfirmed_email # Only if using reconfirmable
35
+
36
+ ## Lockable
37
+ # t.integer :failed_attempts, :default => 0, :null => false # Only if lock strategy is :failed_attempts
38
+ # t.string :unlock_token # Only if unlock strategy is :email or :both
39
+ # t.datetime :locked_at
40
+
41
+ ## User Info
42
+ t.string :name
43
+ t.string :nickname
44
+ t.string :image
45
+ t.string :email
46
+
47
+ ## Tokens
48
+ if json_supported_database?
49
+ t.json :tokens
50
+ else
51
+ t.text :tokens
52
+ end
53
+
54
+ t.timestamps
55
+ end
56
+
57
+ add_index :unconfirmable_users, :email
58
+ add_index :unconfirmable_users, [:uid, :provider], unique: true
59
+ add_index :unconfirmable_users, :reset_password_token, unique: true
60
+ # add_index :nice_users, :confirmation_token, :unique => true
61
+ # add_index :nice_users, :unlock_token, :unique => true
62
+ end
63
+ end
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ include MigrationDatabaseHelper
4
+
5
+ class DeviseTokenAuthCreateScopedUsers < ActiveRecord::Migration[4.2]
6
+ def change
7
+ create_table(:scoped_users) do |t|
8
+ ## Required
9
+ t.string :provider, null: false
10
+ t.string :uid, null: false, default: ''
11
+
12
+ ## Database authenticatable
13
+ t.string :encrypted_password, null: false, default: ''
14
+
15
+ ## Recoverable
16
+ t.string :reset_password_token
17
+ t.datetime :reset_password_sent_at
18
+ t.boolean :allow_password_change, default: false
19
+
20
+ ## Rememberable
21
+ t.datetime :remember_created_at
22
+
23
+ ## Trackable
24
+ t.integer :sign_in_count, default: 0, null: false
25
+ t.datetime :current_sign_in_at
26
+ t.datetime :last_sign_in_at
27
+ t.string :current_sign_in_ip
28
+ t.string :last_sign_in_ip
29
+
30
+ ## Confirmable
31
+ t.string :confirmation_token
32
+ t.datetime :confirmed_at
33
+ t.datetime :confirmation_sent_at
34
+ t.string :unconfirmed_email # Only if using reconfirmable
35
+
36
+ ## Lockable
37
+ # t.integer :failed_attempts, :default => 0, :null => false # Only if lock strategy is :failed_attempts
38
+ # t.string :unlock_token # Only if unlock strategy is :email or :both
39
+ # t.datetime :locked_at
40
+
41
+ ## User Info
42
+ t.string :name
43
+ t.string :nickname
44
+ t.string :image
45
+ t.string :email
46
+
47
+ ## Tokens
48
+ if json_supported_database?
49
+ t.json :tokens
50
+ else
51
+ t.text :tokens
52
+ end
53
+
54
+ t.timestamps
55
+ end
56
+
57
+ add_index :scoped_users, :email
58
+ add_index :scoped_users, [:uid, :provider], unique: true
59
+ add_index :scoped_users, :reset_password_token, unique: true
60
+ # add_index :scoped_users, :confirmation_token, :unique => true
61
+ # add_index :scoped_users, :unlock_token, :unique => true
62
+ end
63
+ end
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ include MigrationDatabaseHelper
4
+
5
+ class DeviseTokenAuthCreateLockableUsers < ActiveRecord::Migration[4.2]
6
+ def change
7
+ create_table(:lockable_users) do |t|
8
+ ## Required
9
+ t.string :provider, null: false
10
+ t.string :uid, null: false, default: ''
11
+
12
+ ## Database authenticatable
13
+ t.string :encrypted_password, null: false, default: ''
14
+
15
+ ## Recoverable
16
+ # t.string :reset_password_token
17
+ # t.datetime :reset_password_sent_at
18
+ # t.boolean :allow_password_change, :default => false
19
+
20
+ ## Rememberable
21
+ # t.datetime :remember_created_at
22
+
23
+ ## Trackable
24
+ # t.integer :sign_in_count, :default => 0, :null => false
25
+ # t.datetime :current_sign_in_at
26
+ # t.datetime :last_sign_in_at
27
+ # t.string :current_sign_in_ip
28
+ # t.string :last_sign_in_ip
29
+
30
+ ## Confirmable
31
+ # t.string :confirmation_token
32
+ # t.datetime :confirmed_at
33
+ # t.datetime :confirmation_sent_at
34
+ # t.string :unconfirmed_email # Only if using reconfirmable
35
+
36
+ ## Lockable
37
+ t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
38
+ t.string :unlock_token # Only if unlock strategy is :email or :both
39
+ t.datetime :locked_at
40
+
41
+ ## User Info
42
+ t.string :name
43
+ t.string :nickname
44
+ t.string :image
45
+ t.string :email
46
+
47
+ ## Tokens
48
+ if json_supported_database?
49
+ t.json :tokens
50
+ else
51
+ t.text :tokens
52
+ end
53
+
54
+ t.timestamps
55
+ end
56
+
57
+ add_index :lockable_users, :email
58
+ add_index :lockable_users, [:uid, :provider], unique: true
59
+ # add_index :lockable_users, :reset_password_token, :unique => true
60
+ # add_index :lockable_users, :confirmation_token, :unique => true
61
+ add_index :lockable_users, :unlock_token, unique: true
62
+ end
63
+ end
@@ -0,0 +1,200 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is auto-generated from the current state of the database. Instead
4
+ # of editing this file, please use the migrations feature of Active Record to
5
+ # incrementally modify your database, and then regenerate this schema definition.
6
+ #
7
+ # Note that this schema.rb definition is the authoritative source for your
8
+ # database schema. If you need to create the application database on another
9
+ # system, you should be using db:schema:load, not running all the migrations
10
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
11
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
12
+ #
13
+ # It's strongly recommended that you check this file into your version control system.
14
+
15
+ ActiveRecord::Schema.define(version: 20160629184441) do
16
+
17
+ create_table "lockable_users", force: :cascade do |t|
18
+ t.string "provider", null: false
19
+ t.string "uid", default: "", null: false
20
+ t.string "encrypted_password", default: "", null: false
21
+ t.integer "failed_attempts", default: 0, null: false
22
+ t.string "unlock_token"
23
+ t.datetime "locked_at"
24
+ t.string "name"
25
+ t.string "nickname"
26
+ t.string "image"
27
+ t.string "email"
28
+ t.text "tokens"
29
+ t.datetime "created_at"
30
+ t.datetime "updated_at"
31
+ t.index ["email"], name: "index_lockable_users_on_email"
32
+ t.index ["uid", "provider"], name: "index_lockable_users_on_uid_and_provider", unique: true
33
+ t.index ["unlock_token"], name: "index_lockable_users_on_unlock_token", unique: true
34
+ end
35
+
36
+ create_table "mangs", force: :cascade do |t|
37
+ t.string "email"
38
+ t.string "encrypted_password", default: "", null: false
39
+ t.string "reset_password_token"
40
+ t.datetime "reset_password_sent_at"
41
+ t.string "reset_password_redirect_url"
42
+ t.boolean "allow_password_change", default: false
43
+ t.datetime "remember_created_at"
44
+ t.integer "sign_in_count", default: 0, null: false
45
+ t.datetime "current_sign_in_at"
46
+ t.datetime "last_sign_in_at"
47
+ t.string "current_sign_in_ip"
48
+ t.string "last_sign_in_ip"
49
+ t.string "confirmation_token"
50
+ t.datetime "confirmed_at"
51
+ t.datetime "confirmation_sent_at"
52
+ t.string "unconfirmed_email"
53
+ t.string "name"
54
+ t.string "nickname"
55
+ t.string "image"
56
+ t.string "provider"
57
+ t.string "uid", default: "", null: false
58
+ t.text "tokens"
59
+ t.datetime "created_at"
60
+ t.datetime "updated_at"
61
+ t.string "favorite_color"
62
+ t.index ["confirmation_token"], name: "index_mangs_on_confirmation_token", unique: true
63
+ t.index ["email"], name: "index_mangs_on_email"
64
+ t.index ["reset_password_token"], name: "index_mangs_on_reset_password_token", unique: true
65
+ t.index ["uid", "provider"], name: "index_mangs_on_uid_and_provider", unique: true
66
+ end
67
+
68
+ create_table "only_email_users", force: :cascade do |t|
69
+ t.string "provider", null: false
70
+ t.string "uid", default: "", null: false
71
+ t.string "encrypted_password", default: "", null: false
72
+ t.string "name"
73
+ t.string "nickname"
74
+ t.string "image"
75
+ t.string "email"
76
+ t.text "tokens"
77
+ t.datetime "created_at"
78
+ t.datetime "updated_at"
79
+ t.index ["email"], name: "index_only_email_users_on_email"
80
+ t.index ["uid", "provider"], name: "index_only_email_users_on_uid_and_provider", unique: true
81
+ end
82
+
83
+ create_table "scoped_users", force: :cascade do |t|
84
+ t.string "provider", null: false
85
+ t.string "uid", default: "", null: false
86
+ t.string "encrypted_password", default: "", null: false
87
+ t.string "reset_password_token"
88
+ t.datetime "reset_password_sent_at"
89
+ t.boolean "allow_password_change", default: false
90
+ t.datetime "remember_created_at"
91
+ t.integer "sign_in_count", default: 0, null: false
92
+ t.datetime "current_sign_in_at"
93
+ t.datetime "last_sign_in_at"
94
+ t.string "current_sign_in_ip"
95
+ t.string "last_sign_in_ip"
96
+ t.string "confirmation_token"
97
+ t.datetime "confirmed_at"
98
+ t.datetime "confirmation_sent_at"
99
+ t.string "unconfirmed_email"
100
+ t.string "name"
101
+ t.string "nickname"
102
+ t.string "image"
103
+ t.string "email"
104
+ t.text "tokens"
105
+ t.datetime "created_at"
106
+ t.datetime "updated_at"
107
+ t.index ["email"], name: "index_scoped_users_on_email"
108
+ t.index ["reset_password_token"], name: "index_scoped_users_on_reset_password_token", unique: true
109
+ t.index ["uid", "provider"], name: "index_scoped_users_on_uid_and_provider", unique: true
110
+ end
111
+
112
+ create_table "unconfirmable_users", force: :cascade do |t|
113
+ t.string "provider", null: false
114
+ t.string "uid", default: "", null: false
115
+ t.string "encrypted_password", default: "", null: false
116
+ t.string "reset_password_token"
117
+ t.datetime "reset_password_sent_at"
118
+ t.boolean "allow_password_change", default: false
119
+ t.datetime "remember_created_at"
120
+ t.integer "sign_in_count", default: 0, null: false
121
+ t.datetime "current_sign_in_at"
122
+ t.datetime "last_sign_in_at"
123
+ t.string "current_sign_in_ip"
124
+ t.string "last_sign_in_ip"
125
+ t.string "name"
126
+ t.string "nickname"
127
+ t.string "image"
128
+ t.string "email"
129
+ t.text "tokens"
130
+ t.datetime "created_at"
131
+ t.datetime "updated_at"
132
+ t.index ["email"], name: "index_unconfirmable_users_on_email"
133
+ t.index ["reset_password_token"], name: "index_unconfirmable_users_on_reset_password_token", unique: true
134
+ t.index ["uid", "provider"], name: "index_unconfirmable_users_on_uid_and_provider", unique: true
135
+ end
136
+
137
+ create_table "unregisterable_users", force: :cascade do |t|
138
+ t.string "provider", null: false
139
+ t.string "uid", default: "", null: false
140
+ t.string "encrypted_password", default: "", null: false
141
+ t.string "reset_password_token"
142
+ t.datetime "reset_password_sent_at"
143
+ t.boolean "allow_password_change", default: false
144
+ t.datetime "remember_created_at"
145
+ t.integer "sign_in_count", default: 0, null: false
146
+ t.datetime "current_sign_in_at"
147
+ t.datetime "last_sign_in_at"
148
+ t.string "current_sign_in_ip"
149
+ t.string "last_sign_in_ip"
150
+ t.string "confirmation_token"
151
+ t.datetime "confirmed_at"
152
+ t.datetime "confirmation_sent_at"
153
+ t.string "unconfirmed_email"
154
+ t.string "name"
155
+ t.string "nickname"
156
+ t.string "image"
157
+ t.string "email"
158
+ t.text "tokens"
159
+ t.datetime "created_at"
160
+ t.datetime "updated_at"
161
+ t.index ["email"], name: "index_unregisterable_users_on_email"
162
+ t.index ["reset_password_token"], name: "index_unregisterable_users_on_reset_password_token", unique: true
163
+ t.index ["uid", "provider"], name: "index_unregisterable_users_on_uid_and_provider", unique: true
164
+ end
165
+
166
+ create_table "users", force: :cascade do |t|
167
+ t.string "email"
168
+ t.string "encrypted_password", default: "", null: false
169
+ t.string "reset_password_token"
170
+ t.datetime "reset_password_sent_at"
171
+ t.string "reset_password_redirect_url"
172
+ t.boolean "allow_password_change", default: false
173
+ t.datetime "remember_created_at"
174
+ t.integer "sign_in_count", default: 0, null: false
175
+ t.datetime "current_sign_in_at"
176
+ t.datetime "last_sign_in_at"
177
+ t.string "current_sign_in_ip"
178
+ t.string "last_sign_in_ip"
179
+ t.string "confirmation_token"
180
+ t.datetime "confirmed_at"
181
+ t.datetime "confirmation_sent_at"
182
+ t.string "unconfirmed_email"
183
+ t.string "name"
184
+ t.string "nickname"
185
+ t.string "image"
186
+ t.string "provider"
187
+ t.string "uid", default: "", null: false
188
+ t.text "tokens"
189
+ t.datetime "created_at"
190
+ t.datetime "updated_at"
191
+ t.integer "operating_thetan"
192
+ t.string "favorite_color"
193
+ t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true
194
+ t.index ["email"], name: "index_users_on_email"
195
+ t.index ["nickname"], name: "index_users_on_nickname", unique: true
196
+ t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
197
+ t.index ["uid", "provider"], name: "index_users_on_uid_and_provider", unique: true
198
+ end
199
+
200
+ end