mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 23:02:19 +00:00
Silent fail if Reddit login errors
This commit is contained in:
10
hr/views.py
10
hr/views.py
@@ -29,9 +29,13 @@ def send_message(application, message_type, note=None):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
if len(application.user.redditaccount_set.all()) > 0:
|
if len(application.user.redditaccount_set.all()) > 0:
|
||||||
from reddit.api import Inbox
|
from reddit.api import Inbox, LoginError
|
||||||
ib = Inbox(settings.REDDIT_USER, settings.REDDIT_PASSWD)
|
try:
|
||||||
ib.send(application.user.redditaccount_set.all()[0].username, subject, message)
|
ib = Inbox(settings.REDDIT_USER, settings.REDDIT_PASSWD)
|
||||||
|
except LoginError:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
ib.send(application.user.redditaccount_set.all()[0].username, subject, message)
|
||||||
|
|
||||||
|
|
||||||
def check_permissions(user, application=None):
|
def check_permissions(user, application=None):
|
||||||
|
|||||||
Reference in New Issue
Block a user