digix_devise_token_auth 0.1.44
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +13 -0
- data/README.md +952 -0
- data/Rakefile +35 -0
- data/app/controllers/devise_token_auth/application_controller.rb +76 -0
- data/app/controllers/devise_token_auth/concerns/resource_finder.rb +43 -0
- data/app/controllers/devise_token_auth/concerns/set_user_by_token.rb +165 -0
- data/app/controllers/devise_token_auth/confirmations_controller.rb +30 -0
- data/app/controllers/devise_token_auth/omniauth_callbacks_controller.rb +243 -0
- data/app/controllers/devise_token_auth/passwords_controller.rb +202 -0
- data/app/controllers/devise_token_auth/registrations_controller.rb +205 -0
- data/app/controllers/devise_token_auth/sessions_controller.rb +133 -0
- data/app/controllers/devise_token_auth/token_validations_controller.rb +29 -0
- data/app/controllers/devise_token_auth/unlocks_controller.rb +89 -0
- data/app/models/devise_token_auth/concerns/user.rb +260 -0
- data/app/models/devise_token_auth/concerns/user_omniauth_callbacks.rb +26 -0
- data/app/validators/email_validator.rb +21 -0
- data/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
- data/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
- data/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
- data/app/views/devise_token_auth/omniauth_external_window.html.erb +38 -0
- data/config/initializers/devise.rb +196 -0
- data/config/locales/da-DK.yml +50 -0
- data/config/locales/de.yml +49 -0
- data/config/locales/en.yml +50 -0
- data/config/locales/es.yml +49 -0
- data/config/locales/fr.yml +49 -0
- data/config/locales/it.yml +46 -0
- data/config/locales/ja.yml +46 -0
- data/config/locales/nl.yml +30 -0
- data/config/locales/pl.yml +48 -0
- data/config/locales/pt-BR.yml +46 -0
- data/config/locales/pt.yml +48 -0
- data/config/locales/ro.yml +46 -0
- data/config/locales/ru.yml +50 -0
- data/config/locales/sq.yml +46 -0
- data/config/locales/uk.yml +59 -0
- data/config/locales/vi.yml +50 -0
- data/config/locales/zh-CN.yml +46 -0
- data/config/locales/zh-HK.yml +48 -0
- data/config/locales/zh-TW.yml +48 -0
- data/lib/devise_token_auth.rb +8 -0
- data/lib/devise_token_auth/controllers/helpers.rb +149 -0
- data/lib/devise_token_auth/controllers/url_helpers.rb +8 -0
- data/lib/devise_token_auth/engine.rb +90 -0
- data/lib/devise_token_auth/rails/routes.rb +114 -0
- data/lib/devise_token_auth/url.rb +37 -0
- data/lib/devise_token_auth/version.rb +3 -0
- data/lib/generators/devise_token_auth/USAGE +31 -0
- data/lib/generators/devise_token_auth/install_generator.rb +160 -0
- data/lib/generators/devise_token_auth/install_views_generator.rb +16 -0
- data/lib/generators/devise_token_auth/templates/devise_token_auth.rb +48 -0
- data/lib/generators/devise_token_auth/templates/devise_token_auth_create_users.rb.erb +55 -0
- data/lib/generators/devise_token_auth/templates/user.rb +7 -0
- data/lib/tasks/devise_token_auth_tasks.rake +4 -0
- data/test/controllers/custom/custom_confirmations_controller_test.rb +21 -0
- data/test/controllers/custom/custom_omniauth_callbacks_controller_test.rb +29 -0
- data/test/controllers/custom/custom_passwords_controller_test.rb +75 -0
- data/test/controllers/custom/custom_registrations_controller_test.rb +54 -0
- data/test/controllers/custom/custom_sessions_controller_test.rb +37 -0
- data/test/controllers/custom/custom_token_validations_controller_test.rb +40 -0
- data/test/controllers/demo_group_controller_test.rb +153 -0
- data/test/controllers/demo_mang_controller_test.rb +284 -0
- data/test/controllers/demo_user_controller_test.rb +601 -0
- data/test/controllers/devise_token_auth/confirmations_controller_test.rb +129 -0
- data/test/controllers/devise_token_auth/omniauth_callbacks_controller_test.rb +371 -0
- data/test/controllers/devise_token_auth/passwords_controller_test.rb +649 -0
- data/test/controllers/devise_token_auth/registrations_controller_test.rb +878 -0
- data/test/controllers/devise_token_auth/sessions_controller_test.rb +500 -0
- data/test/controllers/devise_token_auth/token_validations_controller_test.rb +90 -0
- data/test/controllers/devise_token_auth/unlocks_controller_test.rb +194 -0
- data/test/controllers/overrides/confirmations_controller_test.rb +43 -0
- data/test/controllers/overrides/omniauth_callbacks_controller_test.rb +49 -0
- data/test/controllers/overrides/passwords_controller_test.rb +66 -0
- data/test/controllers/overrides/registrations_controller_test.rb +40 -0
- data/test/controllers/overrides/sessions_controller_test.rb +33 -0
- data/test/controllers/overrides/token_validations_controller_test.rb +41 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/app/controllers/application_controller.rb +16 -0
- data/test/dummy/app/controllers/auth_origin_controller.rb +5 -0
- data/test/dummy/app/controllers/custom/confirmations_controller.rb +13 -0
- data/test/dummy/app/controllers/custom/omniauth_callbacks_controller.rb +11 -0
- data/test/dummy/app/controllers/custom/passwords_controller.rb +40 -0
- data/test/dummy/app/controllers/custom/registrations_controller.rb +39 -0
- data/test/dummy/app/controllers/custom/sessions_controller.rb +29 -0
- data/test/dummy/app/controllers/custom/token_validations_controller.rb +19 -0
- data/test/dummy/app/controllers/demo_group_controller.rb +13 -0
- data/test/dummy/app/controllers/demo_mang_controller.rb +12 -0
- data/test/dummy/app/controllers/demo_user_controller.rb +25 -0
- data/test/dummy/app/controllers/overrides/confirmations_controller.rb +26 -0
- data/test/dummy/app/controllers/overrides/omniauth_callbacks_controller.rb +14 -0
- data/test/dummy/app/controllers/overrides/passwords_controller.rb +33 -0
- data/test/dummy/app/controllers/overrides/registrations_controller.rb +27 -0
- data/test/dummy/app/controllers/overrides/sessions_controller.rb +36 -0
- data/test/dummy/app/controllers/overrides/token_validations_controller.rb +23 -0
- data/test/dummy/app/helpers/application_helper.rb +1065 -0
- data/test/dummy/app/models/evil_user.rb +3 -0
- data/test/dummy/app/models/lockable_user.rb +5 -0
- data/test/dummy/app/models/mang.rb +3 -0
- data/test/dummy/app/models/nice_user.rb +7 -0
- data/test/dummy/app/models/only_email_user.rb +5 -0
- data/test/dummy/app/models/scoped_user.rb +7 -0
- data/test/dummy/app/models/unconfirmable_user.rb +8 -0
- data/test/dummy/app/models/unregisterable_user.rb +7 -0
- data/test/dummy/app/models/user.rb +18 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/config.ru +16 -0
- data/test/dummy/config/application.rb +24 -0
- data/test/dummy/config/application.yml.bk +0 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +44 -0
- data/test/dummy/config/environments/production.rb +82 -0
- data/test/dummy/config/environments/test.rb +48 -0
- data/test/dummy/config/initializers/assets.rb +8 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/devise.rb +3 -0
- data/test/dummy/config/initializers/devise_token_auth.rb +22 -0
- data/test/dummy/config/initializers/figaro.rb +1 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/omniauth.rb +8 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/routes.rb +72 -0
- data/test/dummy/config/spring.rb +1 -0
- data/test/dummy/db/migrate/20140715061447_devise_token_auth_create_users.rb +63 -0
- data/test/dummy/db/migrate/20140715061805_devise_token_auth_create_mangs.rb +62 -0
- data/test/dummy/db/migrate/20140829044006_add_operating_thetan_to_user.rb +6 -0
- data/test/dummy/db/migrate/20140916224624_add_favorite_color_to_mangs.rb +5 -0
- data/test/dummy/db/migrate/20140928231203_devise_token_auth_create_evil_users.rb +64 -0
- data/test/dummy/db/migrate/20141222035835_devise_token_auth_create_only_email_users.rb +60 -0
- data/test/dummy/db/migrate/20141222053502_devise_token_auth_create_unregisterable_users.rb +61 -0
- data/test/dummy/db/migrate/20150409095712_devise_token_auth_create_nice_users.rb +61 -0
- data/test/dummy/db/migrate/20150708104536_devise_token_auth_create_unconfirmable_users.rb +61 -0
- data/test/dummy/db/migrate/20160103235141_devise_token_auth_create_scoped_users.rb +61 -0
- data/test/dummy/db/migrate/20160629184441_devise_token_auth_create_lockable_users.rb +61 -0
- data/test/dummy/db/schema.rb +258 -0
- data/test/dummy/lib/migration_database_helper.rb +29 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/lib/devise_token_auth/url_test.rb +24 -0
- data/test/lib/generators/devise_token_auth/install_generator_test.rb +187 -0
- data/test/lib/generators/devise_token_auth/install_views_generator_test.rb +23 -0
- data/test/models/only_email_user_test.rb +35 -0
- data/test/models/user_test.rb +169 -0
- data/test/test_helper.rb +77 -0
- metadata +342 -0
@@ -0,0 +1,72 @@
|
|
1
|
+
Rails.application.routes.draw do
|
2
|
+
# when using multiple models, controllers will default to the first available
|
3
|
+
# devise mapping. routes for subsequent devise mappings will need to defined
|
4
|
+
# within a `devise_scope` block
|
5
|
+
|
6
|
+
# define :users as the first devise mapping:
|
7
|
+
mount_devise_token_auth_for 'User', at: 'auth'
|
8
|
+
|
9
|
+
# define :mangs as the second devise mapping. routes using this class will
|
10
|
+
# need to be defined within a devise_scope as shown below
|
11
|
+
mount_devise_token_auth_for "Mang", at: 'mangs'
|
12
|
+
|
13
|
+
mount_devise_token_auth_for 'EvilUser', at: 'evil_user_auth', controllers: {
|
14
|
+
confirmations: 'overrides/confirmations',
|
15
|
+
passwords: 'overrides/passwords',
|
16
|
+
omniauth_callbacks: 'overrides/omniauth_callbacks',
|
17
|
+
registrations: 'overrides/registrations',
|
18
|
+
sessions: 'overrides/sessions',
|
19
|
+
token_validations: 'overrides/token_validations'
|
20
|
+
}
|
21
|
+
|
22
|
+
mount_devise_token_auth_for 'NiceUser', at: 'nice_user_auth', controllers: {
|
23
|
+
registrations: 'custom/registrations',
|
24
|
+
confirmations: 'custom/confirmations',
|
25
|
+
passwords: 'custom/passwords',
|
26
|
+
sessions: 'custom/sessions',
|
27
|
+
token_validations: 'custom/token_validations',
|
28
|
+
omniauth_callbacks: 'custom/omniauth_callbacks'
|
29
|
+
}
|
30
|
+
|
31
|
+
mount_devise_token_auth_for 'OnlyEmailUser', at: 'only_email_auth', skip: [:omniauth_callbacks]
|
32
|
+
|
33
|
+
mount_devise_token_auth_for 'UnregisterableUser', at: 'unregisterable_user_auth', skip: [:registrations]
|
34
|
+
|
35
|
+
mount_devise_token_auth_for 'UnconfirmableUser', at: 'unconfirmable_user_auth'
|
36
|
+
|
37
|
+
mount_devise_token_auth_for 'LockableUser', at: 'lockable_user_auth'
|
38
|
+
|
39
|
+
# test namespacing
|
40
|
+
namespace :api do
|
41
|
+
scope :v1 do
|
42
|
+
mount_devise_token_auth_for 'User', at: 'auth'
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# test namespacing with not created devise mapping
|
47
|
+
namespace :api_v2, defaults: { format: :json } do
|
48
|
+
mount_devise_token_auth_for "ScopedUser",
|
49
|
+
at: "auth",
|
50
|
+
controllers: {
|
51
|
+
omniauth_callbacks: "api_v2/omniauth_callbacks",
|
52
|
+
sessions: "api_v2/sessions",
|
53
|
+
registrations: "api_v2/registrations",
|
54
|
+
confirmations: "api_v2/confirmations",
|
55
|
+
passwords: "api_v2/passwords"
|
56
|
+
}
|
57
|
+
end
|
58
|
+
|
59
|
+
# this route will authorize visitors using the User class
|
60
|
+
get 'demo/members_only', to: 'demo_user#members_only'
|
61
|
+
get 'demo/members_only_remove_token', to: 'demo_user#members_only_remove_token'
|
62
|
+
|
63
|
+
|
64
|
+
# routes within this block will authorize visitors using the Mang class
|
65
|
+
get 'demo/members_only_mang', to: 'demo_mang#members_only'
|
66
|
+
|
67
|
+
# routes within this block will authorize visitors using the Mang or User class
|
68
|
+
get 'demo/members_only_group', to: 'demo_group#members_only'
|
69
|
+
|
70
|
+
# we need a route for omniauth_callback_controller to redirect to in sameWindow case
|
71
|
+
get 'auth_origin', to: 'auth_origin#redirected'
|
72
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
Spring.application_root = './test/dummy'
|
@@ -0,0 +1,63 @@
|
|
1
|
+
include MigrationDatabaseHelper
|
2
|
+
|
3
|
+
class DeviseTokenAuthCreateUsers < ActiveRecord::Migration[4.2]
|
4
|
+
def change
|
5
|
+
create_table(:users) do |t|
|
6
|
+
## Database authenticatable
|
7
|
+
t.string :email
|
8
|
+
t.string :encrypted_password, :null => false, :default => ""
|
9
|
+
|
10
|
+
## Recoverable
|
11
|
+
t.string :reset_password_token
|
12
|
+
t.datetime :reset_password_sent_at
|
13
|
+
t.string :reset_password_redirect_url
|
14
|
+
t.boolean :allow_password_change, :default => false
|
15
|
+
|
16
|
+
## Rememberable
|
17
|
+
t.datetime :remember_created_at
|
18
|
+
|
19
|
+
## Trackable
|
20
|
+
t.integer :sign_in_count, :default => 0, :null => false
|
21
|
+
t.datetime :current_sign_in_at
|
22
|
+
t.datetime :last_sign_in_at
|
23
|
+
t.string :current_sign_in_ip
|
24
|
+
t.string :last_sign_in_ip
|
25
|
+
|
26
|
+
## Confirmable
|
27
|
+
t.string :confirmation_token
|
28
|
+
t.datetime :confirmed_at
|
29
|
+
t.datetime :confirmation_sent_at
|
30
|
+
t.string :unconfirmed_email # Only if using reconfirmable
|
31
|
+
|
32
|
+
## Lockable
|
33
|
+
# t.integer :failed_attempts, :default => 0, :null => false # Only if lock strategy is :failed_attempts
|
34
|
+
# t.string :unlock_token # Only if unlock strategy is :email or :both
|
35
|
+
# t.datetime :locked_at
|
36
|
+
|
37
|
+
## User Info
|
38
|
+
t.string :name
|
39
|
+
t.string :nickname
|
40
|
+
t.string :image
|
41
|
+
|
42
|
+
## unique oauth id
|
43
|
+
t.string :provider
|
44
|
+
t.string :uid, :null => false, :default => ""
|
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 :users, :email
|
57
|
+
add_index :users, [:uid, :provider], :unique => true
|
58
|
+
add_index :users, :reset_password_token, :unique => true
|
59
|
+
add_index :users, :confirmation_token, :unique => true
|
60
|
+
add_index :users, :nickname, :unique => true
|
61
|
+
# add_index :users, :unlock_token, :unique => true
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
include MigrationDatabaseHelper
|
2
|
+
|
3
|
+
class DeviseTokenAuthCreateMangs < ActiveRecord::Migration[4.2]
|
4
|
+
def change
|
5
|
+
create_table(:mangs) do |t|
|
6
|
+
## Database authenticatable
|
7
|
+
t.string :email
|
8
|
+
t.string :encrypted_password, :null => false, :default => ""
|
9
|
+
|
10
|
+
## Recoverable
|
11
|
+
t.string :reset_password_token
|
12
|
+
t.datetime :reset_password_sent_at
|
13
|
+
t.string :reset_password_redirect_url
|
14
|
+
t.boolean :allow_password_change, :default => false
|
15
|
+
|
16
|
+
## Rememberable
|
17
|
+
t.datetime :remember_created_at
|
18
|
+
|
19
|
+
## Trackable
|
20
|
+
t.integer :sign_in_count, :default => 0, :null => false
|
21
|
+
t.datetime :current_sign_in_at
|
22
|
+
t.datetime :last_sign_in_at
|
23
|
+
t.string :current_sign_in_ip
|
24
|
+
t.string :last_sign_in_ip
|
25
|
+
|
26
|
+
## Confirmable
|
27
|
+
t.string :confirmation_token
|
28
|
+
t.datetime :confirmed_at
|
29
|
+
t.datetime :confirmation_sent_at
|
30
|
+
t.string :unconfirmed_email # Only if using reconfirmable
|
31
|
+
|
32
|
+
## Lockable
|
33
|
+
# t.integer :failed_attempts, :default => 0, :null => false # Only if lock strategy is :failed_attempts
|
34
|
+
# t.string :unlock_token # Only if unlock strategy is :email or :both
|
35
|
+
# t.datetime :locked_at
|
36
|
+
|
37
|
+
## User Info
|
38
|
+
t.string :name
|
39
|
+
t.string :nickname
|
40
|
+
t.string :image
|
41
|
+
|
42
|
+
## unique oauth id
|
43
|
+
t.string :provider
|
44
|
+
t.string :uid, :null => false, :default => ""
|
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 :mangs, :email
|
57
|
+
add_index :mangs, [:uid, :provider], :unique => true
|
58
|
+
add_index :mangs, :reset_password_token, :unique => true
|
59
|
+
add_index :mangs, :confirmation_token, :unique => true
|
60
|
+
# add_index :mangs, :unlock_token, :unique => true
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
include MigrationDatabaseHelper
|
2
|
+
|
3
|
+
class DeviseTokenAuthCreateEvilUsers < ActiveRecord::Migration[4.2]
|
4
|
+
def change
|
5
|
+
create_table(:evil_users) do |t|
|
6
|
+
## Database authenticatable
|
7
|
+
t.string :email
|
8
|
+
t.string :encrypted_password, :null => false, :default => ""
|
9
|
+
|
10
|
+
## Recoverable
|
11
|
+
t.string :reset_password_token
|
12
|
+
t.datetime :reset_password_sent_at
|
13
|
+
t.boolean :allow_password_change, :default => false
|
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
|
+
|
41
|
+
## unique oauth id
|
42
|
+
t.string :provider
|
43
|
+
t.string :uid, :null => false, :default => ""
|
44
|
+
|
45
|
+
## Tokens
|
46
|
+
if json_supported_database?
|
47
|
+
t.json :tokens
|
48
|
+
else
|
49
|
+
t.text :tokens
|
50
|
+
end
|
51
|
+
|
52
|
+
## etc.
|
53
|
+
t.string :favorite_color
|
54
|
+
|
55
|
+
t.timestamps
|
56
|
+
end
|
57
|
+
|
58
|
+
add_index :evil_users, :email
|
59
|
+
add_index :evil_users, [:uid, :provider], :unique => true
|
60
|
+
add_index :evil_users, :reset_password_token, :unique => true
|
61
|
+
add_index :evil_users, :confirmation_token, :unique => true
|
62
|
+
# add_index :evil_users, :unlock_token, :unique => true
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
include MigrationDatabaseHelper
|
2
|
+
|
3
|
+
class DeviseTokenAuthCreateOnlyEmailUsers < ActiveRecord::Migration[4.2]
|
4
|
+
def change
|
5
|
+
create_table(:only_email_users) do |t|
|
6
|
+
## Required
|
7
|
+
t.string :provider, :null => false
|
8
|
+
t.string :uid, :null => false, :default => ""
|
9
|
+
|
10
|
+
## Database authenticatable
|
11
|
+
t.string :encrypted_password, :null => false, :default => ""
|
12
|
+
|
13
|
+
## Recoverable
|
14
|
+
#t.string :reset_password_token
|
15
|
+
#t.datetime :reset_password_sent_at
|
16
|
+
|
17
|
+
## Rememberable
|
18
|
+
#t.datetime :remember_created_at
|
19
|
+
|
20
|
+
## Trackable
|
21
|
+
#t.integer :sign_in_count, :default => 0, :null => false
|
22
|
+
#t.datetime :current_sign_in_at
|
23
|
+
#t.datetime :last_sign_in_at
|
24
|
+
#t.string :current_sign_in_ip
|
25
|
+
#t.string :last_sign_in_ip
|
26
|
+
|
27
|
+
## Confirmable
|
28
|
+
#t.string :confirmation_token
|
29
|
+
#t.datetime :confirmed_at
|
30
|
+
#t.datetime :confirmation_sent_at
|
31
|
+
#t.string :unconfirmed_email # Only if using reconfirmable
|
32
|
+
|
33
|
+
## Lockable
|
34
|
+
# t.integer :failed_attempts, :default => 0, :null => false # Only if lock strategy is :failed_attempts
|
35
|
+
# t.string :unlock_token # Only if unlock strategy is :email or :both
|
36
|
+
# t.datetime :locked_at
|
37
|
+
|
38
|
+
## User Info
|
39
|
+
t.string :name
|
40
|
+
t.string :nickname
|
41
|
+
t.string :image
|
42
|
+
t.string :email
|
43
|
+
|
44
|
+
## Tokens
|
45
|
+
if json_supported_database?
|
46
|
+
t.json :tokens
|
47
|
+
else
|
48
|
+
t.text :tokens
|
49
|
+
end
|
50
|
+
|
51
|
+
t.timestamps
|
52
|
+
end
|
53
|
+
|
54
|
+
add_index :only_email_users, :email
|
55
|
+
add_index :only_email_users, [:uid, :provider], :unique => true
|
56
|
+
#add_index :only_email_users, :reset_password_token, :unique => true
|
57
|
+
# add_index :only_email_users, :confirmation_token, :unique => true
|
58
|
+
# add_index :only_email_users, :unlock_token, :unique => true
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
include MigrationDatabaseHelper
|
2
|
+
|
3
|
+
class DeviseTokenAuthCreateUnregisterableUsers < ActiveRecord::Migration[4.2]
|
4
|
+
def change
|
5
|
+
create_table(:unregisterable_users) do |t|
|
6
|
+
## Required
|
7
|
+
t.string :provider, :null => false
|
8
|
+
t.string :uid, :null => false, :default => ""
|
9
|
+
|
10
|
+
## Database authenticatable
|
11
|
+
t.string :encrypted_password, :null => false, :default => ""
|
12
|
+
|
13
|
+
## Recoverable
|
14
|
+
t.string :reset_password_token
|
15
|
+
t.datetime :reset_password_sent_at
|
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
|
+
t.string :email
|
44
|
+
|
45
|
+
## Tokens
|
46
|
+
if json_supported_database?
|
47
|
+
t.json :tokens
|
48
|
+
else
|
49
|
+
t.text :tokens
|
50
|
+
end
|
51
|
+
|
52
|
+
t.timestamps
|
53
|
+
end
|
54
|
+
|
55
|
+
add_index :unregisterable_users, :email
|
56
|
+
add_index :unregisterable_users, [:uid, :provider], :unique => true
|
57
|
+
add_index :unregisterable_users, :reset_password_token, :unique => true
|
58
|
+
# add_index :unregisterable_users, :confirmation_token, :unique => true
|
59
|
+
# add_index :unregisterable_users, :unlock_token, :unique => true
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
include MigrationDatabaseHelper
|
2
|
+
|
3
|
+
class DeviseTokenAuthCreateNiceUsers < ActiveRecord::Migration[4.2]
|
4
|
+
def change
|
5
|
+
create_table(:nice_users) do |t|
|
6
|
+
## Required
|
7
|
+
t.string :provider, :null => false
|
8
|
+
t.string :uid, :null => false, :default => ""
|
9
|
+
|
10
|
+
## Database authenticatable
|
11
|
+
t.string :encrypted_password, :null => false, :default => ""
|
12
|
+
|
13
|
+
## Recoverable
|
14
|
+
t.string :reset_password_token
|
15
|
+
t.datetime :reset_password_sent_at
|
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
|
+
t.string :email
|
44
|
+
|
45
|
+
## Tokens
|
46
|
+
if json_supported_database?
|
47
|
+
t.json :tokens
|
48
|
+
else
|
49
|
+
t.text :tokens
|
50
|
+
end
|
51
|
+
|
52
|
+
t.timestamps
|
53
|
+
end
|
54
|
+
|
55
|
+
add_index :nice_users, :email
|
56
|
+
add_index :nice_users, [:uid, :provider], :unique => true
|
57
|
+
add_index :nice_users, :reset_password_token, :unique => true
|
58
|
+
# add_index :nice_users, :confirmation_token, :unique => true
|
59
|
+
# add_index :nice_users, :unlock_token, :unique => true
|
60
|
+
end
|
61
|
+
end
|