mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 23:02:19 +00:00
Tightend up the reddit user validation process to avoid issues.
This commit is contained in:
@@ -58,14 +58,21 @@ class ProcessValidations():
|
|||||||
Grabs all Reddit Mail and processes validations
|
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):
|
def job(self):
|
||||||
inbox = Inbox(settings.REDDIT_USER, settings.REDDIT_PASSWD)
|
inbox = Inbox(settings.REDDIT_USER, settings.REDDIT_PASSWD)
|
||||||
|
|
||||||
for msg in inbox:
|
for msg in inbox:
|
||||||
if not msg.was_comment and msg.new:
|
if not msg.was_comment:
|
||||||
try:
|
try:
|
||||||
acc = RedditAccount.objects.get(username__iexact=msg.author)
|
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.validated = True
|
||||||
acc.save()
|
acc.save()
|
||||||
except RedditAccount.DoesNotExist:
|
except RedditAccount.DoesNotExist:
|
||||||
|
|||||||
@@ -83,8 +83,7 @@ setup.</p>
|
|||||||
<h2>Reddit Accounts</h2>
|
<h2>Reddit Accounts</h2>
|
||||||
<p>This is a list of all your current linked Reddit accounts</p>
|
<p>This is a list of all your current linked Reddit accounts</p>
|
||||||
{% if redditaccounts %}
|
{% if redditaccounts %}
|
||||||
<p>To verify your Reddit account, login on Reddit then click
|
<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>
|
||||||
<a href="http://www.reddit.com/message/compose/?to=DredditVerification&subject=Verification">this link</a> and put your Auth username in the message.</p>
|
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr><th>Username</th><th>Created Date</th><th>Validated</th></tr>
|
<tr><th>Username</th><th>Created Date</th><th>Validated</th></tr>
|
||||||
@@ -93,7 +92,7 @@ setup.</p>
|
|||||||
{% for acc in redditaccounts %}
|
{% for acc in redditaccounts %}
|
||||||
<tr><td>{{ acc.username }}</td>
|
<tr><td>{{ acc.username }}</td>
|
||||||
<td>{{ acc.date_created }}</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>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
Reference in New Issue
Block a user