From: Magnus Hagander Date: Fri, 20 Feb 2009 14:07:28 +0000 (+0000) Subject: Remove hardcoded connection string (incl password) and put it in the settings X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=acfdd8f6ce111c33628c14005048b4658760a58d;p=hamn.git Remove hardcoded connection string (incl password) and put it in the settings file instead. Also, inherit from Model implementation so we can use permissions should we want to. --- diff --git a/planetadmin/auth.py b/planetadmin/auth.py index 3df82bc..acd2526 100644 --- a/planetadmin/auth.py +++ b/planetadmin/auth.py @@ -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() diff --git a/planetadmin/local_settings.py.sample b/planetadmin/local_settings.py.sample index 7d29788..304ad43 100644 --- a/planetadmin/local_settings.py.sample +++ b/planetadmin/local_settings.py.sample @@ -7,3 +7,4 @@ DEBUG = True NOTIFYADDR='some@where.com' +AUTH_CONNECTION_STRING='put community login connection string here'