fix: 修复后台手机号校验 (#8747)

Co-authored-by: feng626 <1304903146@qq.com>
pull/8749/head
fit2bot 2 years ago committed by GitHub
parent 88d9078c43
commit 78133b0c60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2,6 +2,7 @@ from django.utils.translation import ugettext_lazy as _
from rest_framework import serializers from rest_framework import serializers
from common.drf.fields import EncryptedField from common.drf.fields import EncryptedField
from common.validators import PhoneValidator
from common.sdk.sms import BACKENDS from common.sdk.sms import BACKENDS
__all__ = [ __all__ = [
@ -23,7 +24,10 @@ class SignTmplPairSerializer(serializers.Serializer):
class BaseSMSSettingSerializer(serializers.Serializer): class BaseSMSSettingSerializer(serializers.Serializer):
SMS_TEST_PHONE = serializers.CharField(max_length=256, required=False, allow_blank=True, label=_('Test phone')) SMS_TEST_PHONE = serializers.CharField(
max_length=256, required=False, validators=[PhoneValidator(), ],
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…
Cancel
Save