Gestionnaire: login_token! -> create_trusted_device_token

This commit is contained in:
simon lehericey 2019-02-18 17:05:30 +01:00
parent 47e3b57e81
commit 0b8619be77
4 changed files with 4 additions and 4 deletions

View file

@ -19,7 +19,7 @@ module TrustedDeviceConcern
def send_login_token_or_bufferize(gestionnaire) def send_login_token_or_bufferize(gestionnaire)
if !gestionnaire.young_login_token? if !gestionnaire.young_login_token?
login_token = gestionnaire.login_token! login_token = gestionnaire.create_trusted_device_token
GestionnaireMailer.send_login_token(gestionnaire, login_token).deliver_later GestionnaireMailer.send_login_token(gestionnaire, login_token).deliver_later
end end
end end

View file

@ -132,7 +132,7 @@ class Gestionnaire < ApplicationRecord
Dossier.where(id: dossiers_id_with_notifications(dossiers)).group(:procedure_id).count Dossier.where(id: dossiers_id_with_notifications(dossiers)).group(:procedure_id).count
end end
def login_token! def create_trusted_device_token
trusted_device_token = trusted_device_tokens.create trusted_device_token = trusted_device_tokens.create
trusted_device_token.token trusted_device_token.token
end end

View file

@ -175,7 +175,7 @@ describe Users::SessionsController, type: :controller do
describe '#sign_in_by_link' do describe '#sign_in_by_link' do
context 'when the gestionnaire has non other account' do context 'when the gestionnaire has non other account' do
let(:gestionnaire) { create(:gestionnaire) } let(:gestionnaire) { create(:gestionnaire) }
let!(:good_jeton) { gestionnaire.login_token! } let!(:good_jeton) { gestionnaire.create_trusted_device_token }
let(:logged) { false } let(:logged) { false }
before do before do

View file

@ -396,7 +396,7 @@ describe Gestionnaire, type: :model do
let!(:gestionnaire) { create(:gestionnaire) } let!(:gestionnaire) { create(:gestionnaire) }
context 'when there is a token' do context 'when there is a token' do
let!(:good_token) { gestionnaire.login_token! } let!(:good_token) { gestionnaire.create_trusted_device_token }
context 'when the token has just been created' do context 'when the token has just been created' do
it { expect(gestionnaire.young_login_token?).to be true } it { expect(gestionnaire.young_login_token?).to be true }