diff --git a/apps/i18n/lina/en.json b/apps/i18n/lina/en.json index 8d4cab7db..a5e6d8de7 100644 --- a/apps/i18n/lina/en.json +++ b/apps/i18n/lina/en.json @@ -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." } \ No newline at end of file diff --git a/apps/i18n/lina/zh.json b/apps/i18n/lina/zh.json index e08c1f716..c556528fb 100644 --- a/apps/i18n/lina/zh.json +++ b/apps/i18n/lina/zh.json @@ -1563,5 +1563,6 @@ "removeWarningMsg": "你确定要移除", "setVariable": "设置参数", "userId": "用户ID", - "userName": "用户名" + "userName": "用户名", + "EmailHelpText": "请点击'提交'按钮保存当前配置后,再点击'测试连接'以确保信息生效" } \ No newline at end of file diff --git a/apps/jumpserver/conf.py b/apps/jumpserver/conf.py index f980f11ae..ac1667df5 100644 --- a/apps/jumpserver/conf.py +++ b/apps/jumpserver/conf.py @@ -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', diff --git a/apps/jumpserver/settings/base.py b/apps/jumpserver/settings/base.py index 00bb729c4..9295938c6 100644 --- a/apps/jumpserver/settings/base.py +++ b/apps/jumpserver/settings/base.py @@ -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 diff --git a/apps/settings/serializers/msg.py b/apps/settings/serializers/msg.py index c121e7686..343425d29 100644 --- a/apps/settings/serializers/msg.py +++ b/apps/settings/serializers/msg.py @@ -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):