[fix #4008] secured login for all gestionnaires

This commit is contained in:
simon lehericey 2019-06-27 16:19:08 +02:00 committed by Nicolas Bouilleaud
parent 64e5ea13a3
commit 92bd382c64
3 changed files with 11 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

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