sync_v2
Laurent 7 months ago
parent cd661743b8
commit 1b3b0afccb
  1. 3
      authentication/views.py
  2. 66
      padelclub_backend/settings.py

@ -17,8 +17,10 @@ from .utils import is_valid_email
from .models import Device, LoginLog
from .serializers import ChangePasswordSerializer
import logging
CustomUser=get_user_model()
logger = logging.getLogger(__name__)
@method_decorator(csrf_exempt, name='dispatch')
class CustomAuthToken(APIView):
@ -29,6 +31,7 @@ class CustomAuthToken(APIView):
password = request.data.get('password')
device_id = request.data.get('device_id')
logger.info(f'Login attempt from {username}')
user = authenticate(username=username, password=password)
if user is None and is_valid_email(username) == True:

@ -164,5 +164,69 @@ if DEBUG: # Development environment
else: # Production environment
SESSION_COOKIE_SECURE = True
from .settings_local import *
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'verbose': {
'format': '{levelname} {asctime} {module} {process:d} {thread:d} {message}',
'style': '{',
},
'simple': {
'format': '{levelname} {message}',
'style': '{',
},
},
'handlers': {
'console': {
'level': 'INFO',
'class': 'logging.StreamHandler',
'formatter': 'verbose',
},
'file': {
'level': 'DEBUG',
'class': 'logging.FileHandler',
'filename': os.path.join(BASE_DIR, 'django.log'),
'formatter': 'verbose',
},
'rotating_file': {
'level': 'INFO',
'class': 'logging.handlers.RotatingFileHandler',
'filename': os.path.join(BASE_DIR, 'django.log'),
'maxBytes': 10 * 1024 * 1024,
'backupCount': 10,
'formatter': 'verbose',
},
},
'loggers': {
'django': {
'handlers': ['console', 'file'],
'level': 'INFO',
'propagate': True,
},
'tournaments': {
'handlers': ['console', 'file'],
'level': 'INFO',
'propagate': False,
},
'authentication': {
'handlers': ['console', 'file'],
'level': 'INFO',
'propagate': False,
},
'sync': {
'handlers': ['console', 'file'],
'level': 'INFO',
'propagate': False,
},
'api': {
'handlers': ['console', 'file'],
'level': 'INFO',
'propagate': False,
},
},
}
from .settings_app import *
from .settings_local import *

Loading…
Cancel
Save