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
|
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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user