Skip to content
This repository was archived by the owner on Oct 23, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion fig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ web:
- PYTHONDONTWRITEBYTECODE=1
- DATABASE_URL=postgres://postgres@db/postgres
- DEBUG=True
- ALLOWED_HOSTS=localhost,127.0.0.1,
- ALLOWED_HOSTS=localhost,127.0.0.1
- BROWSERID_AUDIENCES='http://127.0.0.1:8000'
- SECRET_KEY=59114b6a-2858-4caf-8878-482a24ee9542
command:
./bin/run-fig.sh
7 changes: 7 additions & 0 deletions marketpulse/auth/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from django.conf.urls import patterns, include, url


urlpatterns = patterns(
'',
url(r'', include('django_browserid.urls'))
)
14 changes: 12 additions & 2 deletions marketpulse/base/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@

<link rel="stylesheet" type="text/css" href="{{ static('css/bootstrap.min.css') }}" media="screen" />
<link rel="stylesheet" type="text/css" href="{{ static('css/sandstone.min.css') }}" media="screen" />
<link href="{{ static('gaia/input_areas.css') }}" rel="stylesheet">
<link href="{{ static('gaia/switches.css') }}" rel="stylesheet">
<link rel="stylesheet" href="{{ static('gaia/input_areas.css') }}">
<link rel="stylesheet" href="{{ static('gaia/switches.css') }}" >
{{ browserid_css() }}
<link rel="stylesheet" type="text/css" href="{{ static('css/app.css') }}" media="screen" />
{% block css %}
{% endblock %}
Expand All @@ -33,6 +34,13 @@ <h2 class="hidden-xs">
<img class="main-logo" src="{{ static('img/marketpulse.png') }}" alt="Marketpulse">
</a>
</h2>
{{ browserid_info() }}
{% if user.is_authenticated() %}
<p>Current user: {{ user.email }}</p>
{{ browserid_logout(text='Logout') }}
{% else %}
{{ browserid_login(text='Login', color='dark') }}
{% endif %}
</header>

<div class="container">
Expand Down Expand Up @@ -74,7 +82,9 @@ <h2 class="hidden-xs">
<script src="{{ static('js/libs/bootstrap.min.js') }}"></script>
<script src="{{ static('js/site.js') }}"></script>
<script src="//mozorg.cdn.mozilla.net/tabzilla/tabzilla.js"></script>
{{ browserid_js() }}
<script src="{{ static('js/app.js') }}"></script>

{% block js %}
{% endblock %}

Expand Down
11 changes: 10 additions & 1 deletion marketpulse/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
'django.contrib.staticfiles',

# Third party apps
'django_browserid',
'django_nose',
'import_export',

Expand Down Expand Up @@ -114,9 +115,12 @@
'django.template.loaders.app_directories.Loader',
)

JINGO_EXCLUDE_APPS = ['browserid', 'admin']

# Django-CSP
CSP_DEFAULT_SRC = (
"'self'",
'https://login.persona.org',
'https://*.tiles.mapbox.com',
'https://*.cloudfront.net',
)
Expand All @@ -127,6 +131,7 @@
)
CSP_IMG_SRC = (
"'self'",
'data:',
'http://*.mozilla.net',
'https://*.mozilla.net',
'https://*.tiles.mapbox.com',
Expand All @@ -137,6 +142,7 @@
'https://www.mozilla.org',
'http://*.mozilla.net',
'https://*.mozilla.net',
'https://login.persona.org',
'https://*.mapbox.com',
)
CSP_STYLE_SRC = (
Expand All @@ -154,8 +160,11 @@
# Django-browserid settings
AUTHENTICATION_BACKENDS = ('django.contrib.auth.backends.ModelBackend',
'marketpulse.auth.backend.MozilliansAuthBackend')

BROWSERID_VERIFY_CLASS = 'marketpulse.auth.backend.BrowserIDVerify'
BROWSERID_AUDIENCES = [SITE_URL]
BROWSERID_AUDIENCES = config('BROWSERID_AUDIENCES', cast=Csv())
LOGIN_REDIRECT_URL = '/'
LOGIN_REDIRECT_URL_FAILURE = '/'

# Mozillians.org API settings
MOZILLIANS_API_URL = config('MOZILLIANS_API_URL', default=None)
Expand Down
3 changes: 3 additions & 0 deletions marketpulse/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from django.conf.urls import patterns, include, url
from django.contrib import admin


import jingo.monkey


Expand All @@ -10,7 +11,9 @@

urlpatterns = patterns(
'',

# Apps
url(r'', include('{0}.auth.urls'.format(settings.PROJECT_MODULE))),
url(r'', include('{0}.main.urls'.format(settings.PROJECT_MODULE), namespace='main')),

# Admin
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ setenv =
ALLOWED_HOSTS=localhost
DATABASE_URL=postgres://postgres@localhost/marketpulse_db
SITE_URL=127.0.0.1:8000
BROWSERID_AUDIENCES=http://127.0.0.1:8000
deps =
coverage==3.7.1
commands =
Expand Down