Gestionnaire: login_token! -> create_trusted_device_token
This commit is contained in:
parent
47e3b57e81
commit
0b8619be77
4 changed files with 4 additions and 4 deletions
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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 }
|
||||||
|
|
Loading…
Reference in a new issue