summaryrefslogtreecommitdiffstats
path: root/askbot/mail
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2012-07-21 15:09:16 -0400
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2012-07-21 15:09:16 -0400
commita98c235cc139d34cd64bad8699ffd7ce944b2141 (patch)
treeab3e527d452f0e1f83bd526516b50809d2b9b35c /askbot/mail
parentf9fac8c3ef3abb9803d7b814d29f00e44faf8cd4 (diff)
downloadaskbot-a98c235cc139d34cd64bad8699ffd7ce944b2141.tar.gz
askbot-a98c235cc139d34cd64bad8699ffd7ce944b2141.tar.bz2
askbot-a98c235cc139d34cd64bad8699ffd7ce944b2141.zip
added email bounce on undetected signature in the ask form
Diffstat (limited to 'askbot/mail')
-rw-r--r--askbot/mail/__init__.py22
-rw-r--r--askbot/mail/lamson_handlers.py1
2 files changed, 13 insertions, 10 deletions
diff --git a/askbot/mail/__init__.py b/askbot/mail/__init__.py
index 1c32f14d..e653a0e3 100644
--- a/askbot/mail/__init__.py
+++ b/askbot/mail/__init__.py
@@ -344,14 +344,21 @@ def process_emailed_question(
form = AskByEmailForm(data)
if form.is_valid():
email_address = form.cleaned_data['email']
- user = User.objects.get(
- email__iexact = email_address
- )
+ user = User.objects.get(email__iexact = email_address)
- if user.can_post_by_email() == False:
+ if user.can_post_by_email() is False:
raise PermissionDenied(messages.insufficient_reputation(user))
- if user.email_isvalid == False:
+ body_text = form.cleaned_data['body_text']
+ stripped_body_text = user.strip_email_signature(body_text)
+ signature_not_detected = (
+ stripped_body_text == body_text and user.email_signature
+ )
+
+ #ask for signature response if user's email has not been
+ #validated yet or if email signature could not be found
+ if user.email_isvalid is False or signature_not_detected:
+
reply_to = ReplyAddress.objects.create_new(
user = user,
reply_action = 'validate_email'
@@ -361,16 +368,11 @@ def process_emailed_question(
tagnames = form.cleaned_data['tagnames']
title = form.cleaned_data['title']
- body_text = form.cleaned_data['body_text']
#defect - here we might get "too many tags" issue
if tags:
tagnames += ' ' + ' '.join(tags)
- stripped_body_text = user.strip_email_signature(body_text)
- if stripped_body_text == body_text and user.email_signature:
- #todo: send an email asking to update the signature
- raise ValueError('email signature changed')
user.post_question(
title = title,
diff --git a/askbot/mail/lamson_handlers.py b/askbot/mail/lamson_handlers.py
index f7053414..8de3bd71 100644
--- a/askbot/mail/lamson_handlers.py
+++ b/askbot/mail/lamson_handlers.py
@@ -195,6 +195,7 @@ def ASK(message, host = None, addr = None):
from_address, subject, body_text, stored_files
)
else:
+ #this is the Ask the group branch
if askbot_settings.GROUP_EMAIL_ADDRESSES_ENABLED == False:
return
try: