Compare commits
6 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6ba71545a1 | ||
|
|
ae3c156df7 | ||
|
|
1efe6ee078 | ||
|
|
9703eb6538 | ||
|
|
273a1acf01 | ||
|
|
3f37fe4826 |
4 changed files with 13 additions and 7 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
SECRET_KEY=ldskjflkdsnejnjsdnf
|
SECRET_KEY=ldskjflkdsnejnjsdnf
|
||||||
DEBUG=False
|
DEBUG=False
|
||||||
ENABLE_DEBUG_LOG=True
|
ENABLE_DEBUG_LOG=True
|
||||||
|
ALLOWED_HOSTS=localhost,.ungleich.ch
|
||||||
|
|
@ -4,6 +4,7 @@ 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__)
|
||||||
|
|
||||||
|
|
@ -21,7 +22,13 @@ 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
|
||||||
"""
|
"""
|
||||||
self.username = "{}@{}".format(self.name, self.realm)
|
if not self.is_superuser:
|
||||||
|
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):
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
pyotp>=2.2.6
|
pyotp>=2.2.6
|
||||||
django>=2.1.2
|
django==2.2.16
|
||||||
djangorestframework
|
djangorestframework
|
||||||
python-decouple>=3.1
|
python-decouple>=3.1
|
||||||
|
|
||||||
# DB
|
# DB
|
||||||
psycopg2-binary
|
psycopg2>=2.8,<2.9
|
||||||
|
|
||||||
# Recommended
|
# Recommended
|
||||||
markdown
|
markdown
|
||||||
|
|
|
||||||
|
|
@ -132,9 +132,7 @@ DEBUG_DATABASES = {
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG = config('DEBUG', False, cast=bool)
|
DEBUG = config('DEBUG', False, cast=bool)
|
||||||
ALLOWED_HOSTS = [
|
ALLOWED_HOSTS = config('ALLOWED_HOSTS', default='localhost', cast=Csv())
|
||||||
".ungleich.ch"
|
|
||||||
]
|
|
||||||
|
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
'default': {
|
'default': {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue