Merge branch 'dev'
This commit is contained in:
commit
a2366caa2a
17 changed files with 125 additions and 36 deletions
|
@ -10,6 +10,7 @@ class Pipedrive::PersonAdapter
|
|||
nom: datum['name'],
|
||||
poste: datum[PIPEDRIVE_POSTE_ATTRIBUTE_ID],
|
||||
email: datum.dig('email', 0, 'value'),
|
||||
tel: datum.dig('phone', 0, 'value'),
|
||||
organisation: datum['org_name']
|
||||
}
|
||||
end
|
||||
|
|
|
@ -140,8 +140,8 @@ class Gestionnaire < ApplicationRecord
|
|||
end
|
||||
|
||||
def login_token_valid?(login_token)
|
||||
BCrypt::Password.new(encrypted_login_token) == login_token
|
||||
30.minutes.ago < login_token_created_at
|
||||
BCrypt::Password.new(encrypted_login_token) == login_token &&
|
||||
30.minutes.ago < login_token_created_at
|
||||
rescue BCrypt::Errors::InvalidHash
|
||||
false
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
- content_for(:title, 'Expiration du délai de conservation des dossiers')
|
||||
|
||||
- if @expired_dossiers.present?
|
||||
%h1= t('mail.administration.dossier_expiration_summary.expired_dossiers', count: @expired_dossiers.count)
|
||||
%h2= t('mail.administration.dossier_expiration_summary.expired_dossiers', count: @expired_dossiers.count)
|
||||
- @expired_dossiers.group_by(&:procedure).each do |procedure, dossiers|
|
||||
%dl
|
||||
%dt
|
||||
|
@ -10,7 +10,7 @@
|
|||
= dossiers.map { |d| link_to(d.id, manager_dossier_url(d)) }.join(', ').html_safe
|
||||
|
||||
- if @expiring_dossiers.present?
|
||||
%h1= t('mail.administration.dossier_expiration_summary.expiring_dossiers', count: @expiring_dossiers.count)
|
||||
%h2= t('mail.administration.dossier_expiration_summary.expiring_dossiers', count: @expiring_dossiers.count)
|
||||
- @expiring_dossiers.group_by(&:procedure).each do |procedure, dossiers|
|
||||
%dl
|
||||
%dt
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
- content_for(:title, 'Vous avez été invité à donner votre avis')
|
||||
|
||||
- content_for(:title, 'Invitation à donner votre avis')
|
||||
- avis_link = @avis.gestionnaire.present? ? gestionnaire_avis_url(@avis) : sign_up_gestionnaire_avis_url(@avis.id, @avis.email)
|
||||
|
||||
- content_for(:footer) do
|
||||
|
@ -21,7 +20,7 @@
|
|||
%p
|
||||
= "#{@avis.claimant.email} vous a écrit :"
|
||||
%br
|
||||
%p{ style: "padding: 8px; color: #333333; background-color: #EEEEEE; font-size: 16px;" }
|
||||
%p{ style: "padding: 8px; color: #333333; background-color: #EEEEEE; font-size: 14px;" }
|
||||
= @avis.introduction
|
||||
|
||||
- if @avis.gestionnaire.present?
|
||||
|
|
|
@ -1,8 +1,14 @@
|
|||
- content_for(:title, @subject)
|
||||
|
||||
%p
|
||||
Bonjour,
|
||||
|
||||
%p
|
||||
Voici le résumé de votre activité hebdomadaire :
|
||||
|
||||
- @overview[:procedure_overviews].each_with_index do |procedure_overview, index|
|
||||
|
||||
%h2{ style: 'font-size: 20px; font-weight: 300; margin: 25px 0 5px;' }
|
||||
%h2{ style: 'font-size: 16px; font-weight: 300; margin: 25px 0 5px;' }
|
||||
#{procedure_overview.procedure.libelle}
|
||||
= link_to 'voir', gestionnaire_procedure_url(procedure_overview.procedure), style: 'color: #0069CC; font-size: 14px;'
|
||||
%table{ cellpadding: '0', cellspacing: '0', style: 'width: 100%; padding-bottom: 20px;' }
|
||||
|
|
|
@ -4,7 +4,9 @@
|
|||
%p
|
||||
L'utilisateur
|
||||
= @invite.email_sender
|
||||
souhaite que vous participiez à l'élaboration d'un dossier sur demarches-simplifiees.fr.
|
||||
souhaite que vous participiez à l'élaboration d'un dossier pour la démarche
|
||||
%strong= @invite.dossier.procedure.libelle
|
||||
sur demarches-simplifiees.fr.
|
||||
|
||||
%p
|
||||
Cette plateforme permet à ses utilisateurs d'établir des dossiers 100 % en ligne et de dialoguer avec plusieurs interlocuteurs privilégiés avant d'instruire un dépot.
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#navbar-body
|
||||
.row
|
||||
%div{ style: "vertical-align: middle;float:left;position:absolute;line-height: 60px;z-index:2;" }
|
||||
Besoin d'aide ? <a href="tel:#{CONTACT_PHONE}">#{CONTACT_PHONE}</a> ou <a href="mailto:#{CONTACT_EMAIL}">#{CONTACT_EMAIL}</a>
|
||||
Besoin d'aide ? <a href="tel:#{CONTACT_PHONE}">#{CONTACT_PHONE}</a> ou <a href="#{contact_admin_path}" target="_blank">par email</a>
|
||||
-# BEST WTF EVER
|
||||
-# this begin rescue hides potentials bugs by displaying another navbar
|
||||
- begin
|
||||
|
|
|
@ -34,13 +34,14 @@
|
|||
<%= form_tag(manager_demandes_create_administrateur_path) do -%>
|
||||
<%= select_tag "stage_id",
|
||||
options_for_select({
|
||||
"suspect" => Pipedrive::DealAdapter::PIPEDRIVE_SUSPECTS_COMPTE_CREE_STAGE_ID,
|
||||
"administration centrale" => Pipedrive::DealAdapter::PIPEDRIVE_ADMIN_CENTRAL_STOCK_STAGE_ID,
|
||||
"service déco. régional" => Pipedrive::DealAdapter::PIPEDRIVE_SERVICE_DECO_REGIONAL_STOCK_STAGE_ID,
|
||||
"service déco. départemental" => Pipedrive::DealAdapter::PIPEDRIVE_SERVICE_DECO_DEPARTEMENTAL_STOCK_STAGE_ID,
|
||||
"collectivité dép. ou rég." =>Pipedrive::DealAdapter::PIPEDRIVE_COLLECTIVITE_DEP_OU_REG_STOCK_STAGE_ID,
|
||||
"collectivité locale" => Pipedrive::DealAdapter::PIPEDRIVE_COLLECTIVITE_LOCALE_STOCK_STAGE_ID,
|
||||
"organisme" => Pipedrive::DealAdapter::PIPEDRIVE_ORGANISMES_STOCK_STAGE_ID,
|
||||
"suspect" => Pipedrive::DealAdapter::PIPEDRIVE_SUSPECTS_COMPTE_CREE_STAGE_ID
|
||||
"organisme" => Pipedrive::DealAdapter::PIPEDRIVE_ORGANISMES_STOCK_STAGE_ID
|
||||
|
||||
}),
|
||||
style: 'margin-bottom: 20px; width: inherit;' %>
|
||||
|
||||
|
|
|
@ -255,11 +255,11 @@ describe Users::SessionsController, type: :controller do
|
|||
let(:gestionnaire) { create(:gestionnaire) }
|
||||
before do
|
||||
allow(controller).to receive(:trust_device)
|
||||
post :sign_in_by_link, params: { id: gestionnaire.id, login_token: login_token }
|
||||
post :sign_in_by_link, params: { id: gestionnaire.id, jeton: jeton }
|
||||
end
|
||||
|
||||
context 'when the token is valid' do
|
||||
let(:login_token) { gestionnaire.login_token! }
|
||||
let(:jeton) { gestionnaire.login_token! }
|
||||
|
||||
# TODO when the gestionnaire has no other account, and the token is valid, and the user signing in was not starting a demarche,
|
||||
# redirect to root_path, then redirect to gestionnaire_procedures_path (see root_controller)
|
||||
|
@ -269,7 +269,7 @@ describe Users::SessionsController, type: :controller do
|
|||
end
|
||||
|
||||
context 'when the token is invalid' do
|
||||
let(:login_token) { 'invalid_token' }
|
||||
let(:jeton) { 'invalid_token' }
|
||||
|
||||
it { is_expected.to redirect_to new_user_session_path }
|
||||
it { expect(controller.current_gestionnaire).to be_nil }
|
||||
|
@ -286,11 +286,11 @@ describe Users::SessionsController, type: :controller do
|
|||
let!(:administrateur) { create(:administrateur, email: email, password: password) }
|
||||
|
||||
before do
|
||||
post :sign_in_by_link, params: { id: gestionnaire.id, login_token: login_token }
|
||||
post :sign_in_by_link, params: { id: gestionnaire.id, jeton: jeton }
|
||||
end
|
||||
|
||||
context 'when the token is valid' do
|
||||
let(:login_token) { gestionnaire.login_token! }
|
||||
let(:jeton) { gestionnaire.login_token! }
|
||||
|
||||
it { expect(controller.current_gestionnaire).to eq(gestionnaire) }
|
||||
it { expect(controller.current_administrateur).to eq(administrateur) }
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
class AdministrateurMailerPreview < ActionMailer::Preview
|
||||
def activate_before_expiration
|
||||
AdministrateurMailer.activate_before_expiration(Administrateur.inactive.where.not(reset_password_token: nil).last)
|
||||
administrateur = Administrateur.new(reset_password_sent_at: Time.now.utc)
|
||||
|
||||
AdministrateurMailer.activate_before_expiration(administrateur, "a4d4e4f4b4d445")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,17 +1,42 @@
|
|||
class AdministrationMailerPreview < ActionMailer::Preview
|
||||
def dubious_procedures
|
||||
procedures_and_champs = [
|
||||
[Procedure.first, [TypeDeChamp.new(libelle: 'iban'), TypeDeChamp.new(libelle: 'religion')]],
|
||||
[Procedure.last, [TypeDeChamp.new(libelle: 'iban'), TypeDeChamp.new(libelle: 'numéro de carte bleu')]]
|
||||
[procedure_1, [TypeDeChamp.new(libelle: 'iban'), TypeDeChamp.new(libelle: 'religion')]],
|
||||
[procedure_2, [TypeDeChamp.new(libelle: 'iban'), TypeDeChamp.new(libelle: 'numéro de carte bleu')]]
|
||||
]
|
||||
AdministrationMailer.dubious_procedures(procedures_and_champs)
|
||||
end
|
||||
|
||||
def invite_admin
|
||||
AdministrationMailer.invite_admin(Administrateur.last, "12345678", 0)
|
||||
AdministrationMailer.invite_admin(administrateur, "12345678", 0)
|
||||
end
|
||||
|
||||
def refuse_admin
|
||||
AdministrationMailer.refuse_admin('bad_admin@pipo.com')
|
||||
end
|
||||
|
||||
def new_admin
|
||||
administration = Administration.new(email: 'superadmin@demarches-simplifiees.fr')
|
||||
AdministrationMailer.new_admin_email(administrateur, administration)
|
||||
end
|
||||
|
||||
def dossier_expiration_summary
|
||||
expiring_dossiers = [Dossier.new(id: 100, procedure: procedure_1)]
|
||||
expired_dossiers = [Dossier.new(id: 100, procedure: procedure_2)]
|
||||
AdministrationMailer.dossier_expiration_summary(expiring_dossiers, expired_dossiers)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def procedure_1
|
||||
Procedure.new(id: 10, libelle: "Démarche des marches", administrateur: administrateur)
|
||||
end
|
||||
|
||||
def procedure_2
|
||||
Procedure.new(id: 20, libelle: "Démarche pieds", administrateur: administrateur)
|
||||
end
|
||||
|
||||
def administrateur
|
||||
Administrateur.new(id: 111, email: "chef.de.service@administration.gouv.fr")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
# Preview all emails at http://localhost:3000/rails/mailers/avis_mailer
|
||||
class AvisMailerPreview < ActionMailer::Preview
|
||||
def avis_invitation
|
||||
AvisMailer.avis_invitation(Avis.last)
|
||||
gestionaire = Gestionnaire.new(id: 1, email: 'jeanmichel.de-chauvigny@exemple.fr')
|
||||
avis = Avis.new(id: 1, email: 'test@exemple.fr', claimant: gestionaire)
|
||||
avis.dossier = Dossier.new(id: 1)
|
||||
avis.dossier.procedure = Procedure.new(libelle: 'Démarche pour faire des marches')
|
||||
avis.introduction = 'Il faudrait vérifier le certificat de conformité.'
|
||||
AvisMailer.avis_invitation(avis)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
class DeviseUserMailerPreview < ActionMailer::Preview
|
||||
def confirmation_instructions
|
||||
DeviseUserMailer.confirmation_instructions(User.first, "faketoken", {})
|
||||
DeviseUserMailer.confirmation_instructions(user, "faketoken", {})
|
||||
end
|
||||
|
||||
def reset_password_instructions
|
||||
DeviseUserMailer.reset_password_instructions(User.first, "faketoken", {})
|
||||
DeviseUserMailer.reset_password_instructions(user, "faketoken", {})
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def user
|
||||
User.new(id: 10, email: "usager@example.com")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,18 +1,32 @@
|
|||
# Preview all emails at http://localhost:3000/rails/mailers/dossier_mailer
|
||||
class DossierMailerPreview < ActionMailer::Preview
|
||||
def notify_new_draft
|
||||
DossierMailer.notify_new_draft(Dossier.last)
|
||||
DossierMailer.notify_new_draft(dossier)
|
||||
end
|
||||
|
||||
def notify_new_answer
|
||||
DossierMailer.notify_new_answer(Dossier.last)
|
||||
DossierMailer.notify_new_answer(dossier)
|
||||
end
|
||||
|
||||
def notify_deletion_to_user
|
||||
DossierMailer.notify_deletion_to_user(DeletedDossier.last, "user@ds.fr")
|
||||
DossierMailer.notify_deletion_to_user(deleted_dossier, "user@ds.fr")
|
||||
end
|
||||
|
||||
def notify_deletion_to_administration
|
||||
DossierMailer.notify_deletion_to_administration(DeletedDossier.last, "admin@ds.fr")
|
||||
DossierMailer.notify_deletion_to_administration(deleted_dossier, "admin@ds.fr")
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def deleted_dossier
|
||||
DeletedDossier.new(dossier_id: 1, procedure: procedure)
|
||||
end
|
||||
|
||||
def dossier
|
||||
Dossier.new(id: 1, procedure: procedure, user: User.new(email: "usager@example.com"))
|
||||
end
|
||||
|
||||
def procedure
|
||||
Procedure.new(libelle: 'Démarche pour des marches')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,14 +1,35 @@
|
|||
class GestionnaireMailerPreview < ActionMailer::Preview
|
||||
def last_week_overview
|
||||
gestionnaire = Gestionnaire.first
|
||||
GestionnaireMailer.last_week_overview(gestionnaire)
|
||||
GestionnaireMailer.last_week_overview(Gestionnaire.first)
|
||||
end
|
||||
|
||||
def send_dossier
|
||||
GestionnaireMailer.send_dossier(Gestionnaire.first, Dossier.first, Gestionnaire.last)
|
||||
GestionnaireMailer.send_dossier(gestionnaire, Dossier.new(id: 10, procedure: procedure), target_gestionnaire)
|
||||
end
|
||||
|
||||
def send_login_token
|
||||
GestionnaireMailer.send_login_token(Gestionnaire.first, "token")
|
||||
GestionnaireMailer.send_login_token(gestionnaire, "token")
|
||||
end
|
||||
|
||||
def invite_gestionnaire
|
||||
GestionnaireMailer.invite_gestionnaire(gestionnaire, 'aedfa0d0')
|
||||
end
|
||||
|
||||
def user_to_gestionnaire
|
||||
GestionnaireMailer.user_to_gestionnaire(gestionnaire.email)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def gestionnaire
|
||||
Gestionnaire.new(id: 10, email: 'instructeur@administration.gouv.fr')
|
||||
end
|
||||
|
||||
def target_gestionnaire
|
||||
Gestionnaire.new(id: 12, email: 'collegue@administration.gouv.fr')
|
||||
end
|
||||
|
||||
def procedure
|
||||
Procedure.new(id: 15)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
class UserMailerPreview < ActionMailer::Preview
|
||||
def new_account_warning
|
||||
UserMailer.new_account_warning(User.first)
|
||||
UserMailer.new_account_warning(user)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def user
|
||||
User.new(id: 10, email: 'test@exemple.fr')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -27,10 +27,11 @@ module FeatureHelpers
|
|||
|
||||
if sign_in_by_link
|
||||
mail = ActionMailer::Base.deliveries.last
|
||||
message = mail.body.parts.join(&:to_s)
|
||||
login_token = message[/connexion-par-jeton\/(.*)/, 1]
|
||||
message = mail.html_part.body.raw_source
|
||||
gestionnaire_id = message[/\".+\/connexion-par-jeton\/(.+)\?jeton=(.*)\"/, 1]
|
||||
jeton = message[/\".+\/connexion-par-jeton\/(.+)\?jeton=(.*)\"/, 2]
|
||||
|
||||
visit sign_in_by_link_path(login_token)
|
||||
visit sign_in_by_link_path(gestionnaire_id, jeton: jeton)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue