mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-12 13:31:56 +00:00
perf: Update email settings to use SECURITY_PROTOCOL instead of EMAIL_USE_SSL
This commit is contained in:
@@ -1558,5 +1558,6 @@
|
||||
"removeWarningMsg": "Are you sure you want to remove",
|
||||
"setVariable": "Set variable",
|
||||
"userId": "User ID",
|
||||
"userName": "User name"
|
||||
"userName": "User name",
|
||||
"EmailHelpText": "Please click the 'Submit' button to save the current configuration before clicking 'Test Connection' to ensure the settings take effect."
|
||||
}
|
@@ -1563,5 +1563,6 @@
|
||||
"removeWarningMsg": "你确定要移除",
|
||||
"setVariable": "设置参数",
|
||||
"userId": "用户ID",
|
||||
"userName": "用户名"
|
||||
"userName": "用户名",
|
||||
"EmailHelpText": "请点击'提交'按钮保存当前配置后,再点击'测试连接'以确保信息生效"
|
||||
}
|
@@ -541,6 +541,7 @@ class Config(dict):
|
||||
'EMAIL_CUSTOM_USER_CREATED_SUBJECT': _('Create account successfully'),
|
||||
'EMAIL_CUSTOM_USER_CREATED_HONORIFIC': _('Hello'),
|
||||
'EMAIL_CUSTOM_USER_CREATED_BODY': _('Your account has been created successfully'),
|
||||
'EMAIL_SECURITY_PROTOCOL': 'none',
|
||||
|
||||
'OTP_VALID_WINDOW': 2,
|
||||
'OTP_ISSUER_NAME': 'JumpServer',
|
||||
|
@@ -328,7 +328,7 @@ EMAIL_HOST_USER = CONFIG.EMAIL_HOST_USER
|
||||
EMAIL_HOST_PASSWORD = CONFIG.EMAIL_HOST_PASSWORD
|
||||
EMAIL_FROM = CONFIG.EMAIL_FROM
|
||||
EMAIL_RECIPIENT = CONFIG.EMAIL_RECIPIENT
|
||||
EMAIL_USE_SSL = CONFIG.EMAIL_USE_SSL
|
||||
EMAIL_SECURITY_PROTOCOL = CONFIG.EMAIL_SECURITY_PROTOCOL
|
||||
EMAIL_USE_TLS = CONFIG.EMAIL_USE_TLS
|
||||
|
||||
# Custom User Auth model
|
||||
|
@@ -24,6 +24,11 @@ class EmailSettingSerializer(serializers.Serializer):
|
||||
smtp = 'smtp', _('SMTP')
|
||||
exchange = 'exchange', _('EXCHANGE')
|
||||
|
||||
class SECURITY_PROTOCOL(models.TextChoices):
|
||||
none = 'none', _('None')
|
||||
ssl = 'ssl', _('Use SSL')
|
||||
tls = 'tls', _('Use TLS')
|
||||
|
||||
EMAIL_PROTOCOL = serializers.ChoiceField(
|
||||
choices=EmailProtocol.choices, label=_("Protocol"), default=EmailProtocol.smtp
|
||||
)
|
||||
@@ -34,8 +39,8 @@ class EmailSettingSerializer(serializers.Serializer):
|
||||
help_text=_("The user to be used for email server authentication")
|
||||
)
|
||||
EMAIL_HOST_PASSWORD = EncryptedField(
|
||||
max_length=1024, required=False, label=_("Password"),
|
||||
help_text=_("Password to use for the email server. It is used in conjunction with `User` when authenticating to the email server")
|
||||
max_length=1024, required=False, label=_("Password"), help_text=_(
|
||||
"Password to use for the email server. It is used in conjunction with `User` when authenticating to the email server")
|
||||
)
|
||||
EMAIL_FROM = serializers.CharField(
|
||||
max_length=128, allow_blank=True, required=False, label=_('Sender'),
|
||||
@@ -55,6 +60,10 @@ class EmailSettingSerializer(serializers.Serializer):
|
||||
help_text=_(
|
||||
'Whether to use a TLS (secure) connection when talking to the SMTP server. This is used for explicit TLS connections, generally on port 587')
|
||||
)
|
||||
EMAIL_SECURITY_PROTOCOL = serializers.ChoiceField(
|
||||
choices=SECURITY_PROTOCOL.choices, label=_("TLS/SSL"),
|
||||
default=SECURITY_PROTOCOL.none
|
||||
)
|
||||
|
||||
|
||||
class EmailContentSettingSerializer(serializers.Serializer):
|
||||
|
Reference in New Issue
Block a user