commit
2a93d26e1a
4 changed files with 19 additions and 2 deletions
5
db/migrate/20190627132911_secured_login_by_default.rb
Normal file
5
db/migrate/20190627132911_secured_login_by_default.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class SecuredLoginByDefault < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
change_column_default(:gestionnaires, :features, from: {}, to: { "enable_email_login_token": true })
|
||||||
|
end
|
||||||
|
end
|
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 2019_06_16_141702) do
|
ActiveRecord::Schema.define(version: 2019_06_27_132911) do
|
||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
|
@ -388,7 +388,7 @@ ActiveRecord::Schema.define(version: 2019_06_16_141702) do
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
t.text "encrypted_login_token"
|
t.text "encrypted_login_token"
|
||||||
t.datetime "login_token_created_at"
|
t.datetime "login_token_created_at"
|
||||||
t.jsonb "features", default: {}, null: false
|
t.jsonb "features", default: {"enable_email_login_token"=>true}, null: false
|
||||||
t.index ["email"], name: "index_gestionnaires_on_email", unique: true
|
t.index ["email"], name: "index_gestionnaires_on_email", unique: true
|
||||||
t.index ["reset_password_token"], name: "index_gestionnaires_on_reset_password_token", unique: true
|
t.index ["reset_password_token"], name: "index_gestionnaires_on_reset_password_token", unique: true
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
namespace :after_party do
|
||||||
|
desc 'Deployment task: enable_secured_login_for_all'
|
||||||
|
task enable_secured_login_for_all: :environment do
|
||||||
|
Gestionnaire.update_all(features: { "enable_email_login_token": true })
|
||||||
|
|
||||||
|
AfterParty::TaskRecord.create version: '20190627142239'
|
||||||
|
end
|
||||||
|
end
|
|
@ -12,6 +12,10 @@ describe Gestionnaire, type: :model do
|
||||||
assign(procedure_2)
|
assign(procedure_2)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'default features' do
|
||||||
|
it { expect(gestionnaire.features).to eq({ "enable_email_login_token" => true }) }
|
||||||
|
end
|
||||||
|
|
||||||
describe '#visible_procedures' do
|
describe '#visible_procedures' do
|
||||||
let(:procedure_not_assigned) { create :procedure, administrateur: admin }
|
let(:procedure_not_assigned) { create :procedure, administrateur: admin }
|
||||||
let(:procedure_with_default_path) { create :procedure, administrateur: admin }
|
let(:procedure_with_default_path) { create :procedure, administrateur: admin }
|
||||||
|
|
Loading…
Reference in a new issue