mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 14:52:15 +00:00
Added validation processes for reddit accounts
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
ROOT=/home/matalok/auth/auth
|
||||
|
||||
@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
|
||||
*/10 * * * * $ROOT/run-cron.py sso.cron RemoveInvalidUsers > $ROOT/auth-update.log 2>&1
|
||||
|
||||
@@ -52,20 +52,21 @@ class APIKeyParser:
|
||||
def __str__(self):
|
||||
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):
|
||||
inbox = Inbox(settings.REDDIT_USER, settings.REDDIT_PASSWORD)
|
||||
inbox = Inbox(settings.REDDIT_USER, settings.REDDIT_PASSWD)
|
||||
|
||||
for msg in inbox:
|
||||
if not msg.was_comment and msg.new:
|
||||
try:
|
||||
key = APIKeyParser(msg.body)
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
print key.username
|
||||
acc = RedditAccount.objects.get(username_iexact=msg.username)
|
||||
if not acc.validated and msg.body == acc.user.username:
|
||||
acc.validated = True
|
||||
acc.save()
|
||||
except RedditAccount.DoesNotExist:
|
||||
continue
|
||||
|
||||
|
||||
@@ -93,6 +93,14 @@ FORCE_SCRIPT_NAME=""
|
||||
DEFAULT_FROM_EMAIL = "bot@auth.dredd.it"
|
||||
ACCOUNT_ACTIVATION_DAYS = 14
|
||||
|
||||
### Reddit Settings
|
||||
|
||||
# Username to validate accounts from
|
||||
REDDIT_USER = 'DredditVerification'
|
||||
|
||||
# Password for validatio account
|
||||
REDDIT_PASSWD = ''
|
||||
|
||||
### Jabber Service Settings
|
||||
|
||||
# Vhost to add users to
|
||||
|
||||
Reference in New Issue
Block a user