summaryrefslogtreecommitdiff
path: root/drupal_auth/backends.py
diff options
context:
space:
mode:
authorJayaram Pai2013-12-08 20:43:40 +0530
committerJayaram Pai2013-12-08 20:43:40 +0530
commitb596364cf3f871887cce519291b684341cc5c014 (patch)
tree48dcb9366be1f1110f2fda27afa6485b6c3bdb64 /drupal_auth/backends.py
parent41e5496301cd02bff34dad877d20b2dd30349866 (diff)
downloadFOSSEE-Forum-b596364cf3f871887cce519291b684341cc5c014.tar.gz
FOSSEE-Forum-b596364cf3f871887cce519291b684341cc5c014.tar.bz2
FOSSEE-Forum-b596364cf3f871887cce519291b684341cc5c014.zip
added nicEdit / on-the-fly question edit
Diffstat (limited to 'drupal_auth/backends.py')
-rw-r--r--drupal_auth/backends.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/drupal_auth/backends.py b/drupal_auth/backends.py
index 1caa1f0..2b29615 100644
--- a/drupal_auth/backends.py
+++ b/drupal_auth/backends.py
@@ -1,3 +1,5 @@
+import hashlib
+
from django.contrib.auth.models import User
from django.contrib.auth import get_user_model
from django.shortcuts import render_to_response, get_object_or_404
@@ -7,17 +9,17 @@ User = get_user_model()
class DrupalAuthBackend(object):
def authenticate(self, username=None, password=None):
try:
- user = User(name='cheese')
- user.is_active = True
- user.is_authenticated = True
- return user
- except Exception, e:
- print e.message
- print "blaj"*1000
+ user = User.objects.get(username=username)
+ p = hashlib.md5()
+ p.update(password)
+ if user.password == p.hexdigest():
+ return user
+ return None
+ except User.DoesNotExist:
+ return None
def get_user(self, user_id):
try:
- print "Hello"*1000
return User.objects.get(pk=user_id)
except User.DoesNotExist:
return None