diff --git a/app/models/identity.rb b/app/models/identity.rb index 80b6a45ef..a68133286 100644 --- a/app/models/identity.rb +++ b/app/models/identity.rb @@ -1,4 +1,7 @@ class Identity < ApplicationRecord + NO_EMAIL_MSG = "No email found. Please relink your %s " \ + "account to avoid errors.".freeze + belongs_to :user scope :enabled, -> { where(provider: Authentication::Providers.enabled) } @@ -39,6 +42,6 @@ class Identity < ApplicationRecord end def email - auth_data_dump.info.email + auth_data_dump&.info&.email || format(NO_EMAIL_MSG, provider: provider) end end