django-rest-auth/dj_rest_auth/app_settings.py

35 lines
1.3 KiB
Python
Raw Normal View History

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