From 646e60fafd583c1a6a44bfe4d90f909f144734bc Mon Sep 17 00:00:00 2001
From: Marco Ciotola <848222@stud.unive.it>
Date: Sun, 17 Feb 2019 17:15:04 +0100
Subject: [PATCH] import and serve only enabled auth systems urls

---
 .../djangofb/default_app/urls.py              |  2 +-
 helios_auth/urls.py                           | 40 ++++++++++---------
 2 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/helios_auth/auth_systems/facebookclient/djangofb/default_app/urls.py b/helios_auth/auth_systems/facebookclient/djangofb/default_app/urls.py
index 8501844..5e793a6 100644
--- a/helios_auth/auth_systems/facebookclient/djangofb/default_app/urls.py
+++ b/helios_auth/auth_systems/facebookclient/djangofb/default_app/urls.py
@@ -1,4 +1,4 @@
-from django.conf.urls.defaults import *
+from django.conf.urls import *
 
 urlpatterns = patterns('{{ project }}.{{ app }}.views',
     (r'^$', 'canvas'),
diff --git a/helios_auth/urls.py b/helios_auth/urls.py
index e4dca39..11d1013 100644
--- a/helios_auth/urls.py
+++ b/helios_auth/urls.py
@@ -1,31 +1,33 @@
+
 """
 Authentication URLs
 
 Ben Adida (ben@adida.net)
 """
 
-from django.conf.urls import *
+from django.conf.urls import url
 
-from views import *
-from auth_systems.password import password_login_view, password_forgotten_view
-from auth_systems.twitter import follow_view
+import views
+from settings import AUTH_ENABLED_AUTH_SYSTEMS
 
-urlpatterns = patterns('',
+urlpatterns = [
     # basic static stuff
-    (r'^$', index),
-    (r'^logout$', logout),
-    (r'^start/(?P<system_name>.*)$', start),
+    url(r'^$', views.index),
+    url(r'^logout$', views.logout),
+    url(r'^start/(?P<system_name>.*)$', views.start),
     # weird facebook constraint for trailing slash
-    (r'^after/$', after),
-    (r'^why$', perms_why),
-    (r'^after_intervention$', after_intervention),
-    
-    ## should make the following modular
+    url(r'^after/$', views.after),
+    url(r'^why$', views.perms_why),
+    url(r'^after_intervention$', views.after_intervention),
+]
 
-    # password auth
-    (r'^password/login', password_login_view),
-    (r'^password/forgot', password_forgotten_view),
+# password auth
+if 'password' in AUTH_ENABLED_AUTH_SYSTEMS:
+    from auth_systems.password import password_login_view, password_forgotten_view
+    urlpatterns.append(url(r'^password/login', password_login_view))
+    urlpatterns.append(url(r'^password/forgot', password_forgotten_view))
 
-    # twitter
-    (r'^twitter/follow', follow_view),
-)
+# twitter
+if 'twitter' in AUTH_ENABLED_AUTH_SYSTEMS:
+    from auth_systems.twitter import follow_view
+    urlpatterns.append(url(r'^twitter/follow', follow_view))
-- 
GitLab