diff --git a/nsupdate/login/templates/logout.html b/nsupdate/login/templates/logout.html
index d24bdbf..eab7aec 100644
--- a/nsupdate/login/templates/logout.html
+++ b/nsupdate/login/templates/logout.html
@@ -6,7 +6,7 @@
{% endblock %}
diff --git a/nsupdate/login/urls.py b/nsupdate/login/urls.py
index aecb748..87ea866 100644
--- a/nsupdate/login/urls.py
+++ b/nsupdate/login/urls.py
@@ -1,21 +1,22 @@
# -*- coding: utf-8 -*-
-from django.conf.urls import patterns, url
+from django.conf.urls import url
+from django.contrib.auth.views import login, logout_then_login, password_reset, password_reset_done, \
+ password_reset_confirm, password_reset_complete
-urlpatterns = patterns(
- '',
+urlpatterns = (
# login and logout url
- url(r'^login/$', 'django.contrib.auth.views.login', {'template_name': 'login.html'}, name='login'),
- # or use 'django.contrib.auth.views.logout' with template 'logout.html
- url(r'^logout/$', 'django.contrib.auth.views.logout_then_login', name='logout'),
+ url(r'^login/$', login, {'template_name': 'login.html'}, name='login'),
+ # or use logout with template 'logout.html'
+ url(r'^logout/$', logout_then_login, name='logout'),
# password reset urls
- url(r'^password_reset/$', 'django.contrib.auth.views.password_reset',
- {'template_name': 'password_reset.html'}, name='password_reset'),
- url(r'^password_reset_done/$', 'django.contrib.auth.views.password_reset_done',
+ url(r'^password_reset/$', password_reset, {'template_name': 'password_reset.html'},
+ name='password_reset'),
+ url(r'^password_reset_done/$', password_reset_done,
{'template_name': 'password_reset_done.html'}, name='password_reset_done'),
url(r'^password_reset_confirm/(?P
[0-9A-Za-z_\-]+)/(?P.+)/$',
- 'django.contrib.auth.views.password_reset_confirm',
- {'template_name': 'password_reset_confirm.html'}, name='password_reset_confirm'),
- url(r'^password_reset_complete/$', 'django.contrib.auth.views.password_reset_complete',
+ password_reset_confirm, {'template_name': 'password_reset_confirm.html'},
+ name='password_reset_confirm'),
+ url(r'^password_reset_complete/$', password_reset_complete,
{'template_name': 'password_reset_complete.html'}, name='password_reset_complete'),
)
diff --git a/nsupdate/main/urls.py b/nsupdate/main/urls.py
index e9d7980..974f919 100644
--- a/nsupdate/main/urls.py
+++ b/nsupdate/main/urls.py
@@ -2,7 +2,7 @@
main app url dispatching
"""
-from django.conf.urls import patterns, url
+from django.conf.urls import url
from .views import (
HomeView, OverviewView, HostView, AddHostView, DeleteHostView, AboutView, GenerateSecretView, GenerateNSSecretView,
@@ -14,8 +14,7 @@ from ..api.views import (
NicDeleteView, AuthorizedNicDeleteView)
-urlpatterns = patterns(
- '',
+urlpatterns = (
# interactive web ui
url(r'^$', HomeView.as_view(), name="home"),
url(r'^about/$', AboutView.as_view(), name="about"),
diff --git a/nsupdate/main/views.py b/nsupdate/main/views.py
index b9d37f2..3a504b8 100644
--- a/nsupdate/main/views.py
+++ b/nsupdate/main/views.py
@@ -195,7 +195,7 @@ class OverviewView(TemplateView):
.only("name", "comment", "available", "client_faults", "server_faults", "abuse_blocked", "abuse",
"last_update_ipv4", "tls_update_ipv4", "last_update_ipv6", "tls_update_ipv6", "domain__name")
context['your_domains'] = Domain.objects.filter(
- created_by=self.request.user).select_related("created_by__username")\
+ created_by=self.request.user).select_related("created_by__profile")\
.only("name", "public", "available", "comment", "created_by__username")
context['public_domains'] = Domain.objects.filter(
public=True).exclude(created_by=self.request.user).select_related("created_by")\
@@ -215,7 +215,7 @@ class AddHostView(CreateView):
def get_success_url(self):
return reverse('generate_secret_view', args=(self.object.pk,))
- def get_form(self, form_class):
+ def get_form(self, form_class=None):
form = super(AddHostView, self).get_form(form_class)
form.fields['domain'].queryset = Domain.objects.filter(
Q(created_by=self.request.user) | Q(public=True))
@@ -347,7 +347,7 @@ class AddRelatedHostView(CreateView):
def get_success_url(self):
return reverse('related_host_overview', args=(self.object.main_host.pk, ))
- def get_form(self, form_class):
+ def get_form(self, form_class=None):
form = super(AddRelatedHostView, self).get_form(form_class)
return form
diff --git a/nsupdate/settings/base.py b/nsupdate/settings/base.py
index 982db64..7bd159b 100644
--- a/nsupdate/settings/base.py
+++ b/nsupdate/settings/base.py
@@ -264,8 +264,17 @@ SESSION_COOKIE_HTTPONLY = True
SESSION_COOKIE_AGE = 14 * 24 * 60 * 60 # 14 days, in seconds (remember_me is True)
SESSION_EXPIRE_AT_BROWSER_CLOSE = True # more safe (remember_me is False)
-# python-social-auth settings
+# Allow SHA1 for host update secrets
+PASSWORD_HASHERS = [
+ 'django.contrib.auth.hashers.PBKDF2PasswordHasher',
+ 'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher',
+ 'django.contrib.auth.hashers.Argon2PasswordHasher',
+ 'django.contrib.auth.hashers.BCryptSHA256PasswordHasher',
+ 'django.contrib.auth.hashers.BCryptPasswordHasher',
+ 'django.contrib.auth.hashers.SHA1PasswordHasher',
+]
+# python-social-auth settings
AUTHENTICATION_BACKENDS = (
'social_core.backends.amazon.AmazonOAuth2',
'social_core.backends.bitbucket.BitbucketOAuth',
diff --git a/nsupdate/templates/base.html b/nsupdate/templates/base.html
index c20235f..d6b3988 100644
--- a/nsupdate/templates/base.html
+++ b/nsupdate/templates/base.html
@@ -58,7 +58,7 @@
{% endif %}
diff --git a/nsupdate/urls.py b/nsupdate/urls.py
index b28fcdb..e82f8bd 100644
--- a/nsupdate/urls.py
+++ b/nsupdate/urls.py
@@ -3,9 +3,10 @@ top-level url dispatching
"""
from django.conf import settings
-from django.conf.urls import patterns, include, url
+from django.conf.urls import include, url
from django.contrib import admin
from django.contrib.auth import views as auth_views
+from django.conf.urls.static import static
def remember_me_login(request, *args, **kw):
@@ -20,8 +21,7 @@ def remember_me_login(request, *args, **kw):
return auth_views.login(request, *args, **kw)
-urlpatterns = patterns(
- '',
+urlpatterns = [
url('', include('social_django.urls', namespace='social')),
url(r'^accounts/', include('nsupdate.login.urls')),
# registration and user settings
@@ -29,12 +29,9 @@ urlpatterns = patterns(
url(r'^admin/', include(admin.site.urls)),
url(r'^i18n/', include('django.conf.urls.i18n')),
url(r'^', include('nsupdate.main.urls')),
-)
+]
if settings.DEBUG:
- urlpatterns += patterns('django.contrib.staticfiles.views',
- url(r'^static/(?P.*)$', 'serve'), )
+ urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
import debug_toolbar
- urlpatterns += patterns('',
- url(r'^__debug__/', include(debug_toolbar.urls)),
- )
+ urlpatterns += (url(r'^__debug__/', include(debug_toolbar.urls)),)
diff --git a/requirements.d/all.txt b/requirements.d/all.txt
index f2e8da6..e194507 100644
--- a/requirements.d/all.txt
+++ b/requirements.d/all.txt
@@ -1,7 +1,7 @@
# packages always needed
dnspython
netaddr
-django>=1.8.1, <1.9
+django~=1.11.0
django-bootstrap-form
django-registration-redux
django-extensions
diff --git a/scripts/travis/install.sh b/scripts/travis/install.sh
index 1faa82a..a635be3 100755
--- a/scripts/travis/install.sh
+++ b/scripts/travis/install.sh
@@ -19,6 +19,6 @@ sudo chattr +i /etc/resolv.conf
#dig @127.0.0.1 tests.nsupdate.info SOA
#sudo netstat -tulpen | grep 53
-pip install Django==$DJANGO
+#pip install Django==$DJANGO
pip install -r requirements.d/travis.txt
pip install -e .
diff --git a/setup.py b/setup.py
index b98db06..31f192d 100644
--- a/setup.py
+++ b/setup.py
@@ -12,11 +12,6 @@ from nsupdate import version
with open('README.rst') as f:
readme_content = f.read()
-if PY2:
- install_requires = ['dnspython', ]
-else:
- install_requires = ['dnspython3', ]
-
setup(
name='nsupdate',
version=str(version),
@@ -53,9 +48,10 @@ setup(
include_package_data=True,
zip_safe=False,
platforms='any',
- install_requires=install_requires + [
+ install_requires=[
+ 'dnspython',
'netaddr',
- 'django>=1.8.1, <1.9',
+ 'django~=1.11.0',
'django-bootstrap-form',
'django-registration-redux',
'django-extensions',