devise_jwt_auth 0.1.1 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/app/controllers/devise_jwt_auth/application_controller.rb +15 -13
- data/app/controllers/devise_jwt_auth/concerns/resource_finder.rb +2 -6
- data/app/controllers/devise_jwt_auth/concerns/{set_user_by_jwt_token.rb → set_user_by_token.rb} +23 -19
- data/app/controllers/devise_jwt_auth/confirmations_controller.rb +10 -19
- data/app/controllers/devise_jwt_auth/omniauth_callbacks_controller.rb +32 -33
- data/app/controllers/devise_jwt_auth/passwords_controller.rb +29 -19
- data/app/controllers/devise_jwt_auth/refresh_token_controller.rb +4 -1
- data/app/controllers/devise_jwt_auth/registrations_controller.rb +40 -21
- data/app/controllers/devise_jwt_auth/sessions_controller.rb +21 -21
- data/app/controllers/devise_jwt_auth/unlocks_controller.rb +5 -4
- data/app/models/devise_jwt_auth/concerns/active_record_support.rb +3 -0
- data/app/models/devise_jwt_auth/concerns/confirmable_support.rb +7 -4
- data/app/models/devise_jwt_auth/concerns/mongoid_support.rb +3 -0
- data/app/models/devise_jwt_auth/concerns/tokens_serialization.rb +4 -1
- data/app/models/devise_jwt_auth/concerns/user.rb +18 -9
- data/app/models/devise_jwt_auth/concerns/user_omniauth_callbacks.rb +11 -3
- data/app/validators/devise_jwt_auth_email_validator.rb +5 -4
- data/lib/devise_jwt_auth/blacklist.rb +2 -0
- data/lib/devise_jwt_auth/controllers/url_helpers.rb +1 -2
- data/lib/devise_jwt_auth/engine.rb +4 -4
- data/lib/devise_jwt_auth/rails/routes.rb +35 -24
- data/lib/devise_jwt_auth/token_factory.rb +3 -2
- data/lib/devise_jwt_auth/url.rb +2 -4
- data/lib/devise_jwt_auth/version.rb +1 -1
- data/lib/generators/devise_jwt_auth/install_generator.rb +7 -6
- data/lib/generators/devise_jwt_auth/install_generator_helpers.rb +27 -6
- data/lib/generators/devise_jwt_auth/install_mongoid_generator.rb +3 -2
- data/lib/generators/devise_jwt_auth/templates/devise_jwt_auth.rb +15 -16
- data/lib/generators/devise_jwt_auth/templates/devise_jwt_auth_create_users.rb.erb +15 -11
- data/lib/generators/devise_jwt_auth/templates/user.rb.erb +2 -2
- data/test/controllers/custom/custom_confirmations_controller_test.rb +2 -2
- data/test/controllers/custom/custom_passwords_controller_test.rb +4 -4
- data/test/controllers/custom/custom_refresh_token_controller_test.rb +2 -3
- data/test/controllers/custom/custom_registrations_controller_test.rb +2 -2
- data/test/controllers/demo_mang_controller_test.rb +206 -210
- data/test/controllers/demo_user_controller_test.rb +358 -374
- data/test/controllers/devise_jwt_auth/confirmations_controller_test.rb +5 -5
- data/test/controllers/devise_jwt_auth/omniauth_callbacks_controller_test.rb +6 -7
- data/test/controllers/devise_jwt_auth/passwords_controller_test.rb +11 -13
- data/test/controllers/devise_jwt_auth/refresh_token_controller_test.rb +8 -12
- data/test/controllers/devise_jwt_auth/registrations_controller_test.rb +23 -25
- data/test/controllers/devise_jwt_auth/sessions_controller_test.rb +32 -34
- data/test/controllers/devise_jwt_auth/unlocks_controller_test.rb +2 -2
- data/test/controllers/overrides/confirmations_controller_test.rb +1 -1
- data/test/controllers/overrides/passwords_controller_test.rb +1 -1
- data/test/controllers/overrides/refresh_token_controller_test.rb +1 -2
- data/test/controllers/overrides/registrations_controller_test.rb +1 -1
- data/test/dummy/app/controllers/application_controller.rb +1 -1
- data/test/dummy/app/controllers/custom/refresh_token_controller.rb +2 -1
- data/test/dummy/app/controllers/custom/registrations_controller.rb +1 -1
- data/test/dummy/app/controllers/overrides/confirmations_controller.rb +4 -4
- data/test/dummy/app/controllers/overrides/omniauth_callbacks_controller.rb +4 -4
- data/test/dummy/app/controllers/overrides/passwords_controller.rb +4 -4
- data/test/dummy/app/controllers/overrides/refresh_token_controller.rb +1 -1
- data/test/dummy/app/controllers/overrides/registrations_controller.rb +2 -2
- data/test/dummy/app/controllers/overrides/sessions_controller.rb +2 -2
- data/test/dummy/app/models/concerns/favorite_color.rb +11 -9
- data/test/dummy/config.ru +2 -2
- data/test/dummy/config/application.rb +1 -0
- data/test/dummy/config/boot.rb +1 -1
- data/test/dummy/config/environments/test.rb +11 -7
- data/test/dummy/config/initializers/figaro.rb +1 -1
- data/test/dummy/config/initializers/omniauth.rb +2 -2
- data/test/dummy/config/routes.rb +8 -8
- data/test/dummy/db/migrate/{20140715061447_devise_token_auth_create_users.rb → 20140715061447_devise_jwt_auth_create_users.rb} +0 -0
- data/test/dummy/db/migrate/{20140715061805_devise_token_auth_create_mangs.rb → 20140715061805_devise_jwt_auth_create_mangs.rb} +0 -0
- data/test/dummy/db/migrate/{20141222035835_devise_token_auth_create_only_email_users.rb → 20141222035835_devise_jwt_auth_create_only_email_users.rb} +9 -9
- data/test/dummy/db/migrate/{20141222053502_devise_token_auth_create_unregisterable_users.rb → 20141222053502_devise_jwt_auth_create_unregisterable_users.rb} +0 -0
- data/test/dummy/db/migrate/{20150708104536_devise_token_auth_create_unconfirmable_users.rb → 20150708104536_devise_jwt_auth_create_unconfirmable_users.rb} +0 -0
- data/test/dummy/db/migrate/{20160103235141_devise_token_auth_create_scoped_users.rb → 20160103235141_devise_jwt_auth_create_scoped_users.rb} +0 -0
- data/test/dummy/db/migrate/{20160629184441_devise_token_auth_create_lockable_users.rb → 20160629184441_devise_jwt_auth_create_lockable_users.rb} +0 -0
- data/test/dummy/db/migrate/{20190924101113_devise_token_auth_create_confirmable_users.rb → 20190924101113_devise_jwt_auth_create_confirmable_users.rb} +6 -5
- data/test/dummy/db/schema.rb +170 -170
- data/test/dummy/tmp/generators/app/controllers/application_controller.rb +6 -0
- data/test/dummy/tmp/generators/app/models/user.rb +9 -0
- data/test/dummy/tmp/generators/config/initializers/devise_jwt_auth.rb +73 -0
- data/test/dummy/tmp/generators/db/migrate/20201006030349_devise_jwt_auth_create_users.rb +54 -0
- data/test/factories/users.rb +5 -3
- data/test/lib/devise_jwt_auth/token_factory_test.rb +6 -6
- data/test/lib/generators/devise_jwt_auth/install_generator_test.rb +3 -20
- data/test/lib/generators/devise_jwt_auth/install_generator_with_namespace_test.rb +4 -21
- data/test/models/concerns/tokens_serialization_test.rb +68 -68
- data/test/models/user_test.rb +35 -37
- data/test/support/controllers/routes.rb +7 -5
- data/test/test_helper.rb +1 -1
- metadata +70 -76
@@ -20,7 +20,7 @@ class Overrides::ConfirmationsControllerTest < ActionDispatch::IntegrationTest
|
|
20
20
|
@new_user.send_confirmation_instructions(redirect_url: @redirect_url)
|
21
21
|
|
22
22
|
@mail = ActionMailer::Base.deliveries.last
|
23
|
-
@confirmation_path = @mail.body.match(/localhost([
|
23
|
+
@confirmation_path = @mail.body.match(/localhost([^"]*)"/)[1]
|
24
24
|
|
25
25
|
# visit confirmation link
|
26
26
|
get @confirmation_path
|
@@ -24,7 +24,7 @@ class Overrides::PasswordsControllerTest < ActionDispatch::IntegrationTest
|
|
24
24
|
mail = ActionMailer::Base.deliveries.last
|
25
25
|
@resource.reload
|
26
26
|
|
27
|
-
mail_reset_token = mail.body.match(/reset_password_token=(.*)
|
27
|
+
mail_reset_token = mail.body.match(/reset_password_token=(.*)"/)[1]
|
28
28
|
mail_redirect_url = CGI.unescape(mail.body.match(/redirect_url=([^&]*)&/)[1])
|
29
29
|
|
30
30
|
get '/evil_user_auth/password/edit',
|
@@ -15,8 +15,7 @@ class Overrides::RefreshTokenControllerTest < ActionDispatch::IntegrationTest
|
|
15
15
|
before do
|
16
16
|
@resource = create(:user, :confirmed)
|
17
17
|
@auth_headers = get_cookie_header(DeviseJwtAuth.refresh_token_name,
|
18
|
-
|
19
|
-
)
|
18
|
+
@resource.create_refresh_token)
|
20
19
|
|
21
20
|
get '/evil_user_auth/refresh_token',
|
22
21
|
params: {},
|
@@ -14,7 +14,7 @@ class Overrides::RegistrationsControllerTest < ActionDispatch::IntegrationTest
|
|
14
14
|
describe Overrides::RegistrationsController do
|
15
15
|
describe 'Succesful Registration update' do
|
16
16
|
before do
|
17
|
-
@existing_user
|
17
|
+
@existing_user = create(:user, :confirmed)
|
18
18
|
@auth_headers = @existing_user.create_named_token_pair
|
19
19
|
|
20
20
|
# @client_id = @auth_headers['client']
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class ApplicationController < ActionController::Base
|
4
|
-
include DeviseJwtAuth::Concerns::
|
4
|
+
include DeviseJwtAuth::Concerns::SetUserByToken
|
5
5
|
|
6
6
|
before_action :configure_permitted_parameters, if: :devise_controller?
|
7
7
|
|
@@ -5,18 +5,18 @@ module Overrides
|
|
5
5
|
def show
|
6
6
|
@resource = resource_class.confirm_by_token(params[:confirmation_token])
|
7
7
|
|
8
|
-
if @resource
|
8
|
+
if @resource&.id
|
9
9
|
# token = @resource.create_token
|
10
10
|
# @resource.save!
|
11
|
-
|
11
|
+
|
12
12
|
update_refresh_token_cookie
|
13
13
|
redirect_header_options = {
|
14
14
|
account_confirmation_success: true,
|
15
15
|
config: params[:config],
|
16
16
|
override_proof: '(^^,)'
|
17
17
|
}
|
18
|
-
redirect_headers = @resource.create_named_token_pair
|
19
|
-
merge(redirect_header_options)
|
18
|
+
redirect_headers = @resource.create_named_token_pair
|
19
|
+
.merge(redirect_header_options)
|
20
20
|
redirect_to_link = DeviseJwtAuth::Url.generate(params[:redirect_url], redirect_headers)
|
21
21
|
redirect_to redirect_to_link
|
22
22
|
# redirect_header_options = {
|
@@ -2,14 +2,14 @@
|
|
2
2
|
|
3
3
|
module Overrides
|
4
4
|
class OmniauthCallbacksController < DeviseJwtAuth::OmniauthCallbacksController
|
5
|
-
DEFAULT_NICKNAME = 'stimpy'
|
5
|
+
DEFAULT_NICKNAME = 'stimpy'
|
6
6
|
|
7
7
|
def assign_provider_attrs(user, auth_hash)
|
8
8
|
user.assign_attributes(
|
9
9
|
nickname: DEFAULT_NICKNAME,
|
10
|
-
name:
|
11
|
-
image:
|
12
|
-
email:
|
10
|
+
name: auth_hash['info']['name'],
|
11
|
+
image: auth_hash['info']['image'],
|
12
|
+
email: auth_hash['info']['email']
|
13
13
|
)
|
14
14
|
end
|
15
15
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module Overrides
|
4
4
|
class PasswordsController < DeviseJwtAuth::PasswordsController
|
5
|
-
OVERRIDE_PROOF = '(^^,)'
|
5
|
+
OVERRIDE_PROOF = '(^^,)'
|
6
6
|
|
7
7
|
# this is where users arrive after visiting the email confirmation link
|
8
8
|
def edit
|
@@ -10,7 +10,7 @@ module Overrides
|
|
10
10
|
reset_password_token: resource_params[:reset_password_token]
|
11
11
|
)
|
12
12
|
|
13
|
-
if @resource
|
13
|
+
if @resource&.id
|
14
14
|
# token = @resource.create_token
|
15
15
|
|
16
16
|
# ensure that user is confirmed
|
@@ -23,8 +23,8 @@ module Overrides
|
|
23
23
|
override_proof: OVERRIDE_PROOF,
|
24
24
|
reset_password: true
|
25
25
|
}
|
26
|
-
redirect_headers = @resource.create_named_token_pair
|
27
|
-
merge(redirect_header_options)
|
26
|
+
redirect_headers = @resource.create_named_token_pair
|
27
|
+
.merge(redirect_header_options)
|
28
28
|
redirect_to_link = DeviseJwtAuth::Url.generate(params[:redirect_url], redirect_headers)
|
29
29
|
redirect_to redirect_to_link
|
30
30
|
|
@@ -2,14 +2,14 @@
|
|
2
2
|
|
3
3
|
module Overrides
|
4
4
|
class RegistrationsController < DeviseJwtAuth::RegistrationsController
|
5
|
-
OVERRIDE_PROOF = '(^^,)'
|
5
|
+
OVERRIDE_PROOF = '(^^,)'
|
6
6
|
|
7
7
|
def update
|
8
8
|
if @resource
|
9
9
|
if @resource.update(account_update_params)
|
10
10
|
render json: {
|
11
11
|
status: 'success',
|
12
|
-
data:
|
12
|
+
data: @resource.as_json,
|
13
13
|
override_proof: OVERRIDE_PROOF
|
14
14
|
}
|
15
15
|
else
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module Overrides
|
4
4
|
class SessionsController < DeviseJwtAuth::SessionsController
|
5
|
-
OVERRIDE_PROOF = '(^^,)'
|
5
|
+
OVERRIDE_PROOF = '(^^,)'
|
6
6
|
|
7
7
|
def create
|
8
8
|
@resource = resource_class.dta_find_by(email: resource_params[:email])
|
@@ -16,7 +16,7 @@ module Overrides
|
|
16
16
|
override_proof: OVERRIDE_PROOF
|
17
17
|
}.merge(auth_header)
|
18
18
|
|
19
|
-
elsif @resource &&
|
19
|
+
elsif @resource && !@resource.confirmed?
|
20
20
|
render json: {
|
21
21
|
success: false,
|
22
22
|
errors: [
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module FavoriteColor
|
2
4
|
extend ActiveSupport::Concern
|
3
5
|
|
@@ -5,15 +7,15 @@ module FavoriteColor
|
|
5
7
|
validates :operating_thetan, numericality: true, allow_nil: true
|
6
8
|
validate :ensure_correct_favorite_color
|
7
9
|
end
|
8
|
-
|
10
|
+
|
9
11
|
def ensure_correct_favorite_color
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
12
|
+
return unless favorite_color && (favorite_color != '')
|
13
|
+
|
14
|
+
return if ApplicationHelper::COLOR_NAMES.any? { |s| s.casecmp(favorite_color).zero? }
|
15
|
+
|
16
|
+
matches = ApplicationHelper::COLOR_SEARCH.search(favorite_color)
|
17
|
+
closest_match = matches.last[:string]
|
18
|
+
second_closest_match = matches[-2][:string]
|
19
|
+
errors.add(:favorite_color, "We've never heard of the color \"#{favorite_color}\". Did you mean \"#{closest_match}\"? Or perhaps \"#{second_closest_match}\"?")
|
18
20
|
end
|
19
21
|
end
|
data/test/dummy/config.ru
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# This file is used by Rack-based servers to start the application.
|
4
4
|
|
5
|
-
require ::File.expand_path('
|
5
|
+
require ::File.expand_path('config/environment', __dir__)
|
6
6
|
run Rails.application
|
7
7
|
|
8
8
|
# allow cross origin requests
|
@@ -12,7 +12,7 @@ use Rack::Cors do
|
|
12
12
|
origins '*'
|
13
13
|
resource '*',
|
14
14
|
headers: :any,
|
15
|
-
expose: [
|
15
|
+
expose: %w[access-token expiry token-type uid client],
|
16
16
|
methods: %i[get post options delete put]
|
17
17
|
end
|
18
18
|
end
|
data/test/dummy/config/boot.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
unless defined?(DEVISE_JWT_AUTH_ORM)
|
4
|
-
DEVISE_JWT_AUTH_ORM = (ENV[
|
4
|
+
DEVISE_JWT_AUTH_ORM = (ENV['DEVISE_JWT_AUTH_ORM'] || :active_record).to_sym
|
5
5
|
end
|
6
6
|
|
7
7
|
# Set up gems listed in the Gemfile.
|
@@ -15,13 +15,17 @@ Rails.application.configure do
|
|
15
15
|
config.eager_load = false
|
16
16
|
|
17
17
|
# Configure static asset server for tests with Cache-Control for performance.
|
18
|
-
Rails::VERSION::MAJOR == 5
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
18
|
+
if Rails::VERSION::MAJOR == 5
|
19
|
+
(config.public_file_server.enabled = true)
|
20
|
+
else
|
21
|
+
(config.serve_static_files = true)
|
22
|
+
end
|
23
|
+
|
24
|
+
if Rails::VERSION::MAJOR == 5
|
25
|
+
(config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' })
|
26
|
+
else
|
27
|
+
(config.static_cache_control = 'public, max-age=3600')
|
28
|
+
end
|
25
29
|
|
26
30
|
# Show full error reports and disable caching.
|
27
31
|
config.consider_all_requests_local = true
|
@@ -1,3 +1,3 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
#Figaro.require("GITHUB_KEY", "GITHUB_SECRET", "FACEBOOK_KEY", "FACEBOOK_SECRET", "GOOGLE_KEY", "GOOGLE_SECRET", "APPLE_CLIENT_ID", "APPLE_TEAM_ID", "APPLE_KEY", "APPLE_PEM")
|
3
|
+
# Figaro.require("GITHUB_KEY", "GITHUB_SECRET", "FACEBOOK_KEY", "FACEBOOK_SECRET", "GOOGLE_KEY", "GOOGLE_SECRET", "APPLE_CLIENT_ID", "APPLE_TEAM_ID", "APPLE_KEY", "APPLE_PEM")
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
Rails.application.config.middleware.use OmniAuth::Builder do |
|
4
|
-
provider :github, ENV['GITHUB_KEY'], ENV['GITHUB_SECRET'],
|
3
|
+
Rails.application.config.middleware.use OmniAuth::Builder do |_b|
|
4
|
+
provider :github, ENV['GITHUB_KEY'], ENV['GITHUB_SECRET'], scope: 'email,profile'
|
5
5
|
provider :facebook, ENV['FACEBOOK_KEY'], ENV['FACEBOOK_SECRET']
|
6
6
|
provider :google_oauth2, ENV['GOOGLE_KEY'], ENV['GOOGLE_SECRET']
|
7
7
|
provider :apple, ENV['APPLE_CLIENT_ID'], '', { scope: 'email name', team_id: ENV['APPLE_TEAM_ID'], key_id: ENV['APPLE_KEY'], pem: ENV['APPLE_PEM'] }
|
data/test/dummy/config/routes.rb
CHANGED
@@ -32,14 +32,14 @@ Rails.application.routes.draw do
|
|
32
32
|
# test namespacing with not created devise mapping
|
33
33
|
namespace :api_v2, defaults: { format: :json } do
|
34
34
|
mount_devise_jwt_auth_for 'ScopedUser',
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
35
|
+
at: 'auth',
|
36
|
+
controllers: {
|
37
|
+
omniauth_callbacks: 'api_v2/omniauth_callbacks',
|
38
|
+
sessions: 'api_v2/sessions',
|
39
|
+
registrations: 'api_v2/registrations',
|
40
|
+
confirmations: 'api_v2/confirmations',
|
41
|
+
passwords: 'api_v2/passwords'
|
42
|
+
}
|
43
43
|
end
|
44
44
|
|
45
45
|
# this route will authorize visitors using the User class
|
File without changes
|
File without changes
|
@@ -13,17 +13,17 @@ class DeviseJwtAuthCreateOnlyEmailUsers < ActiveRecord::Migration[4.2]
|
|
13
13
|
t.string :encrypted_password, null: false, default: ''
|
14
14
|
|
15
15
|
## Recoverable
|
16
|
-
#t.string :reset_password_token
|
17
|
-
#t.datetime :reset_password_sent_at
|
16
|
+
# t.string :reset_password_token
|
17
|
+
# t.datetime :reset_password_sent_at
|
18
18
|
|
19
19
|
## Rememberable
|
20
|
-
#t.datetime :remember_created_at
|
20
|
+
# t.datetime :remember_created_at
|
21
21
|
|
22
22
|
## Confirmable
|
23
|
-
#t.string :confirmation_token
|
24
|
-
#t.datetime :confirmed_at
|
25
|
-
#t.datetime :confirmation_sent_at
|
26
|
-
#t.string :unconfirmed_email # Only if using reconfirmable
|
23
|
+
# t.string :confirmation_token
|
24
|
+
# t.datetime :confirmed_at
|
25
|
+
# t.datetime :confirmation_sent_at
|
26
|
+
# t.string :unconfirmed_email # Only if using reconfirmable
|
27
27
|
|
28
28
|
## Lockable
|
29
29
|
# t.integer :failed_attempts, :default => 0, :null => false # Only if lock strategy is :failed_attempts
|
@@ -47,8 +47,8 @@ class DeviseJwtAuthCreateOnlyEmailUsers < ActiveRecord::Migration[4.2]
|
|
47
47
|
end
|
48
48
|
|
49
49
|
add_index :only_email_users, :email
|
50
|
-
add_index :only_email_users, [:uid, :provider],
|
51
|
-
#add_index :only_email_users, :reset_password_token, :unique => true
|
50
|
+
add_index :only_email_users, [:uid, :provider], unique: true
|
51
|
+
# add_index :only_email_users, :reset_password_token, :unique => true
|
52
52
|
# add_index :only_email_users, :confirmation_token, :unique => true
|
53
53
|
# add_index :only_email_users, :unlock_token, :unique => true
|
54
54
|
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,18 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class DeviseJwtAuthCreateConfirmableUsers < ActiveRecord::Migration[5.2]
|
2
4
|
def change
|
3
|
-
|
4
5
|
create_table(:confirmable_users) do |t|
|
5
6
|
## Required
|
6
|
-
t.string :provider, :
|
7
|
-
t.string :uid, :
|
7
|
+
t.string :provider, null: false, default: 'email'
|
8
|
+
t.string :uid, null: false, default: ''
|
8
9
|
|
9
10
|
## Database authenticatable
|
10
|
-
t.string :encrypted_password, :
|
11
|
+
t.string :encrypted_password, null: false, default: ''
|
11
12
|
|
12
13
|
## Recoverable
|
13
14
|
t.string :reset_password_token
|
14
15
|
t.datetime :reset_password_sent_at
|
15
|
-
t.boolean :allow_password_change, :
|
16
|
+
t.boolean :allow_password_change, default: false
|
16
17
|
|
17
18
|
## Rememberable
|
18
19
|
t.datetime :remember_created_at
|
data/test/dummy/db/schema.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# This file is auto-generated from the current state of the database. Instead
|
2
4
|
# of editing this file, please use the migrations feature of Active Record to
|
3
5
|
# incrementally modify your database, and then regenerate this schema definition.
|
@@ -10,189 +12,187 @@
|
|
10
12
|
#
|
11
13
|
# It's strongly recommended that you check this file into your version control system.
|
12
14
|
|
13
|
-
ActiveRecord::Schema.define(version:
|
14
|
-
|
15
|
-
|
16
|
-
t.string
|
17
|
-
t.string
|
18
|
-
t.string
|
19
|
-
t.
|
20
|
-
t.
|
21
|
-
t.
|
22
|
-
t.
|
23
|
-
t.
|
24
|
-
t.datetime
|
25
|
-
t.
|
26
|
-
t.string
|
27
|
-
t.string
|
28
|
-
t.string
|
29
|
-
t.string
|
30
|
-
t.
|
31
|
-
t.
|
32
|
-
t.datetime
|
33
|
-
t.
|
34
|
-
t.index [
|
35
|
-
t.index [
|
36
|
-
t.index [
|
37
|
-
t.index ["uid", "provider"], name: "index_confirmable_users_on_uid_and_provider", unique: true
|
15
|
+
ActiveRecord::Schema.define(version: 20_190_924_101_113) do
|
16
|
+
create_table 'confirmable_users', force: :cascade do |t|
|
17
|
+
t.string 'provider', default: 'email', null: false
|
18
|
+
t.string 'uid', default: '', null: false
|
19
|
+
t.string 'encrypted_password', default: '', null: false
|
20
|
+
t.string 'reset_password_token'
|
21
|
+
t.datetime 'reset_password_sent_at'
|
22
|
+
t.boolean 'allow_password_change', default: false
|
23
|
+
t.datetime 'remember_created_at'
|
24
|
+
t.string 'confirmation_token'
|
25
|
+
t.datetime 'confirmed_at'
|
26
|
+
t.datetime 'confirmation_sent_at'
|
27
|
+
t.string 'unconfirmed_email'
|
28
|
+
t.string 'name'
|
29
|
+
t.string 'nickname'
|
30
|
+
t.string 'image'
|
31
|
+
t.string 'email'
|
32
|
+
t.text 'tokens'
|
33
|
+
t.datetime 'created_at', null: false
|
34
|
+
t.datetime 'updated_at', null: false
|
35
|
+
t.index ['confirmation_token'], name: 'index_confirmable_users_on_confirmation_token', unique: true
|
36
|
+
t.index ['email'], name: 'index_confirmable_users_on_email', unique: true
|
37
|
+
t.index ['reset_password_token'], name: 'index_confirmable_users_on_reset_password_token', unique: true
|
38
|
+
t.index ['uid', 'provider'], name: 'index_confirmable_users_on_uid_and_provider', unique: true
|
38
39
|
end
|
39
40
|
|
40
|
-
create_table
|
41
|
-
t.string
|
42
|
-
t.string
|
43
|
-
t.string
|
44
|
-
t.integer
|
45
|
-
t.string
|
46
|
-
t.datetime
|
47
|
-
t.string
|
48
|
-
t.string
|
49
|
-
t.string
|
50
|
-
t.string
|
51
|
-
t.text
|
52
|
-
t.datetime
|
53
|
-
t.datetime
|
54
|
-
t.index [
|
55
|
-
t.index [
|
56
|
-
t.index [
|
41
|
+
create_table 'lockable_users', force: :cascade do |t|
|
42
|
+
t.string 'provider', null: false
|
43
|
+
t.string 'uid', default: '', null: false
|
44
|
+
t.string 'encrypted_password', default: '', null: false
|
45
|
+
t.integer 'failed_attempts', default: 0, null: false
|
46
|
+
t.string 'unlock_token'
|
47
|
+
t.datetime 'locked_at'
|
48
|
+
t.string 'name'
|
49
|
+
t.string 'nickname'
|
50
|
+
t.string 'image'
|
51
|
+
t.string 'email'
|
52
|
+
t.text 'tokens'
|
53
|
+
t.datetime 'created_at'
|
54
|
+
t.datetime 'updated_at'
|
55
|
+
t.index ['email'], name: 'index_lockable_users_on_email'
|
56
|
+
t.index ['uid', 'provider'], name: 'index_lockable_users_on_uid_and_provider', unique: true
|
57
|
+
t.index ['unlock_token'], name: 'index_lockable_users_on_unlock_token', unique: true
|
57
58
|
end
|
58
59
|
|
59
|
-
create_table
|
60
|
-
t.string
|
61
|
-
t.string
|
62
|
-
t.string
|
63
|
-
t.datetime
|
64
|
-
t.string
|
65
|
-
t.boolean
|
66
|
-
t.datetime
|
67
|
-
t.string
|
68
|
-
t.datetime
|
69
|
-
t.datetime
|
70
|
-
t.string
|
71
|
-
t.string
|
72
|
-
t.string
|
73
|
-
t.string
|
74
|
-
t.string
|
75
|
-
t.string
|
76
|
-
t.text
|
77
|
-
t.datetime
|
78
|
-
t.datetime
|
79
|
-
t.string
|
80
|
-
t.index [
|
81
|
-
t.index [
|
82
|
-
t.index [
|
83
|
-
t.index [
|
60
|
+
create_table 'mangs', force: :cascade do |t|
|
61
|
+
t.string 'email'
|
62
|
+
t.string 'encrypted_password', default: '', null: false
|
63
|
+
t.string 'reset_password_token'
|
64
|
+
t.datetime 'reset_password_sent_at'
|
65
|
+
t.string 'reset_password_redirect_url'
|
66
|
+
t.boolean 'allow_password_change', default: false
|
67
|
+
t.datetime 'remember_created_at'
|
68
|
+
t.string 'confirmation_token'
|
69
|
+
t.datetime 'confirmed_at'
|
70
|
+
t.datetime 'confirmation_sent_at'
|
71
|
+
t.string 'unconfirmed_email'
|
72
|
+
t.string 'name'
|
73
|
+
t.string 'nickname'
|
74
|
+
t.string 'image'
|
75
|
+
t.string 'provider'
|
76
|
+
t.string 'uid', default: '', null: false
|
77
|
+
t.text 'tokens'
|
78
|
+
t.datetime 'created_at'
|
79
|
+
t.datetime 'updated_at'
|
80
|
+
t.string 'favorite_color'
|
81
|
+
t.index ['confirmation_token'], name: 'index_mangs_on_confirmation_token', unique: true
|
82
|
+
t.index ['email'], name: 'index_mangs_on_email'
|
83
|
+
t.index ['reset_password_token'], name: 'index_mangs_on_reset_password_token', unique: true
|
84
|
+
t.index ['uid', 'provider'], name: 'index_mangs_on_uid_and_provider', unique: true
|
84
85
|
end
|
85
86
|
|
86
|
-
create_table
|
87
|
-
t.string
|
88
|
-
t.string
|
89
|
-
t.string
|
90
|
-
t.string
|
91
|
-
t.string
|
92
|
-
t.string
|
93
|
-
t.string
|
94
|
-
t.text
|
95
|
-
t.datetime
|
96
|
-
t.datetime
|
97
|
-
t.index [
|
98
|
-
t.index [
|
87
|
+
create_table 'only_email_users', force: :cascade do |t|
|
88
|
+
t.string 'provider', null: false
|
89
|
+
t.string 'uid', default: '', null: false
|
90
|
+
t.string 'encrypted_password', default: '', null: false
|
91
|
+
t.string 'name'
|
92
|
+
t.string 'nickname'
|
93
|
+
t.string 'image'
|
94
|
+
t.string 'email'
|
95
|
+
t.text 'tokens'
|
96
|
+
t.datetime 'created_at'
|
97
|
+
t.datetime 'updated_at'
|
98
|
+
t.index ['email'], name: 'index_only_email_users_on_email'
|
99
|
+
t.index ['uid', 'provider'], name: 'index_only_email_users_on_uid_and_provider', unique: true
|
99
100
|
end
|
100
101
|
|
101
|
-
create_table
|
102
|
-
t.string
|
103
|
-
t.string
|
104
|
-
t.string
|
105
|
-
t.string
|
106
|
-
t.datetime
|
107
|
-
t.boolean
|
108
|
-
t.datetime
|
109
|
-
t.string
|
110
|
-
t.datetime
|
111
|
-
t.datetime
|
112
|
-
t.string
|
113
|
-
t.string
|
114
|
-
t.string
|
115
|
-
t.string
|
116
|
-
t.string
|
117
|
-
t.text
|
118
|
-
t.datetime
|
119
|
-
t.datetime
|
120
|
-
t.index [
|
121
|
-
t.index [
|
122
|
-
t.index [
|
102
|
+
create_table 'scoped_users', force: :cascade do |t|
|
103
|
+
t.string 'provider', null: false
|
104
|
+
t.string 'uid', default: '', null: false
|
105
|
+
t.string 'encrypted_password', default: '', null: false
|
106
|
+
t.string 'reset_password_token'
|
107
|
+
t.datetime 'reset_password_sent_at'
|
108
|
+
t.boolean 'allow_password_change', default: false
|
109
|
+
t.datetime 'remember_created_at'
|
110
|
+
t.string 'confirmation_token'
|
111
|
+
t.datetime 'confirmed_at'
|
112
|
+
t.datetime 'confirmation_sent_at'
|
113
|
+
t.string 'unconfirmed_email'
|
114
|
+
t.string 'name'
|
115
|
+
t.string 'nickname'
|
116
|
+
t.string 'image'
|
117
|
+
t.string 'email'
|
118
|
+
t.text 'tokens'
|
119
|
+
t.datetime 'created_at'
|
120
|
+
t.datetime 'updated_at'
|
121
|
+
t.index ['email'], name: 'index_scoped_users_on_email'
|
122
|
+
t.index ['reset_password_token'], name: 'index_scoped_users_on_reset_password_token', unique: true
|
123
|
+
t.index ['uid', 'provider'], name: 'index_scoped_users_on_uid_and_provider', unique: true
|
123
124
|
end
|
124
125
|
|
125
|
-
create_table
|
126
|
-
t.string
|
127
|
-
t.string
|
128
|
-
t.string
|
129
|
-
t.string
|
130
|
-
t.datetime
|
131
|
-
t.boolean
|
132
|
-
t.datetime
|
133
|
-
t.string
|
134
|
-
t.string
|
135
|
-
t.string
|
136
|
-
t.string
|
137
|
-
t.text
|
138
|
-
t.datetime
|
139
|
-
t.datetime
|
140
|
-
t.index [
|
141
|
-
t.index [
|
142
|
-
t.index [
|
126
|
+
create_table 'unconfirmable_users', force: :cascade do |t|
|
127
|
+
t.string 'provider', null: false
|
128
|
+
t.string 'uid', default: '', null: false
|
129
|
+
t.string 'encrypted_password', default: '', null: false
|
130
|
+
t.string 'reset_password_token'
|
131
|
+
t.datetime 'reset_password_sent_at'
|
132
|
+
t.boolean 'allow_password_change', default: false
|
133
|
+
t.datetime 'remember_created_at'
|
134
|
+
t.string 'name'
|
135
|
+
t.string 'nickname'
|
136
|
+
t.string 'image'
|
137
|
+
t.string 'email'
|
138
|
+
t.text 'tokens'
|
139
|
+
t.datetime 'created_at'
|
140
|
+
t.datetime 'updated_at'
|
141
|
+
t.index ['email'], name: 'index_unconfirmable_users_on_email'
|
142
|
+
t.index ['reset_password_token'], name: 'index_unconfirmable_users_on_reset_password_token', unique: true
|
143
|
+
t.index ['uid', 'provider'], name: 'index_unconfirmable_users_on_uid_and_provider', unique: true
|
143
144
|
end
|
144
145
|
|
145
|
-
create_table
|
146
|
-
t.string
|
147
|
-
t.string
|
148
|
-
t.string
|
149
|
-
t.string
|
150
|
-
t.datetime
|
151
|
-
t.boolean
|
152
|
-
t.datetime
|
153
|
-
t.string
|
154
|
-
t.datetime
|
155
|
-
t.datetime
|
156
|
-
t.string
|
157
|
-
t.string
|
158
|
-
t.string
|
159
|
-
t.string
|
160
|
-
t.string
|
161
|
-
t.text
|
162
|
-
t.datetime
|
163
|
-
t.datetime
|
164
|
-
t.index [
|
165
|
-
t.index [
|
166
|
-
t.index [
|
146
|
+
create_table 'unregisterable_users', force: :cascade do |t|
|
147
|
+
t.string 'provider', null: false
|
148
|
+
t.string 'uid', default: '', null: false
|
149
|
+
t.string 'encrypted_password', default: '', null: false
|
150
|
+
t.string 'reset_password_token'
|
151
|
+
t.datetime 'reset_password_sent_at'
|
152
|
+
t.boolean 'allow_password_change', default: false
|
153
|
+
t.datetime 'remember_created_at'
|
154
|
+
t.string 'confirmation_token'
|
155
|
+
t.datetime 'confirmed_at'
|
156
|
+
t.datetime 'confirmation_sent_at'
|
157
|
+
t.string 'unconfirmed_email'
|
158
|
+
t.string 'name'
|
159
|
+
t.string 'nickname'
|
160
|
+
t.string 'image'
|
161
|
+
t.string 'email'
|
162
|
+
t.text 'tokens'
|
163
|
+
t.datetime 'created_at'
|
164
|
+
t.datetime 'updated_at'
|
165
|
+
t.index ['email'], name: 'index_unregisterable_users_on_email'
|
166
|
+
t.index ['reset_password_token'], name: 'index_unregisterable_users_on_reset_password_token', unique: true
|
167
|
+
t.index ['uid', 'provider'], name: 'index_unregisterable_users_on_uid_and_provider', unique: true
|
167
168
|
end
|
168
169
|
|
169
|
-
create_table
|
170
|
-
t.string
|
171
|
-
t.string
|
172
|
-
t.string
|
173
|
-
t.datetime
|
174
|
-
t.string
|
175
|
-
t.boolean
|
176
|
-
t.datetime
|
177
|
-
t.string
|
178
|
-
t.datetime
|
179
|
-
t.datetime
|
180
|
-
t.string
|
181
|
-
t.string
|
182
|
-
t.string
|
183
|
-
t.string
|
184
|
-
t.string
|
185
|
-
t.string
|
186
|
-
t.text
|
187
|
-
t.datetime
|
188
|
-
t.datetime
|
189
|
-
t.integer
|
190
|
-
t.string
|
191
|
-
t.index [
|
192
|
-
t.index [
|
193
|
-
t.index [
|
194
|
-
t.index [
|
195
|
-
t.index [
|
170
|
+
create_table 'users', force: :cascade do |t|
|
171
|
+
t.string 'email'
|
172
|
+
t.string 'encrypted_password', default: '', null: false
|
173
|
+
t.string 'reset_password_token'
|
174
|
+
t.datetime 'reset_password_sent_at'
|
175
|
+
t.string 'reset_password_redirect_url'
|
176
|
+
t.boolean 'allow_password_change', default: false
|
177
|
+
t.datetime 'remember_created_at'
|
178
|
+
t.string 'confirmation_token'
|
179
|
+
t.datetime 'confirmed_at'
|
180
|
+
t.datetime 'confirmation_sent_at'
|
181
|
+
t.string 'unconfirmed_email'
|
182
|
+
t.string 'name'
|
183
|
+
t.string 'nickname'
|
184
|
+
t.string 'image'
|
185
|
+
t.string 'provider'
|
186
|
+
t.string 'uid', default: '', null: false
|
187
|
+
t.text 'tokens'
|
188
|
+
t.datetime 'created_at'
|
189
|
+
t.datetime 'updated_at'
|
190
|
+
t.integer 'operating_thetan'
|
191
|
+
t.string 'favorite_color'
|
192
|
+
t.index ['confirmation_token'], name: 'index_users_on_confirmation_token', unique: true
|
193
|
+
t.index ['email'], name: 'index_users_on_email'
|
194
|
+
t.index ['nickname'], name: 'index_users_on_nickname', unique: true
|
195
|
+
t.index ['reset_password_token'], name: 'index_users_on_reset_password_token', unique: true
|
196
|
+
t.index ['uid', 'provider'], name: 'index_users_on_uid_and_provider', unique: true
|
196
197
|
end
|
197
|
-
|
198
198
|
end
|