Added validation processes for reddit accounts

This commit is contained in:
2010-04-02 19:32:57 +01:00
parent 795066dfaa
commit 83a9113127
3 changed files with 19 additions and 9 deletions

View File

@@ -1,5 +1,6 @@
ROOT=/home/matalok/auth/auth ROOT=/home/matalok/auth/auth
@daily $ROOT/run-cron.py reddit.cron UpdateAPIs @daily $ROOT/run-cron.py reddit.cron UpdateAPIs
*/10 * * * * $ROOT/run-cron.py reddit.cron ProcessValidations
@daily $ROOT/run-cron.py eve_api.cron UpdateAPIs @daily $ROOT/run-cron.py eve_api.cron UpdateAPIs
*/10 * * * * $ROOT/run-cron.py sso.cron RemoveInvalidUsers > $ROOT/auth-update.log 2>&1 */10 * * * * $ROOT/run-cron.py sso.cron RemoveInvalidUsers > $ROOT/auth-update.log 2>&1

View File

@@ -52,20 +52,21 @@ class APIKeyParser:
def __str__(self): def __str__(self):
return "%s:%s" % (self.user_id, self.api_key) return "%s:%s" % (self.user_id, self.api_key)
class ProcessInbox(): class ProcessValidations():
""" """
Grabs all Reddit Mail and processes any new applications Grabs all Reddit Mail and processes validations
""" """
def job(self): def job(self):
inbox = Inbox(settings.REDDIT_USER, settings.REDDIT_PASSWORD) 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 and msg.new:
try: try:
key = APIKeyParser(msg.body) acc = RedditAccount.objects.get(username_iexact=msg.username)
except: if not acc.validated and msg.body == acc.user.username:
pass acc.validated = True
else: acc.save()
print key.username except RedditAccount.DoesNotExist:
continue

View File

@@ -93,6 +93,14 @@ FORCE_SCRIPT_NAME=""
DEFAULT_FROM_EMAIL = "bot@auth.dredd.it" DEFAULT_FROM_EMAIL = "bot@auth.dredd.it"
ACCOUNT_ACTIVATION_DAYS = 14 ACCOUNT_ACTIVATION_DAYS = 14
### Reddit Settings
# Username to validate accounts from
REDDIT_USER = 'DredditVerification'
# Password for validatio account
REDDIT_PASSWD = ''
### Jabber Service Settings ### Jabber Service Settings
# Vhost to add users to # Vhost to add users to