mirror of https://github.com/jumpserver/jumpserver
fix: 修复短信问题
parent
345c0fcf4f
commit
3e737c8cb8
|
@ -67,6 +67,12 @@ class SMS:
|
||||||
client: BaseSMSClient
|
client: BaseSMSClient
|
||||||
|
|
||||||
def __init__(self, backend=None):
|
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__)
|
m = importlib.import_module(f'.{backend or settings.SMS_BACKEND}', __package__)
|
||||||
self.client = m.client.new_from_settings()
|
self.client = m.client.new_from_settings()
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ class SignAndTmplPairSerializer(serializers.Serializer):
|
||||||
|
|
||||||
|
|
||||||
class BaseSMSSettingSerializer(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):
|
def to_representation(self, instance):
|
||||||
data = super().to_representation(instance)
|
data = super().to_representation(instance)
|
||||||
|
|
Loading…
Reference in New Issue