Skip to content

Commit

Permalink
Remove Firefox Accounts and related code
Browse files Browse the repository at this point in the history
- Drop django-allauth, oauthlib, and python3-openid from
  requirements.txt

- Remove FxA and allauth related things from testpilot/settings.py,
  including Basket API keys

- Remove more FxA related modules from the testpilot.users app

- Clean up unused Jinja templates

- user_id no longer needed in frontend view

- Remove & clean up tests

Fixes mozilla#1035
  • Loading branch information
lmorchard committed Jul 15, 2016
1 parent 067d081 commit 2a02728
Show file tree
Hide file tree
Showing 21 changed files with 1 addition and 450 deletions.
1 change: 0 additions & 1 deletion bin/run-common.sh
Expand Up @@ -2,4 +2,3 @@

./manage.py migrate --noinput
./manage.py createinitialsuperuser
./manage.py updatefxaprovider
10 changes: 0 additions & 10 deletions requirements.txt
Expand Up @@ -79,19 +79,9 @@ django-jinja==1.4.1 \
defusedxml==0.4.1 \
--hash=sha256:cd551d5a518b745407635bb85116eb813818ecaf182e773c35b36239fc3f2478 \
--hash=sha256:1f7e2f6546caba6a52bcd6a6087df60c1cc63cdbc0d9ca3e5d517adcb5823d0c
django-allauth==0.24.1 \
--hash=sha256:229a6a5a63ff55f9eb46d4dae3863ba775735bf60bfc16bf4e2042f214f18e1d
oauthlib==1.0.3 \
--hash=sha256:ef4bfe4663ca3b97a995860c0173b967ebd98033d02f38c9e1b2cbb6c191d9ad
python3-openid==3.0.6 \
--hash=sha256:833086e554515d58fe39f9326eae5c929ff448f0fce6350d45f622c9cc1591c6 \
--hash=sha256:8b82c6e8ac590b0433988138bf63d934dbf5cdcbad1643ec7e25cc0ce90ca50a
requests==2.7.0 \
--hash=sha256:20f976cdce02a42b69ce80e9e03897a51814b36d448b37288546086ebc473146 \
--hash=sha256:398a3db6d61899d25fd4a06c6ca12051b0ce171d705decd7ed5511517b4bb93d
requests_oauthlib==0.5.0 \
--hash=sha256:658d9aba85338be8c1d1532c9fb5807b381dc7166e469ff0f62fcaa4240d9eb8 \
--hash=sha256:c7d2ee6c2e8c58a0fd60c2d7d21ce93c8d2b22e7a9f232d4bf915326afb479af
Pillow==3.2.0 \
--hash=sha256:f6e89c3b024a13060de19732e82d1dfd657cdf46b15d647c0f0f5aaa07a6a419 \
--hash=sha256:46cbc1d1487a9c590708e9e135530ac94af8373bf1e8ef0c7acf6cc46c84d3c4 \
Expand Down
3 changes: 1 addition & 2 deletions testpilot/frontend/views.py
Expand Up @@ -2,5 +2,4 @@


def index(request, url=''):
return render(request, 'testpilot/frontend/index.html',
{'user_id': request.user.email if not request.user.is_anonymous() else ''})
return render(request, 'testpilot/frontend/index.html')
47 changes: 0 additions & 47 deletions testpilot/settings.py
Expand Up @@ -86,12 +86,6 @@ def path(*args):
'constance.backends.database',
'constance',

# FxA auth handling
'allauth',
'allauth.account',
'allauth.socialaccount',
'testpilot.users.providers.fxa',

# Django apps
'django.contrib.admin',
'django.contrib.auth',
Expand Down Expand Up @@ -121,11 +115,7 @@ def path(*args):


AUTHENTICATION_BACKENDS = (
# Needed to login by username in Django admin, regardless of `allauth`
'django.contrib.auth.backends.ModelBackend',

# `allauth` specific authentication methods, such as login by e-mail
'allauth.account.auth_backends.AuthenticationBackend',
)

REST_FRAMEWORK = {
Expand All @@ -139,40 +129,6 @@ def path(*args):
'DEFAULT_VERSION': '1.0.0'
}

SOCIALACCOUNT_PROVIDERS = {
'fxa': dict(
ACCESS_TOKEN_URL=config(
'FXA_ACCESS_TOKEN_URL',
default='https://oauth.accounts.firefox.com/v1/token'),
AUTHORIZE_URL=config(
'FXA_AUTHORIZE_URL',
default='https://oauth.accounts.firefox.com/v1/authorization'),
PROFILE_URL=config(
'FXA_PROFILE_URL',
default='https://profile.accounts.firefox.com/v1/profile'),
SCOPE=["profile"],
AUTH_PARAMS={
"verification_redirect": "always"
}
)
}

FXA_CLIENT_ID = config('FXA_CLIENT_ID', default=None)

FXA_SECRET_KEY = config('FXA_SECRET_KEY', default=None)

BASKET_API_KEY = config('BASKET_API_KEY', default=None)

BASKET_LOOKUP_USER_URL = 'https://basket.mozilla.org/news/lookup-user/'

BASKET_UNSUBSCRIBE_URL = 'https://basket.mozilla.org/news/unsubscribe/'

BASKET_SUBSCRIBE_URL = 'https://basket.mozilla.org/news/subscribe/'

SOCIALACCOUNT_AUTO_SIGNUP = True

SOCIALACCOUNT_EMAIL_VERIFICATION = False

ACCOUNT_EMAIL_VERIFICATION = False


Expand Down Expand Up @@ -361,10 +317,7 @@ def lazy_langs():
'django.template.context_processors.tz',
'django.template.context_processors.request',
'django.contrib.messages.context_processors.messages',

# `allauth` needs this from django
'django.template.context_processors.request',

],
}
},
Expand Down
1 change: 0 additions & 1 deletion testpilot/users/__init__.py
@@ -1 +0,0 @@
default_app_config = 'testpilot.users.apps.TestPilotUsersAppConfig'
9 changes: 0 additions & 9 deletions testpilot/users/apps.py

This file was deleted.

Empty file.
Empty file.
50 changes: 0 additions & 50 deletions testpilot/users/management/commands/updatefxaprovider.py

This file was deleted.

29 changes: 0 additions & 29 deletions testpilot/users/models.py
@@ -1,11 +1,8 @@
from django.db import models
from django.contrib.auth.models import User
from django.conf import settings

from ..utils import HashedUploadTo

import requests

avatar_upload_to = HashedUploadTo('avatar')


Expand Down Expand Up @@ -39,29 +36,3 @@ def natural_key(self):
return self.user.natural_key()

natural_key.dependencies = ['auth.user']

def unsubscribe(self):
"""Unsubscribe this email from basket. Lookup-user call for token, then
perform the unsubscribe"""
try:
if settings.BASKET_API_KEY is None:
return 'API Key not found'
email = self.user.email
url = settings.BASKET_LOOKUP_USER_URL

params = {'api_key': settings.BASKET_API_KEY, 'email': email}
r = requests.get(url, params=params)
resp = r.json()

if 'token' not in resp:
return 'email not found in basket'
user_token = resp['token']

url = settings.BASKET_UNSUBSCRIBE_URL + user_token + '/'
payload = {'newsletters': 'test-pilot', 'email': email}
r = requests.post(url, data=payload)
resp = r.json()

return resp
except Exception as e:
return e
Empty file.
Empty file.
32 changes: 0 additions & 32 deletions testpilot/users/providers/fxa/provider.py

This file was deleted.

4 changes: 0 additions & 4 deletions testpilot/users/providers/fxa/urls.py

This file was deleted.

35 changes: 0 additions & 35 deletions testpilot/users/providers/fxa/views.py

This file was deleted.

20 changes: 0 additions & 20 deletions testpilot/users/signals.py

This file was deleted.

17 changes: 0 additions & 17 deletions testpilot/users/templates/account/logout.html

This file was deleted.

16 changes: 0 additions & 16 deletions testpilot/users/templates/socialaccount/authentication_error.html

This file was deleted.

11 changes: 0 additions & 11 deletions testpilot/users/templates/socialaccount/login_cancelled.html

This file was deleted.

22 changes: 0 additions & 22 deletions testpilot/users/templates/socialaccount/signup.html

This file was deleted.

0 comments on commit 2a02728

Please sign in to comment.