diff --git a/clintools/settings.py b/clintools/settings.py index 8bf70b2..8ef6069 100644 --- a/clintools/settings.py +++ b/clintools/settings.py @@ -43,6 +43,7 @@ 'bootstrap3', 'bootstrap3_datetime', 'djangular', + 'shibboleth', ) MIDDLEWARE_CLASSES = ( @@ -54,8 +55,13 @@ 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.security.SecurityMiddleware', + 'shibboleth.middleware.ShibbolethRemoteUserMiddleware', ) +AUTHENTICATION_BACKENDS = [ + 'shibboleth.backends.ShibbolethRemoteUserBackend', +] + ROOT_URLCONF = 'clintools.urls' TEMPLATES = [ @@ -76,6 +82,16 @@ WSGI_APPLICATION = 'clintools.wsgi.application' +SHIBBOLETH_ATTRIBUTE_MAP = { + "wustlEduId": (True, "wustl-pk"), +# "cn": (False, "first_name"), + "givenName": (False, "first_name"), + "sn": (False, "last_name"), +# "mail": (False, "email"), +} + +LOGIN_URL = 'https://pttrack.snhc.wustl.edu/Shibboleth.sso/Login' + # Database # https://docs.djangoproject.com/en/1.8/ref/settings/#databases diff --git a/clintools/urls.py b/clintools/urls.py index 4014c92..ae957b7 100644 --- a/clintools/urls.py +++ b/clintools/urls.py @@ -8,6 +8,6 @@ # url(r'^blog/', include('blog.urls')), url(r'^pttrack/', include('pttrack.urls')), url(r'^admin/', include(admin.site.urls)), - url(r'^accounts/', include('django.contrib.auth.urls')), url(r'^$', RedirectView.as_view(pattern_name="home", permanent=False)), + url(r'^shib/', include('shibboleth.urls', namespace='shibboleth')), ] diff --git a/pttrack/templates/pttrack/base.html b/pttrack/templates/pttrack/base.html index 68d93a4..f5c42f1 100644 --- a/pttrack/templates/pttrack/base.html +++ b/pttrack/templates/pttrack/base.html @@ -40,7 +40,7 @@ {% if user.is_authenticated %} @@ -63,4 +63,4 @@ - \ No newline at end of file + diff --git a/pttrack/templates/pttrack/role-choice.html b/pttrack/templates/pttrack/role-choice.html index cddacca..f5ea24e 100644 --- a/pttrack/templates/pttrack/role-choice.html +++ b/pttrack/templates/pttrack/role-choice.html @@ -7,8 +7,8 @@ {% endblock %} {% block header %} -

Choose a role

-

You're listed as performing more than one role here. What are you doing today?

+

How are you volunteering?

+

It looks to us like you wear a couple of different hats around here. What are you doing today?

{% endblock %} {% block content %} @@ -41,4 +41,4 @@

Choose a role

-{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/pttrack/views.py b/pttrack/views.py index c749dfa..d41a980 100644 --- a/pttrack/views.py +++ b/pttrack/views.py @@ -70,9 +70,9 @@ class ProviderCreate(FormView): form_class = myforms.ProviderForm def get_initial(self): + return {'first_name': self.request.user.first_name, - 'last_name': self.request.user.last_name, - 'middle_name': self.request.user.last_name} + 'last_name': self.request.user.last_name} def form_valid(self, form): provider = form.save(commit=False) @@ -300,10 +300,13 @@ def choose_clintype(request): RADIO_CHOICE_KEY = 'radio-roles' if request.POST: + print "POST", request.session.items() request.session['clintype_pk'] = request.POST[RADIO_CHOICE_KEY] + print "POST", request.session.items() return HttpResponseRedirect(request.GET['next']) if request.GET: + print "GET", request.session.items() role_options = request.user.provider.clinical_roles.all() if len(role_options) == 1: diff --git a/requirements.txt b/requirements.txt index 84c9dd9..ed29007 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,5 +2,6 @@ Django==1.8.3 django-angular==0.7.15 django-bootstrap3==6.1.0 django-bootstrap3-datetimepicker==2.2.3 +-e git+https://github.com/Brown-University-Library/django-shibboleth-remoteuser.git@ee4abe32681d1f4caa17e6ee897f32985f1e6c33#egg=django-shibboleth-remoteuser requests==2.7.0 wheel==0.24.0 diff --git a/reset_db.sh b/reset_db.sh index 6bcff7d..ae97e23 100644 --- a/reset_db.sh +++ b/reset_db.sh @@ -1,3 +1,4 @@ rm db.sqlite3 rm pttrack/migrations/000*py +python manage.py collectstatic python manage.py makemigrations pttrack && python manage.py migrate && python manage.py shell < init_db.py