django4 fixes

This commit is contained in:
smile 2022-06-11 21:10:41 +02:00
parent 4bd1b62e64
commit e8fa8f6d13
5 changed files with 9 additions and 9 deletions

View file

@ -51,7 +51,7 @@ msgstr "WLAN-Präsenzerkennung einschalten"
#: forms.py:68 #: forms.py:68
msgid "Old password" msgid "Old password"
msgstr "Neues Passwort" msgstr "Altes Passwort"
#: forms.py:69 #: forms.py:69
msgid "Enter your current password here." msgid "Enter your current password here."

View file

@ -26,7 +26,7 @@ def encrypt_ldap_password(cleartext_pw):
# do the encryption # do the encryption
aes = AES.new(key, AES.MODE_CFB, iv) aes = AES.new(key, AES.MODE_CFB, iv)
message = iv + aes.encrypt(cleartext_pw) message = iv + aes.encrypt(cleartext_pw.encode())
return base64.b64encode(message).decode(), base64.b64encode(key).decode() return base64.b64encode(message).decode(), base64.b64encode(key).decode()
@ -46,7 +46,7 @@ def decrypt_ldap_password(message, key):
# decrypt it # decrypt it
aes = AES.new(decoded_key, AES.MODE_CFB, iv) aes = AES.new(decoded_key, AES.MODE_CFB, iv)
cleartext_pw = aes.decrypt(ciphertext) cleartext_pw = aes.decrypt(ciphertext).decode()
return cleartext_pw return cleartext_pw

View file

@ -5,7 +5,7 @@ DEBUG = True
TEMPLATE_DEBUG = DEBUG TEMPLATE_DEBUG = DEBUG
ADMINS = ( ADMINS = (
('smile', 'smile@c-base.org') # ('smile', 'smile@c-base.org')
# ('Your Name', 'your_email@example.com'), # ('Your Name', 'your_email@example.com'),
) )
@ -146,7 +146,7 @@ TEMPLATES = [
import ldap import ldap
from django_auth_ldap.config import LDAPSearch, GroupOfNamesType from django_auth_ldap.config import LDAPSearch, GroupOfNamesType
AUTH_LDAP_SERVER_URI = "ldap://lea.cbrp3.c-base.org" AUTH_LDAP_SERVER_URI = "ldaps://lea.cbrp3.c-base.org"
AUTH_LDAP_USER_DN_TEMPLATE = "uid=%(user)s,ou=crew,dc=c-base,dc=org" AUTH_LDAP_USER_DN_TEMPLATE = "uid=%(user)s,ou=crew,dc=c-base,dc=org"
AUTH_LDAP_START_TLS = True AUTH_LDAP_START_TLS = True
AUTH_LDAP_BIND_AS_AUTHENTICATING_USER = True AUTH_LDAP_BIND_AS_AUTHENTICATING_USER = True
@ -235,7 +235,7 @@ LOGGING = {
'loggers': { 'loggers': {
'django.request': { 'django.request': {
'handlers': ['mail_admins'], 'handlers': ['mail_admins'],
'level': 'ERROR', 'level': 'DEBUG',
'propagate': True, 'propagate': True,
}, },
"django_auth_ldap": {"level": "DEBUG", "handlers": ["console"]} "django_auth_ldap": {"level": "DEBUG", "handlers": ["console"]}
@ -245,7 +245,7 @@ LOGGING = {
CRISPY_TEMPLATE_PACK = 'bootstrap' CRISPY_TEMPLATE_PACK = 'bootstrap'
# c-base specific settings # c-base specific settings
CBASE_LDAP_URL = 'ldap://lea.cbrp3.c-base.org:389/' CBASE_LDAP_URL = 'ldaps://lea.cbrp3.c-base.org:389/'
CBASE_BASE_DN = 'ou=crew,dc=c-base,dc=org' CBASE_BASE_DN = 'ou=crew,dc=c-base,dc=org'
# Set session cookie timeout to 10 minutes # Set session cookie timeout to 10 minutes

View file

@ -9,11 +9,11 @@ GROUP=cbmi
ADDRESS=127.0.0.1:8000 ADDRESS=127.0.0.1:8000
DJANGO_SETTINGS=cbmi.settings DJANGO_SETTINGS=cbmi.settings
DJANGO_SETTINGS_MODULE=cbmi.settings DJANGO_SETTINGS_MODULE=cbmi.settings
source /home/cbmi/cbmi/bin/activate source /home/cbmi/cbmi/venv/bin/activate
cd /home/cbmi/cbmi cd /home/cbmi/cbmi
test -d $LOGDIR || mkdir -p $LOGDIR test -d $LOGDIR || mkdir -p $LOGDIR
echo "foo" echo "foo"
exec bin/gunicorn -w $NUM_WORKERS --bind=$ADDRESS \ exec venv/bin/gunicorn -w $NUM_WORKERS --bind=$ADDRESS \
--user=$USER --group=$GROUP --log-level=debug \ --user=$USER --group=$GROUP --log-level=debug \
cbmi.wsgi:application \ cbmi.wsgi:application \
--log-file=$LOGFILE 2>>$LOGFILE --log-file=$LOGFILE 2>>$LOGFILE