summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
20fb506)
* Add a conn.close() to prevent resource leaks.
* Remove debug output from auth.py
# No data? No login.
if (cursor.rowcount == 0):
# No data? No login.
if (cursor.rowcount == 0):
- print("User %s not found", username)
return False
# Check password
return False
# Check password
Most of this code has been taken from Django's user auth tutorial.
"""
def authenticate(self, username=None, password=None):
Most of this code has been taken from Django's user auth tutorial.
"""
def authenticate(self, username=None, password=None):
email = self.check_login(username, password)
if email:
email = self.check_login(username, password)
if email:
- print "Login checked out"
try:
user = User.objects.get(username=username)
except User.DoesNotExist:
try:
user = User.objects.get(username=username)
except User.DoesNotExist:
- print "User did nog exist"
# Create a new user. Note that we can set password
# to anything, because it won't be checked; the password
# from settings.py will.
user = User(username=username, password='get from settings.py')
user.email = email
# Create a new user. Note that we can set password
# to anything, because it won't be checked; the password
# from settings.py will.
user = User(username=username, password='get from settings.py')
user.email = email
+ user.set_unusable_password()
return user
else:
return None
return user
else:
return None