mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-27 19:26:12 +01:00
Add a user preference that can be used as a fallback for the sender authentication.
This commit is contained in:
parent
f40e3c0788
commit
ddcd468070
7 changed files with 21 additions and 4 deletions
|
|
@ -99,9 +99,15 @@ class MessageGateway < ActionMailer::Base
|
|||
end
|
||||
|
||||
def sender_is_in_mailmap?(user, email)
|
||||
if (SITE_CONFIG['mailmap'].is_a? Hash) && SITE_CONFIG['email_dispatch'] == 'to'
|
||||
# Look for the sender in the map of allowed senders
|
||||
SITE_CONFIG['mailmap'][user.preference.sms_email].include? email.from[0]
|
||||
if SITE_CONFIG['email_dispatch'] == 'to'
|
||||
if SITE_CONFIG['mailmap'].is_a? Hash
|
||||
# Look for the sender in the map of allowed senders
|
||||
SITE_CONFIG['mailmap'][user.preference.sms_email].include? email.from[0]
|
||||
else
|
||||
# If the config mailmap isn't defined, use the values provided by the users.
|
||||
pref_senders = user.prefs.sms_permitted_senders.split(',').collect(&:strip)
|
||||
pref_senders.include? email.from[0]
|
||||
end
|
||||
else
|
||||
# We can't check the map if it's not defined, or if the lookup is the
|
||||
# wrong way round, so just allow it
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue