Skip to content

Commit 70772d8

Browse files
Merge pull request #106 from vaibhavsingh97/develop
Removed django-registration-redux along with the associated tests
2 parents f689520 + 118af87 commit 70772d8

15 files changed

+3
-289
lines changed

oshc/main/regbackend.py

Lines changed: 0 additions & 24 deletions
This file was deleted.

oshc/main/templates/base.html

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,6 @@
3535
<li><a href="https://github.com/OpenSourceHelpCommunity" target="_blank">Resources</a></li>
3636
<li><a href="mailto:opensourcehelpcommunity@gmail.com" target="_blank">Contact</a></li>
3737
<li><a href="https://opensourcehelp.herokuapp.com/" target="_blank">Join Us!</a></li>
38-
{% if user.is_authenticated %}
39-
<li><a href="#!">Hey {{ user.username }}!</a></li>
40-
<li><a href="{% url 'auth_logout' %}">Logout</a></li>
41-
{% else %}
42-
<li><a href="{% url 'auth_login' %}" target="_blank">Sign In</a></li>
43-
<li><a href="{% url 'registration_register' %}" target="_blank">Sign Up</a></li>
44-
{% endif %}
4538
</ul>
4639
</div>
4740
</div>

oshc/main/templates/registration/login.html

Lines changed: 0 additions & 35 deletions
This file was deleted.

oshc/main/templates/registration/logout.html

Lines changed: 0 additions & 9 deletions
This file was deleted.

oshc/main/templates/registration/password_reset_complete.html

Lines changed: 0 additions & 10 deletions
This file was deleted.

oshc/main/templates/registration/password_reset_confirm.html

Lines changed: 0 additions & 16 deletions
This file was deleted.

oshc/main/templates/registration/password_reset_done.html

Lines changed: 0 additions & 9 deletions
This file was deleted.

oshc/main/templates/registration/password_reset_email.html

Lines changed: 0 additions & 5 deletions
This file was deleted.

oshc/main/templates/registration/password_reset_form.html

Lines changed: 0 additions & 25 deletions
This file was deleted.

oshc/main/templates/registration/registration_closed.html

Lines changed: 0 additions & 9 deletions
This file was deleted.

oshc/main/templates/registration/registration_complete.html

Lines changed: 0 additions & 9 deletions
This file was deleted.

oshc/main/templates/registration/registration_form.html

Lines changed: 0 additions & 45 deletions
This file was deleted.

oshc/main/tests.py

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -5,69 +5,13 @@
55
from django.test import SimpleTestCase, TestCase
66
from django.urls import reverse
77

8-
from .regbackend import EmailLoginBackend
9-
10-
11-
class EmailLoginBackendTests(TestCase):
12-
13-
def setUp(self):
14-
self.credentials = {
15-
'username': 'testuser',
16-
'email': 'testuser@email.com',
17-
'password': 'secret'}
18-
self.user = User.objects.create_user(**self.credentials)
19-
20-
def test_valid_username_login(self):
21-
response = self.client.login(username=self.credentials['username'],
22-
password=self.credentials['password'])
23-
self.assertTrue(response)
24-
25-
def test_invalid_username_login(self):
26-
response = self.client.login(username='invalid_username',
27-
password=self.credentials['password'])
28-
self.assertFalse(response)
29-
30-
def test_valid_email_login(self):
31-
response = self.client.login(username=self.credentials['email'],
32-
password=self.credentials['password'])
33-
self.assertTrue(response)
34-
35-
def test_invalid_email_login(self):
36-
response = self.client.login(username='invalid_email',
37-
password=self.credentials['password'])
38-
self.assertFalse(response)
39-
40-
def test_invalid_password_login(self):
41-
response = self.client.login(username=self.credentials['email'],
42-
password='incorrect_password')
43-
self.assertFalse(response)
44-
45-
def test_valid_get_user(self):
46-
backend = EmailLoginBackend()
47-
returned_user = backend.get_user(self.user.id)
48-
self.assertEqual(returned_user.id, self.user.id)
49-
50-
def test_invalid_get_user(self):
51-
backend = EmailLoginBackend()
52-
# The database has only one user. User with id=10 doesn't exists
53-
returned_user = backend.get_user(user_id=10)
54-
self.assertIsNone(returned_user)
55-
568

579
class HomeViewTests(TestCase):
5810

5911
def test_get_request(self):
6012
response = self.client.get(reverse("home"))
6113
self.assertEqual(response.status_code, 200)
6214

63-
def test_login_accessible(self):
64-
response = self.client.get(reverse('auth_login'))
65-
self.assertEqual(response.status_code, 200)
66-
67-
def test_signup_accessible(self):
68-
response = self.client.get(reverse('registration_register'))
69-
self.assertEqual(response.status_code, 200)
70-
7115

7216
class RequestSessionViewTests(SimpleTestCase):
7317

oshc/oshc/settings.py

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
1212
import os
13-
import dj_database_url
1413

1514
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
1615

@@ -27,9 +26,9 @@
2726

2827
# Tuple of people who get error notifications
2928
ADMINS = [
30-
('Tapasweni Pathak','tapaswenipathak@gmail.com'),
31-
('Nikhita Raghunath','nikitaraghunath@gmail.com'),
32-
('Ibrahim Jarif','jarifibrahim@gmail.com'),
29+
('Tapasweni Pathak', 'tapaswenipathak@gmail.com'),
30+
('Nikhita Raghunath', 'nikitaraghunath@gmail.com'),
31+
('Ibrahim Jarif', 'jarifibrahim@gmail.com'),
3332
('Amar Prakash Pandey', 'amar.om1994@gmail.com')
3433
]
3534

@@ -43,7 +42,6 @@
4342
'django.contrib.sessions',
4443
'django.contrib.messages',
4544
'django.contrib.staticfiles',
46-
'registration',
4745
)
4846

4947
MIDDLEWARE_CLASSES = (
@@ -76,11 +74,6 @@
7674
},
7775
]
7876

79-
AUTHENTICATION_BACKENDS = (
80-
'main.regbackend.EmailLoginBackend',
81-
'django.contrib.auth.backends.ModelBackend'
82-
)
83-
8477
# Database
8578
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
8679

@@ -91,25 +84,6 @@
9184
}
9285
}
9386

94-
# Get DATABASE_URL environment variable and update default DATABASE settings
95-
db_from_env = dj_database_url.config()
96-
DATABASES['default'].update(db_from_env)
97-
98-
# If True, users can register
99-
REGISTRATION_OPEN = True
100-
# One-week activation window; you may, of course, use a different value.
101-
ACCOUNT_ACTIVATION_DAYS = 7
102-
# If True, the user will be automatically logged in.
103-
REGISTRATION_AUTO_LOGIN = True
104-
# If true, email will be sent as HTML
105-
# REGISTRATION_EMAIL_HTML = True
106-
# The page you want users to arrive at after they successfully log in
107-
# The page users are directed to if they are not logged in,
108-
LOGIN_REDIRECT_URL = 'home'
109-
# and are trying to access pages requiring authentication
110-
LOGIN_URL = '/accounts/login/'
111-
LOGOUT_REDIRECT_URL = 'home'
112-
11387
# Internationalization
11488
# https://docs.djangoproject.com/en/1.7/topics/i18n/
11589

oshc/oshc/urls.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@
44
urlpatterns = [
55
url(r'^admin/', admin.site.urls),
66
url(r'', include('main.urls')),
7-
url(r'^accounts/', include('registration.backends.simple.urls')),
87
]

0 commit comments

Comments
 (0)