mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-22 21:38:11 -05:00
Centralize fraud email sending
Also provides a generic `Kind` for fraud hooks.
This commit is contained in:
@@ -49,6 +49,12 @@ def _nerds_email(body, from_name, kind):
|
||||
Email.handler.add_to_queue(None, g.nerds_email, from_name, g.nerds_email,
|
||||
kind, body = body)
|
||||
|
||||
def _fraud_email(body, kind):
|
||||
"""
|
||||
For sending email to the fraud mailbox
|
||||
"""
|
||||
Email.handler.add_to_queue(None, g.fraud_email, g.domain, g.fraud_email,
|
||||
kind, body=body)
|
||||
|
||||
def verify_email(user, dest=None):
|
||||
"""
|
||||
@@ -257,13 +263,16 @@ def void_payment(thing, campaign, reason):
|
||||
reason=reason)
|
||||
|
||||
|
||||
def fraud_alert(body):
|
||||
return _fraud_email(body, Email.Kind.FRAUD_ALERT)
|
||||
|
||||
def suspicious_payment(user, link):
|
||||
from r2.lib.pages import SuspiciousPaymentEmail
|
||||
|
||||
email = "fraud@reddit.com"
|
||||
body = SuspiciousPaymentEmail(user, link).render(style="email")
|
||||
kind = Email.Kind.SUSPICIOUS_PAYMENT
|
||||
_system_email(email, body, kind)
|
||||
|
||||
return _fraud_email(body, kind)
|
||||
|
||||
|
||||
def send_html_email(to_addr, from_addr, subject, html, subtype="html"):
|
||||
|
||||
@@ -307,6 +307,7 @@ class Email(object):
|
||||
"VOID_PAYMENT",
|
||||
"GOLD_GIFT_CODE",
|
||||
"SUSPICIOUS_PAYMENT",
|
||||
"FRAUD_ALERT",
|
||||
)
|
||||
|
||||
# Do not remove anything from this dictionary! See above comment.
|
||||
@@ -333,6 +334,7 @@ class Email(object):
|
||||
Kind.VOID_PAYMENT: _("[reddit] your payment has been voided"),
|
||||
Kind.GOLD_GIFT_CODE: _("[reddit] your reddit gold gift code"),
|
||||
Kind.SUSPICIOUS_PAYMENT: _("[selfserve] suspicious payment alert"),
|
||||
Kind.FRAUD_ALERT: _("[selfserve] fraud alert")
|
||||
}
|
||||
|
||||
def __init__(self, user, thing, email, from_name, date, ip,
|
||||
|
||||
Reference in New Issue
Block a user