[Fix #1479] Sanitize Gestionnaire email before validation

This commit is contained in:
Mathieu Magnin 2018-03-14 17:25:43 +01:00
parent 38e1609d73
commit d9c562c59d

View file

@ -1,9 +1,14 @@
class Gestionnaire < ApplicationRecord
include CredentialsSyncableConcern
include EmailSanitizableConcern
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
has_and_belongs_to_many :administrateurs
before_validation -> { sanitize_email(:email) }
has_many :assign_to, dependent: :destroy
has_many :procedures, through: :assign_to
has_many :dossiers, -> { state_not_brouillon }, through: :procedures
@ -12,8 +17,6 @@ class Gestionnaire < ApplicationRecord
has_many :avis
has_many :dossiers_from_avis, through: :avis, source: :dossier
include CredentialsSyncableConcern
def visible_procedures
procedures.publiees_ou_archivees
end