Make default value for otp_required_for_login false instead of null
This commit is contained in:
parent
8304bed105
commit
d3ff8c1a95
|
@ -50,12 +50,12 @@
|
|||
# bitbucket_access_token :string(255)
|
||||
# bitbucket_access_token_secret :string(255)
|
||||
# location :string(255)
|
||||
# public_email :string(255) default(""), not null
|
||||
# encrypted_otp_secret :string(255)
|
||||
# encrypted_otp_secret_iv :string(255)
|
||||
# encrypted_otp_secret_salt :string(255)
|
||||
# otp_required_for_login :boolean
|
||||
# otp_required_for_login :boolean default(FALSE), not null
|
||||
# otp_backup_codes :text
|
||||
# public_email :string(255) default(""), not null
|
||||
# dashboard :integer default(0)
|
||||
#
|
||||
|
||||
|
@ -198,8 +198,8 @@ class User < ActiveRecord::Base
|
|||
scope :active, -> { with_state(:active) }
|
||||
scope :not_in_project, ->(project) { project.users.present? ? where("id not in (:ids)", ids: project.users.map(&:id) ) : all }
|
||||
scope :without_projects, -> { where('id NOT IN (SELECT DISTINCT(user_id) FROM members)') }
|
||||
scope :with_two_factor, -> { where('otp_required_for_login IS true') }
|
||||
scope :without_two_factor, -> { where('otp_required_for_login IS NOT true') }
|
||||
scope :with_two_factor, -> { where(otp_required_for_login: true) }
|
||||
scope :without_two_factor, -> { where(otp_required_for_login: false) }
|
||||
|
||||
#
|
||||
# Class methods
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
class AddDefaultOtpRequiredForLoginValue < ActiveRecord::Migration
|
||||
def up
|
||||
change_column :users, :otp_required_for_login, :boolean, default: false, null: false
|
||||
end
|
||||
|
||||
def down
|
||||
change_column :users, :otp_required_for_login, :boolean, default: nil
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20150610065936) do
|
||||
ActiveRecord::Schema.define(version: 20150620233230) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
@ -499,7 +499,7 @@ ActiveRecord::Schema.define(version: 20150610065936) do
|
|||
t.string "encrypted_otp_secret"
|
||||
t.string "encrypted_otp_secret_iv"
|
||||
t.string "encrypted_otp_secret_salt"
|
||||
t.boolean "otp_required_for_login"
|
||||
t.boolean "otp_required_for_login", default: false, null: false
|
||||
t.text "otp_backup_codes"
|
||||
t.string "public_email", default: "", null: false
|
||||
t.integer "dashboard", default: 0
|
||||
|
|
|
@ -50,12 +50,12 @@
|
|||
# bitbucket_access_token :string(255)
|
||||
# bitbucket_access_token_secret :string(255)
|
||||
# location :string(255)
|
||||
# public_email :string(255) default(""), not null
|
||||
# encrypted_otp_secret :string(255)
|
||||
# encrypted_otp_secret_iv :string(255)
|
||||
# encrypted_otp_secret_salt :string(255)
|
||||
# otp_required_for_login :boolean
|
||||
# otp_required_for_login :boolean default(FALSE), not null
|
||||
# otp_backup_codes :text
|
||||
# public_email :string(255) default(""), not null
|
||||
# dashboard :integer default(0)
|
||||
#
|
||||
|
||||
|
|
Loading…
Reference in New Issue