From 845191001660854263ea1c8f53313292d102b498 Mon Sep 17 00:00:00 2001 From: Sergio Oliveira Date: Thu, 8 Aug 2013 16:42:36 -0300 Subject: [PATCH] Adding accounts app (with auth backend) --- src/accounts/__init__.py | 0 src/accounts/auth.py | 10 ++++++++++ src/accounts/models.py | 3 +++ src/accounts/tests.py | 16 ++++++++++++++++ src/accounts/views.py | 1 + src/colab/custom_settings.py | 1 + 6 files changed, 31 insertions(+), 0 deletions(-) create mode 100644 src/accounts/__init__.py create mode 100644 src/accounts/auth.py create mode 100644 src/accounts/models.py create mode 100644 src/accounts/tests.py create mode 100644 src/accounts/views.py diff --git a/src/accounts/__init__.py b/src/accounts/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/accounts/__init__.py diff --git a/src/accounts/auth.py b/src/accounts/auth.py new file mode 100644 index 0000000..7802acb --- /dev/null +++ b/src/accounts/auth.py @@ -0,0 +1,10 @@ + +from django_browserid.auth import BrowserIDBackend + +class ColabBrowserIDBackend(BrowserIDBackend): + def filter_users_by_email(self, email): + return self.User.objects.filter(emails__address=email) + + def authenticate(self, *args, **kw): + #import pdb; pdb.set_trace(); + return super(ColabBrowserIDBackend, self).authenticate(*args, **kw) diff --git a/src/accounts/models.py b/src/accounts/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/src/accounts/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/src/accounts/tests.py b/src/accounts/tests.py new file mode 100644 index 0000000..501deb7 --- /dev/null +++ b/src/accounts/tests.py @@ -0,0 +1,16 @@ +""" +This file demonstrates writing tests using the unittest module. These will pass +when you run "manage.py test". + +Replace this with more appropriate tests for your application. +""" + +from django.test import TestCase + + +class SimpleTest(TestCase): + def test_basic_addition(self): + """ + Tests that 1 + 1 always equals 2. + """ + self.assertEqual(1 + 1, 2) diff --git a/src/accounts/views.py b/src/accounts/views.py new file mode 100644 index 0000000..60f00ef --- /dev/null +++ b/src/accounts/views.py @@ -0,0 +1 @@ +# Create your views here. diff --git a/src/colab/custom_settings.py b/src/colab/custom_settings.py index c32aeeb..785e62c 100644 --- a/src/colab/custom_settings.py +++ b/src/colab/custom_settings.py @@ -29,6 +29,7 @@ INSTALLED_APPS = INSTALLED_APPS + ( 'rss', 'colab.deprecated', 'planet', + 'accounts', # Feedzilla and deps 'feedzilla', -- libgit2 0.21.2