Merge pull request #4024 from betagouv/dev

2019-07-01-02
This commit is contained in:
LeSim 2019-07-01 18:31:19 +02:00 committed by GitHub
commit 2a93d26e1a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 2 deletions

View 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

View file

@ -10,7 +10,7 @@
#
# 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
enable_extension "plpgsql"
@ -388,7 +388,7 @@ ActiveRecord::Schema.define(version: 2019_06_16_141702) do
t.datetime "updated_at"
t.text "encrypted_login_token"
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 ["reset_password_token"], name: "index_gestionnaires_on_reset_password_token", unique: true
end

View file

@ -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

View file

@ -12,6 +12,10 @@ describe Gestionnaire, type: :model do
assign(procedure_2)
end
describe 'default features' do
it { expect(gestionnaire.features).to eq({ "enable_email_login_token" => true }) }
end
describe '#visible_procedures' do
let(:procedure_not_assigned) { create :procedure, administrateur: admin }
let(:procedure_with_default_path) { create :procedure, administrateur: admin }