mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-25 02:06:10 +01:00
Sanitize all input to help with icky emails
This commit is contained in:
parent
ca4255332f
commit
2fda252378
1 changed files with 6 additions and 5 deletions
|
|
@ -1,4 +1,5 @@
|
|||
class MessageGateway < ActionMailer::Base
|
||||
include ActionView::Helpers::SanitizeHelper
|
||||
def receive(email)
|
||||
user = User.find(:first, :include => [:preference], :conditions => ["preferences.sms_email = ?", email.from[0].strip])
|
||||
if user.nil?
|
||||
|
|
@ -11,16 +12,16 @@ class MessageGateway < ActionMailer::Base
|
|||
notes = nil
|
||||
|
||||
if email.content_type == "multipart/related"
|
||||
description = email.subject
|
||||
description = sanitize email.subject
|
||||
body_part = email.parts.find{|m| m.content_type == "text/plain"}
|
||||
notes = body_part.body.strip
|
||||
notes = sanitize body_part.body.strip
|
||||
else
|
||||
if email.subject.empty?
|
||||
description = email.body.strip
|
||||
description = sanitize email.body.strip
|
||||
notes = nil
|
||||
else
|
||||
description = email.subject.strip
|
||||
notes = email.body.strip
|
||||
description = sanitize email.subject.strip
|
||||
notes = sanitize email.body.strip
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue