Remove hardcoded connection string (incl password) and put it in the settings
authorMagnus Hagander <magnus@hagander.net>
Fri, 20 Feb 2009 14:07:28 +0000 (14:07 +0000)
committerMagnus Hagander <magnus@hagander.net>
Fri, 20 Feb 2009 14:07:28 +0000 (14:07 +0000)
file instead.
Also, inherit from Model implementation so we can use permissions should we want to.

planetadmin/auth.py
planetadmin/local_settings.py.sample

index 3df82bc689fba01a13fc999871e98abcf81e179b..acd25265b31d1f37f24aa7ef0ac62753d261561c 100644 (file)
@@ -1,9 +1,11 @@
 from django.contrib.auth.models import User
+from django.contrib.auth.backends import ModelBackend
+from django.conf import settings
 import psycopg2
 
-class AuthBackend:
+class AuthBackend(ModelBackend):
        def authenticate(self, username=None, password=None):
-               conn = psycopg2.connect('host=wwwmaster.postgresql.org dbname=186_www user=auth_svc password=g7y3m9u8 sslmode=require')
+               conn = psycopg2.connect(settings.AUTH_CONNECTION_STRING)
                try:
                        conn.set_client_encoding('UNICODE')
                        cur = conn.cursor()
index 7d297881e575588db3ef66d58ed764ba3c4f5621..304ad43ab978085a2a23e8d4e66b5d7ee181672a 100644 (file)
@@ -7,3 +7,4 @@ DEBUG = True
 
 NOTIFYADDR='some@where.com'
 
+AUTH_CONNECTION_STRING='put community login connection string here'