Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Switch to Django's built-in auth handler.

  • Loading branch information...
commit 96200d8d6f394567446460d15dbde7f1438c1bad 1 parent c3b0917
Aymeric Augustin aaugustin authored
Showing with 2 additions and 25 deletions.
  1. +2 −0  django_www/wsgi.py
  2. +0 −25 tracdb/wsgiauth.py
2  django_www/wsgi.py
View
@@ -12,3 +12,5 @@
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
+
+from django.contrib.auth.handlers.modwsgi import check_password, groups_for_user
25 tracdb/wsgiauth.py
View
@@ -1,25 +0,0 @@
-# WSGI auth handlers for Trac
-
-import os
-os.environ['DJANGO_SETTINGS_MODULE'] = 'django_www.settings'
-
-from django import db
-from django.contrib.auth.models import User
-
-def check_password(environ, user, password):
- try:
- user = User.objects.get(username=user, is_active=True)
- if user.check_password(password):
- return True
- return False
- except User.DoesNotExist:
- return None
- finally:
- db.connection.close()
-
-def groups_for_user(environ, user):
- try:
- u = User.objects.get(username=user)
- except User.DoesNotExist:
- return []
- return [g.name.lower() for g in u.groups.all()]
Please sign in to comment.
Something went wrong with that request. Please try again.