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,19 @@
1
+ module FavoriteColor
2
+ extend ActiveSupport::Concern
3
+
4
+ included do
5
+ validates :operating_thetan, numericality: true, allow_nil: true
6
+ validate :ensure_correct_favorite_color
7
+ end
8
+
9
+ def ensure_correct_favorite_color
10
+ if favorite_color && (favorite_color != '')
11
+ unless ApplicationHelper::COLOR_NAMES.any?{ |s| s.casecmp(favorite_color)==0 }
12
+ matches = ApplicationHelper::COLOR_SEARCH.search(favorite_color)
13
+ closest_match = matches.last[:string]
14
+ second_closest_match = matches[-2][:string]
15
+ errors.add(:favorite_color, "We've never heard of the color \"#{favorite_color}\". Did you mean \"#{closest_match}\"? Or perhaps \"#{second_closest_match}\"?")
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ class LockableUser
4
+ include Mongoid::Document
5
+ include Mongoid::Timestamps
6
+ include Mongoid::Locker
7
+
8
+ field :locker_locked_at, type: Time
9
+ field :locker_locked_until, type: Time
10
+
11
+ locker locked_at_field: :locker_locked_at,
12
+ locked_until_field: :locker_locked_until
13
+
14
+ ## User Info
15
+ field :name, type: String
16
+ field :nickname, type: String
17
+ field :image, type: String
18
+
19
+ ## Database authenticatable
20
+ field :email, type: String, default: ''
21
+ field :encrypted_password, type: String, default: ''
22
+
23
+ ## Lockable
24
+ field :failed_attempts, type: Integer, default: 0 # Only if lock strategy is :failed_attempts
25
+ field :unlock_token, type: String # Only if unlock strategy is :email or :both
26
+ field :locked_at, type: Time
27
+
28
+ ## Required
29
+ field :provider, type: String
30
+ field :uid, type: String, default: ''
31
+
32
+ ## Tokens
33
+ field :tokens, type: Hash, default: {}
34
+
35
+ # Include default devise modules.
36
+ devise :database_authenticatable, :registerable, :lockable
37
+ include DeviseTokenAuth::Concerns::User
38
+ end
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Mang
4
+ include Mongoid::Document
5
+ include Mongoid::Timestamps
6
+ include Mongoid::Locker
7
+
8
+ field :locker_locked_at, type: Time
9
+ field :locker_locked_until, type: Time
10
+
11
+ locker locked_at_field: :locker_locked_at,
12
+ locked_until_field: :locker_locked_until
13
+
14
+ ## User Info
15
+ field :name, type: String
16
+ field :nickname, type: String
17
+ field :image, type: String
18
+
19
+ ## Database authenticatable
20
+ field :email, type: String, default: ''
21
+ field :encrypted_password, type: String, default: ''
22
+
23
+ ## Recoverable
24
+ field :reset_password_token, type: String
25
+ field :reset_password_sent_at, type: Time
26
+ field :reset_password_redirect_url, type: String
27
+ field :allow_password_change, type: Boolean, default: false
28
+
29
+ ## Rememberable
30
+ field :remember_created_at, type: Time
31
+
32
+ ## Trackable
33
+ field :sign_in_count, type: Integer, default: 0
34
+ field :current_sign_in_at, type: Time
35
+ field :last_sign_in_at, type: Time
36
+ field :current_sign_in_ip, type: String
37
+ field :last_sign_in_ip, type: String
38
+
39
+ ## Confirmable
40
+ field :confirmation_token, type: String
41
+ field :confirmed_at, type: Time
42
+ field :confirmation_sent_at, type: Time
43
+ field :unconfirmed_email, type: String # Only if using reconfirmable
44
+
45
+ ## Required
46
+ field :provider, type: String
47
+ field :uid, type: String, default: ''
48
+
49
+ ## Tokens
50
+ field :tokens, type: Hash, default: {}
51
+
52
+ include DeviseTokenAuth::Concerns::User
53
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ class OnlyEmailUser
4
+ include Mongoid::Document
5
+ include Mongoid::Timestamps
6
+ include Mongoid::Locker
7
+
8
+ field :locker_locked_at, type: Time
9
+ field :locker_locked_until, type: Time
10
+
11
+ locker locked_at_field: :locker_locked_at,
12
+ locked_until_field: :locker_locked_until
13
+
14
+ ## User Info
15
+ field :name, type: String
16
+ field :nickname, type: String
17
+ field :image, type: String
18
+
19
+ ## Database authenticatable
20
+ field :email, type: String, default: ''
21
+ field :encrypted_password, type: String, default: ''
22
+
23
+ ## Required
24
+ field :provider, type: String
25
+ field :uid, type: String, default: ''
26
+
27
+ ## Tokens
28
+ field :tokens, type: Hash, default: {}
29
+
30
+ # Include default devise modules.
31
+ devise :database_authenticatable, :registerable
32
+ include DeviseTokenAuth::Concerns::User
33
+ end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ScopedUser
4
+ include Mongoid::Document
5
+ include Mongoid::Timestamps
6
+ include Mongoid::Locker
7
+
8
+ field :locker_locked_at, type: Time
9
+ field :locker_locked_until, type: Time
10
+
11
+ locker locked_at_field: :locker_locked_at,
12
+ locked_until_field: :locker_locked_until
13
+
14
+ ## User Info
15
+ field :name, type: String
16
+ field :nickname, type: String
17
+ field :image, type: String
18
+
19
+ ## Database authenticatable
20
+ field :email, type: String, default: ''
21
+ field :encrypted_password, type: String, default: ''
22
+
23
+ ## Recoverable
24
+ field :reset_password_token, type: String
25
+ field :reset_password_sent_at, type: Time
26
+ field :reset_password_redirect_url, type: String
27
+ field :allow_password_change, type: Boolean, default: false
28
+
29
+ ## Rememberable
30
+ field :remember_created_at, type: Time
31
+
32
+ ## Trackable
33
+ field :sign_in_count, type: Integer, default: 0
34
+ field :current_sign_in_at, type: Time
35
+ field :last_sign_in_at, type: Time
36
+ field :current_sign_in_ip, type: String
37
+ field :last_sign_in_ip, type: String
38
+
39
+ ## Confirmable
40
+ field :confirmation_token, type: String
41
+ field :confirmed_at, type: Time
42
+ field :confirmation_sent_at, type: Time
43
+ field :unconfirmed_email, type: String # Only if using reconfirmable
44
+
45
+ ## Required
46
+ field :provider, type: String
47
+ field :uid, type: String, default: ''
48
+
49
+ ## Tokens
50
+ field :tokens, type: Hash, default: {}
51
+
52
+ # Include default devise modules.
53
+ devise :database_authenticatable, :registerable,
54
+ :recoverable, :rememberable, :trackable,
55
+ :validatable, :confirmable, :omniauthable
56
+ include DeviseTokenAuth::Concerns::User
57
+ end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ class UnconfirmableUser
4
+ include Mongoid::Document
5
+ include Mongoid::Timestamps
6
+ include Mongoid::Locker
7
+
8
+ field :locker_locked_at, type: Time
9
+ field :locker_locked_until, type: Time
10
+
11
+ locker locked_at_field: :locker_locked_at,
12
+ locked_until_field: :locker_locked_until
13
+
14
+ ## User Info
15
+ field :name, type: String
16
+ field :nickname, type: String
17
+ field :image, type: String
18
+
19
+ ## Database authenticatable
20
+ field :email, type: String, default: ''
21
+ field :encrypted_password, type: String, default: ''
22
+
23
+ ## Recoverable
24
+ field :reset_password_token, type: String
25
+ field :reset_password_sent_at, type: Time
26
+ field :reset_password_redirect_url, type: String
27
+ field :allow_password_change, type: Boolean, default: false
28
+
29
+ ## Rememberable
30
+ field :remember_created_at, type: Time
31
+
32
+ ## Trackable
33
+ field :sign_in_count, type: Integer, default: 0
34
+ field :current_sign_in_at, type: Time
35
+ field :last_sign_in_at, type: Time
36
+ field :current_sign_in_ip, type: String
37
+ field :last_sign_in_ip, type: String
38
+
39
+ ## Required
40
+ field :provider, type: String
41
+ field :uid, type: String, default: ''
42
+
43
+ ## Tokens
44
+ field :tokens, type: Hash, default: {}
45
+
46
+ # Include default devise modules.
47
+ devise :database_authenticatable, :registerable,
48
+ :recoverable, :rememberable, :trackable,
49
+ :validatable, :omniauthable
50
+ include DeviseTokenAuth::Concerns::User
51
+ end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ class UnregisterableUser
4
+ include Mongoid::Document
5
+ include Mongoid::Timestamps
6
+ include Mongoid::Locker
7
+
8
+ field :locker_locked_at, type: Time
9
+ field :locker_locked_until, type: Time
10
+
11
+ locker locked_at_field: :locker_locked_at,
12
+ locked_until_field: :locker_locked_until
13
+
14
+ ## User Info
15
+ field :name, type: String
16
+ field :nickname, type: String
17
+ field :image, type: String
18
+
19
+ ## Database authenticatable
20
+ field :email, type: String, default: ''
21
+ field :encrypted_password, type: String, default: ''
22
+
23
+ ## Recoverable
24
+ field :reset_password_token, type: String
25
+ field :reset_password_sent_at, type: Time
26
+ field :reset_password_redirect_url, type: String
27
+ field :allow_password_change, type: Boolean, default: false
28
+
29
+ ## Trackable
30
+ field :sign_in_count, type: Integer, default: 0
31
+ field :current_sign_in_at, type: Time
32
+ field :last_sign_in_at, type: Time
33
+ field :current_sign_in_ip, type: String
34
+ field :last_sign_in_ip, type: String
35
+
36
+ ## Confirmable
37
+ field :confirmation_token, type: String
38
+ field :confirmed_at, type: Time
39
+ field :confirmation_sent_at, type: Time
40
+ field :unconfirmed_email, type: String # Only if using reconfirmable
41
+
42
+ ## Required
43
+ field :provider, type: String
44
+ field :uid, type: String, default: ''
45
+
46
+ ## Tokens
47
+ field :tokens, type: Hash, default: {}
48
+
49
+ # Include default devise modules.
50
+ devise :database_authenticatable, :recoverable,
51
+ :trackable, :validatable, :confirmable,
52
+ :omniauthable
53
+ include DeviseTokenAuth::Concerns::User
54
+ end
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ class User
4
+ include Mongoid::Document
5
+ include Mongoid::Timestamps
6
+ include Mongoid::Locker
7
+
8
+ field :locker_locked_at, type: Time
9
+ field :locker_locked_until, type: Time
10
+
11
+ locker locked_at_field: :locker_locked_at,
12
+ locked_until_field: :locker_locked_until
13
+
14
+ ## User Info
15
+ field :name, type: String
16
+ field :nickname, type: String
17
+ field :image, type: String
18
+ field :favorite_color, type: String
19
+ field :operating_thetan, type: Integer
20
+
21
+ ## Database authenticatable
22
+ field :email, type: String, default: ''
23
+ field :encrypted_password, type: String, default: ''
24
+
25
+ ## Recoverable
26
+ field :reset_password_token, type: String
27
+ field :reset_password_sent_at, type: Time
28
+ field :reset_password_redirect_url, type: String
29
+ field :allow_password_change, type: Boolean, default: false
30
+
31
+ ## Rememberable
32
+ field :remember_created_at, type: Time
33
+
34
+ ## Trackable
35
+ field :sign_in_count, type: Integer, default: 0
36
+ field :current_sign_in_at, type: Time
37
+ field :last_sign_in_at, type: Time
38
+ field :current_sign_in_ip, type: String
39
+ field :last_sign_in_ip, type: String
40
+
41
+ ## Confirmable
42
+ field :confirmation_token, type: String
43
+ field :confirmed_at, type: Time
44
+ field :confirmation_sent_at, type: Time
45
+ field :unconfirmed_email, type: String # Only if using reconfirmable
46
+
47
+ ## Required
48
+ field :provider, type: String
49
+ field :uid, type: String, default: ''
50
+
51
+ ## Tokens
52
+ field :tokens, type: Hash, default: {}
53
+
54
+ include DeviseTokenAuth::Concerns::User
55
+ include FavoriteColor
56
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
6
+ <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is used by Rack-based servers to start the application.
4
+
5
+ require ::File.expand_path('../config/environment', __FILE__)
6
+ run Rails.application
7
+
8
+ # allow cross origin requests
9
+ require 'rack/cors'
10
+ use Rack::Cors do
11
+ allow do
12
+ origins '*'
13
+ resource '*',
14
+ headers: :any,
15
+ expose: ['access-token', 'expiry', 'token-type', 'uid', 'client'],
16
+ methods: %i[get post options delete put]
17
+ end
18
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ require File.expand_path('boot', __dir__)
4
+
5
+ require 'action_controller/railtie'
6
+ require 'action_mailer/railtie'
7
+ require 'sprockets/railtie'
8
+ require 'rails/generators'
9
+ require 'rack/cors'
10
+
11
+ Bundler.require(*Rails.groups)
12
+
13
+ begin
14
+ case DEVISE_TOKEN_AUTH_ORM
15
+ when :active_record
16
+ require 'active_record/railtie'
17
+ when :mongoid
18
+ require 'mongoid'
19
+ require 'mongoid-locker'
20
+ end
21
+ rescue LoadError
22
+ end
23
+
24
+ require 'devise_token_auth'
25
+
26
+ module Dummy
27
+ class Application < Rails::Application
28
+ # Settings in config/environments/* take precedence over those specified here.
29
+ # Application configuration should go into files in config/initializers
30
+ # -- all .rb files in that directory are automatically loaded.
31
+
32
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
33
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
34
+ # config.time_zone = 'Central Time (US & Canada)'
35
+
36
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
37
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
38
+ # config.i18n.default_locale = :de
39
+ config.autoload_paths << Rails.root.join('lib')
40
+ config.autoload_paths += ["#{config.root}/app/#{DEVISE_TOKEN_AUTH_ORM}"]
41
+
42
+ if DEVISE_TOKEN_AUTH_ORM == :mongoid
43
+ Mongoid.configure do |config|
44
+ config.load! Rails.root.join('./config/mongoid.yml')
45
+ end
46
+ end
47
+ end
48
+ end