mirror of
https://github.com/nikdoof/django-testauth.git
synced 2025-12-17 11:49:23 +00:00
Fix settings import, and make the API url definable from settings
This commit is contained in:
@@ -4,8 +4,9 @@ import django.utils.simplejson as json
|
|||||||
import urllib
|
import urllib
|
||||||
import urllib2
|
import urllib2
|
||||||
from hashlib import sha1
|
from hashlib import sha1
|
||||||
|
from django.conf import settings
|
||||||
from django.contrib.auth.models import User, check_password, Group
|
from django.contrib.auth.models import User, check_password, Group
|
||||||
import settings
|
|
||||||
|
|
||||||
class TESTAuthBackend:
|
class TESTAuthBackend:
|
||||||
"""
|
"""
|
||||||
@@ -17,7 +18,7 @@ class TESTAuthBackend:
|
|||||||
|
|
||||||
if username and password:
|
if username and password:
|
||||||
# Call the webservice
|
# Call the webservice
|
||||||
api_url = 'https://auth.pleaseignore.com/api/1.0/login/'
|
api_url = getattr(settings, 'TEST_AUTH_LOGIN_URL', 'https://auth.pleaseignore.com/api/1.0/login/')
|
||||||
params = { 'user': username, 'pass': sha1(password).hexdigest() }
|
params = { 'user': username, 'pass': sha1(password).hexdigest() }
|
||||||
try:
|
try:
|
||||||
raw = urllib2.urlopen('%s?%s' % (api_url, urllib.urlencode(params)))
|
raw = urllib2.urlopen('%s?%s' % (api_url, urllib.urlencode(params)))
|
||||||
|
|||||||
Reference in New Issue
Block a user