Compare commits

..

1 Commits

4 changed files with 7 additions and 13 deletions

View File

@ -1,4 +1,3 @@
SECRET_KEY=ldskjflkdsnejnjsdnf SECRET_KEY=ldskjflkdsnejnjsdnf
DEBUG=False DEBUG=False
ENABLE_DEBUG_LOG=True ENABLE_DEBUG_LOG=True
ALLOWED_HOSTS=localhost,.ungleich.ch

View File

@ -4,7 +4,6 @@ from rest_framework import exceptions
from rest_framework import authentication from rest_framework import authentication
import json import json
import logging import logging
import pyotp
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -22,13 +21,7 @@ class OTPSeed(AbstractUser):
""" """
inject username to ensure it stays unique / is setup at all inject username to ensure it stays unique / is setup at all
""" """
if not self.is_superuser:
self.username = "{}@{}".format(self.name, self.realm) self.username = "{}@{}".format(self.name, self.realm)
else:
self.name = self.username
self.realm = "ungleich-admin"
self.seed = pyotp.random_base32()
super().save(*args, **kwargs) super().save(*args, **kwargs)
def __str__(self): def __str__(self):

View File

@ -1,10 +1,10 @@
pyotp>=2.2.6 pyotp>=2.2.6
django==2.2.16 django>=2.1.2
djangorestframework djangorestframework
python-decouple>=3.1 python-decouple>=3.1
# DB # DB
psycopg2>=2.8,<2.9 psycopg2-binary
# Recommended # Recommended
markdown markdown

View File

@ -132,7 +132,9 @@ DEBUG_DATABASES = {
} }
DEBUG = config('DEBUG', False, cast=bool) DEBUG = config('DEBUG', False, cast=bool)
ALLOWED_HOSTS = config('ALLOWED_HOSTS', default='localhost', cast=Csv()) ALLOWED_HOSTS = [
".ungleich.ch"
]
DATABASES = { DATABASES = {
'default': { 'default': {