Tightend up the reddit user validation process to avoid issues.

This commit is contained in:
2010-04-20 22:23:17 +01:00
parent b8eaf202d7
commit f8280b8bd7
2 changed files with 34 additions and 28 deletions

View File

@@ -58,14 +58,21 @@ class ProcessValidations():
Grabs all Reddit Mail and processes validations
"""
@property
def _logger(self):
if not hasattr(self, '__logger'):
self.__logger = logging.getLogger(__name__)
return self.__logger
def job(self):
inbox = Inbox(settings.REDDIT_USER, settings.REDDIT_PASSWD)
for msg in inbox:
if not msg.was_comment and msg.new:
if not msg.was_comment:
try:
acc = RedditAccount.objects.get(username__iexact=msg.author)
if not acc.validated and msg.body == acc.user.username:
if not acc.validated and msg.subject == "Validation: %s" % acc.user.username:
self._logger.info("Validated %s" % acc.user.username)
acc.validated = True
acc.save()
except RedditAccount.DoesNotExist:

View File

@@ -83,8 +83,7 @@ setup.</p>
<h2>Reddit Accounts</h2>
<p>This is a list of all your current linked Reddit accounts</p>
{% if redditaccounts %}
<p>To verify your Reddit account, login on Reddit then click
<a href="http://www.reddit.com/message/compose/?to=DredditVerification&subject=Verification">this link</a> and put your Auth username in the message.</p>
<p>To validate your Reddit account, login on Reddit then click the link next to the account, fill in some text in the message and click send.</p>
<table>
<thead>
<tr><th>Username</th><th>Created Date</th><th>Validated</th></tr>
@@ -93,7 +92,7 @@ setup.</p>
{% for acc in redditaccounts %}
<tr><td>{{ acc.username }}</td>
<td>{{ acc.date_created }}</td>
<td>{% if acc.validated %}Yes{% else %}No{% endif %}</td>
<td>{% if acc.validated %}Yes{% else %}No (<a href="http://www.reddit.com/message/compose/?to=DredditVerification&subject=Validation%3a%20{{user.username}}">Validate</a>){% endif %}</td>
</tr>
{% endfor %}
</tbody>