upgrade django

This commit is contained in:
smile 2022-09-27 20:54:21 +02:00
parent e8fa8f6d13
commit 7ed4a39b36
9 changed files with 77 additions and 39 deletions

View file

@ -5,7 +5,7 @@ import re
from django import forms
from django.contrib.auth import authenticate
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _
class UsernameField(forms.CharField):

View file

@ -2,6 +2,7 @@
# -*- coding: utf-8 -*-
import base64
import os
from Crypto import Random
from Crypto.Cipher import AES
@ -19,10 +20,11 @@ def encrypt_ldap_password(cleartext_pw):
"""
# 16 bytes of key => AES-128
random = Random.new()
key = random.read(16)
key = os.urandom(16) # random.read(16)
# initialization vector
iv = random.read(16)
iv = os.urandom(16) # random.read(16)
# do the encryption
aes = AES.new(key, AES.MODE_CFB, iv)

View file

@ -156,7 +156,7 @@
{% endblock container %}
<hr />
<div class="row pull-right">
<small class="muted">Copyright &copy; 2013 by c-base e.V.</small>
<small class="muted">Copyright &copy; 2022 by c-base e.V.</small>
</div>
</div><!-- /.container -->
{% endblock body %}

View file

@ -1,21 +1,21 @@
from account.views import (admin, auth_login, auth_logout, clabpin, gastropin,
groups_list, home, memberstatus, nrf24, password,
preferred_email, rfid, sippin, wlan_presence)
from django.conf.urls import url
from django.urls import re_path
urlpatterns = [
url(r'^login/$', auth_login, name="cbase_auth_login"),
url(r'^logout/$', auth_logout, name="auth_logout"),
url(r'^gastropin/$', gastropin, name='gastropin'),
url(r'^wlan_presence/$', wlan_presence, name='wlan_presence'),
url(r'^rfid/$', rfid, name='rfid'),
url(r'^nrf24/$', nrf24, name='nrf24'),
url(r'^password/$', password, name='password'),
url(r'^sippin/$', sippin, name='sippin'),
url(r'^clabpin/$', clabpin, name='clabpin'),
url(r'^preferred_email/$', preferred_email, name='preferred_email'),
url(r'^admin/$', admin, name='admin'),
url(r'^memberstatus/$', memberstatus, name='memberstatus'),
url(r'^$', home, name="home"),
url(r'^groups/(?P<group_name>[^/]+)/', groups_list),
re_path(r'^login/$', auth_login, name="cbase_auth_login"),
re_path(r'^logout/$', auth_logout, name="auth_logout"),
re_path(r'^gastropin/$', gastropin, name='gastropin'),
re_path(r'^wlan_presence/$', wlan_presence, name='wlan_presence'),
re_path(r'^rfid/$', rfid, name='rfid'),
re_path(r'^nrf24/$', nrf24, name='nrf24'),
re_path(r'^password/$', password, name='password'),
re_path(r'^sippin/$', sippin, name='sippin'),
re_path(r'^clabpin/$', clabpin, name='clabpin'),
re_path(r'^preferred_email/$', preferred_email, name='preferred_email'),
re_path(r'^admin/$', admin, name='admin'),
re_path(r'^memberstatus/$', memberstatus, name='memberstatus'),
re_path(r'^$', home, name="home"),
re_path(r'^groups/(?P<group_name>[^/]+)/', groups_list),
]

View file

@ -15,7 +15,8 @@ from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import get_object_or_404
from django.shortcuts import render
from django.shortcuts import render
from django.utils.translation import ugettext as _
# from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _
import smbpasswd
from account.cbase_members import retrieve_member, MemberValues

View file

@ -1,6 +1,4 @@
from django.conf.urls import url
# from jsonrpc import jsonrpc_site
# from jsonrpc.views import browse
from django.urls import re_path
from cbapi_ldap import views

View file

@ -1,4 +1,4 @@
from django.conf.urls import include, url
from django.urls import include, re_path
from django.contrib import admin
from account.views import hammertime, landingpage
@ -6,13 +6,13 @@ admin.autodiscover()
urlpatterns = [
url(r'^stop/hammertime/$', hammertime, name="hammertime"),
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
url(r'^admin/', admin.site.urls),
url(r'^cbapi/', include("cbapi_ldap.urls")),
re_path(r'^stop/hammertime/$', hammertime, name="hammertime"),
re_path(r'^admin/doc/', include('django.contrib.admindocs.urls')),
re_path(r'^admin/', admin.site.urls),
re_path(r'^cbapi/', include("cbapi_ldap.urls")),
url(r'account/', include('account.urls')),
re_path(r'account/', include('account.urls')),
url(r'^$', landingpage, name="landingpage"),
re_path(r'^$', landingpage, name="landingpage"),
]

View file

@ -55,7 +55,7 @@ def all_members():
def populate_members():
"""fetch all members, sort them and populate the Django database"""
for m in sorted(all_members()):
member = LDAPBackend().populate_user(m)
member = LDAPBackend().populate_user(m.decode())
if member:
print('Populated: %s' % member)
else:

View file

@ -1,8 +1,45 @@
Django==3.2.8
django-auth-ldap==3.0.0
# django-json-rpc>=0.7.2
django-crispy-forms>=1.13.0
gunicorn>=20.1.0
pycrypto>=2.6.1
passlib
requests>=2.26.0
#
# This file is autogenerated by pip-compile with python 3.9
# To update, run:
#
# pip-compile
#
asgiref==3.5.2
# via django
certifi==2022.5.18.1
# via requests
charset-normalizer==2.0.12
# via requests
django==4.0.5
# via
# -r requirements.in
# django-auth-ldap
django-auth-ldap==4.1.0
# via -r requirements.in
django-crispy-forms==1.14.0
# via -r requirements.in
gunicorn==20.1.0
# via -r requirements.in
idna==3.3
# via requests
passlib==1.7.4
# via -r requirements.in
pyasn1==0.4.8
# via
# pyasn1-modules
# python-ldap
pyasn1-modules==0.2.8
# via python-ldap
pycrypto==2.6.1
# via -r requirements.in
python-ldap==3.4.0
# via django-auth-ldap
requests==2.28.0
# via -r requirements.in
sqlparse==0.4.2
# via django
urllib3==1.26.9
# via requests
# The following packages are considered to be unsafe in a requirements file:
# setuptools