django-rest-auth/dj_rest_auth/app_settings.py

41 lines
1.7 KiB
Python
Raw Normal View History

from dj_rest_auth.serializers import JWTSerializer as DefaultJWTSerializer
from dj_rest_auth.serializers import LoginSerializer as DefaultLoginSerializer
from dj_rest_auth.serializers import \
PasswordChangeSerializer as DefaultPasswordChangeSerializer
from dj_rest_auth.serializers import \
PasswordResetConfirmSerializer as DefaultPasswordResetConfirmSerializer
from dj_rest_auth.serializers import \
PasswordResetSerializer as DefaultPasswordResetSerializer
from dj_rest_auth.serializers import TokenSerializer as DefaultTokenSerializer
from dj_rest_auth.serializers import \
UserDetailsSerializer as DefaultUserDetailsSerializer
2014-10-08 15:19:34 +04:00
from django.conf import settings
from .utils import default_create_token, import_callable
2014-10-08 15:19:34 +04:00
create_token = import_callable(getattr(settings, 'REST_AUTH_TOKEN_CREATOR', default_create_token))
2014-10-08 15:19:34 +04:00
serializers = getattr(settings, 'REST_AUTH_SERIALIZERS', {})
TokenSerializer = import_callable(serializers.get('TOKEN_SERIALIZER', DefaultTokenSerializer))
2014-10-08 15:19:34 +04:00
JWTSerializer = import_callable(serializers.get('JWT_SERIALIZER', DefaultJWTSerializer))
UserDetailsSerializer = import_callable(serializers.get('USER_DETAILS_SERIALIZER', DefaultUserDetailsSerializer))
2014-10-08 15:19:34 +04:00
LoginSerializer = import_callable(serializers.get('LOGIN_SERIALIZER', DefaultLoginSerializer))
2014-10-08 15:19:34 +04:00
PasswordResetSerializer = import_callable(serializers.get(
'PASSWORD_RESET_SERIALIZER', DefaultPasswordResetSerializer
))
2014-10-08 15:19:34 +04:00
2020-04-17 11:27:24 +03:00
PasswordResetConfirmSerializer = import_callable(serializers.get(
2020-03-01 05:30:21 +03:00
'PASSWORD_RESET_CONFIRM_SERIALIZER', DefaultPasswordResetConfirmSerializer
2020-04-17 11:27:24 +03:00
))
2014-10-08 15:19:34 +04:00
PasswordChangeSerializer = import_callable(
serializers.get('PASSWORD_CHANGE_SERIALIZER', DefaultPasswordChangeSerializer)
)
2020-03-20 00:09:20 +03:00
JWT_AUTH_COOKIE = getattr(settings, 'JWT_AUTH_COOKIE', None)