fix: 修复短信问题

This commit is contained in:
xinwen
2021-09-10 14:39:02 +08:00
committed by Jiangjie.Bai
parent 345c0fcf4f
commit 3e737c8cb8
2 changed files with 7 additions and 1 deletions

View File

@@ -67,6 +67,12 @@ class SMS:
client: BaseSMSClient
def __init__(self, backend=None):
backend = backend or settings.SMS_BACKEND
if backend not in BACKENDS:
raise JMSException(
code='sms_provider_not_support',
detail=_('SMS provider not support: {}').format(backend)
)
m = importlib.import_module(f'.{backend or settings.SMS_BACKEND}', __package__)
self.client = m.client.new_from_settings()

View File

@@ -17,7 +17,7 @@ class SignAndTmplPairSerializer(serializers.Serializer):
class BaseSMSSettingSerializer(serializers.Serializer):
SMS_TEST_PHONE = serializers.CharField(max_length=256, required=False, label=_('Test phone'))
SMS_TEST_PHONE = serializers.CharField(max_length=256, required=False, allow_blank=True, label=_('Test phone'))
def to_representation(self, instance):
data = super().to_representation(instance)