[Fix #1479] Sanitize User email before validation

This commit is contained in:
Mathieu Magnin 2018-02-28 14:31:03 +01:00
parent 8731f7c63b
commit a00114d03d

View file

@ -1,4 +1,7 @@
class User < ApplicationRecord
include CredentialsSyncableConcern
include EmailSanitizableConcern
enum loged_in_with_france_connect: {
particulier: 'particulier',
entreprise: 'entreprise'
@ -18,7 +21,7 @@ class User < ApplicationRecord
delegate :given_name, :family_name, :email_france_connect, :gender, :birthdate, :birthplace, :france_connect_particulier_id, to: :france_connect_information
accepts_nested_attributes_for :france_connect_information
include CredentialsSyncableConcern
before_validation -> { sanitize_email(:email) }
def self.find_for_france_connect email, siret
user = User.find_by(email: email)