Add disableSsl to provider.

This commit is contained in:
Gucheng Wang 2022-08-09 23:38:35 +08:00
parent 340fbe135d
commit f716a0985f
10 changed files with 32 additions and 5 deletions

View File

@ -33,6 +33,7 @@ func SendEmail(provider *Provider, title string, content string, dest string, se
// DailSmtpServer Dail Smtp server
func DailSmtpServer(provider *Provider) error {
dialer := gomail.NewDialer(provider.Host, provider.Port, provider.ClientId, provider.ClientSecret)
dialer.SSL = !provider.DisableSsl
sender, err := dialer.Dial()
if err != nil {

View File

@ -43,10 +43,11 @@ type Provider struct {
CustomUserInfoUrl string `xorm:"varchar(200)" json:"customUserInfoUrl"`
CustomLogo string `xorm:"varchar(200)" json:"customLogo"`
Host string `xorm:"varchar(100)" json:"host"`
Port int `json:"port"`
Title string `xorm:"varchar(100)" json:"title"`
Content string `xorm:"varchar(1000)" json:"content"`
Host string `xorm:"varchar(100)" json:"host"`
Port int `json:"port"`
DisableSsl bool `json:"disableSsl"`
Title string `xorm:"varchar(100)" json:"title"`
Content string `xorm:"varchar(1000)" json:"content"`
RegionId string `xorm:"varchar(100)" json:"regionId"`
SignName string `xorm:"varchar(100)" json:"signName"`

View File

@ -199,6 +199,7 @@ class ProviderEditPage extends React.Component {
this.updateProviderField("type", "GitHub");
} else if (value === "Email") {
this.updateProviderField("type", "Default");
this.updateProviderField("disableSsl", false);
this.updateProviderField("title", "Casdoor Verification Code");
this.updateProviderField("content", "You have requested a verification code at Casdoor. Here is your code: %s, please enter in 5 minutes.");
} else if (value === "SMS") {
@ -510,6 +511,16 @@ class ProviderEditPage extends React.Component {
}} />
</Col>
</Row>
<Row style={{marginTop: "20px"}} >
<Col style={{marginTop: "5px"}} span={(Setting.isMobile()) ? 22 : 2}>
{Setting.getLabel(i18next.t("provider:Disable SSL"), i18next.t("provider:Disable SSL - Tooltip"))} :
</Col>
<Col span={1} >
<Switch checked={this.state.provider.disableSsl} onChange={checked => {
this.updateProviderField("disableSsl", checked);
}} />
</Col>
</Row>
<Row style={{marginTop: "20px"}} >
<Col style={{marginTop: "5px"}} span={(Setting.isMobile()) ? 22 : 2}>
{Setting.getLabel(i18next.t("provider:Email Title"), i18next.t("provider:Email Title - Tooltip"))} :

View File

@ -416,6 +416,8 @@
"Client secret 2": "Client Secret 2",
"Client secret 2 - Tooltip": "Client Secret 2 - Tooltip",
"Copy": "Kopieren",
"Disable SSL": "Disable SSL",
"Disable SSL - Tooltip": "Disable SSL - Tooltip",
"Domain": "Domäne",
"Domain - Tooltip": "Storage endpoint custom domain",
"Edit Provider": "Anbieter bearbeiten",

View File

@ -416,6 +416,8 @@
"Client secret 2": "Client secret 2",
"Client secret 2 - Tooltip": "Client secret 2 - Tooltip",
"Copy": "Copy",
"Disable SSL": "Disable SSL",
"Disable SSL - Tooltip": "Disable SSL - Tooltip",
"Domain": "Domain",
"Domain - Tooltip": "Domain - Tooltip",
"Edit Provider": "Edit Provider",

View File

@ -416,6 +416,8 @@
"Client secret 2": "Client secret 2",
"Client secret 2 - Tooltip": "Secret client 2 - Infobulle",
"Copy": "Copie",
"Disable SSL": "Disable SSL",
"Disable SSL - Tooltip": "Disable SSL - Tooltip",
"Domain": "Domaine",
"Domain - Tooltip": "Storage endpoint custom domain",
"Edit Provider": "Modifier le fournisseur",

View File

@ -416,6 +416,8 @@
"Client secret 2": "クライアントシークレット 2",
"Client secret 2 - Tooltip": "Client secret 2 - Tooltip",
"Copy": "コピー",
"Disable SSL": "Disable SSL",
"Disable SSL - Tooltip": "Disable SSL - Tooltip",
"Domain": "ドメイン",
"Domain - Tooltip": "Storage endpoint custom domain",
"Edit Provider": "プロバイダーを編集",

View File

@ -416,6 +416,8 @@
"Client secret 2": "Client secret 2",
"Client secret 2 - Tooltip": "Client secret 2 - Tooltip",
"Copy": "Copy",
"Disable SSL": "Disable SSL",
"Disable SSL - Tooltip": "Disable SSL - Tooltip",
"Domain": "Domain",
"Domain - Tooltip": "Storage endpoint custom domain",
"Edit Provider": "Edit Provider",

View File

@ -416,6 +416,8 @@
"Client secret 2": "Секрет клиента 2",
"Client secret 2 - Tooltip": "2 Клиент секрет - Подсказка",
"Copy": "Копировать",
"Disable SSL": "Disable SSL",
"Disable SSL - Tooltip": "Disable SSL - Tooltip",
"Domain": "Домен",
"Domain - Tooltip": "Storage endpoint custom domain",
"Edit Provider": "Изменить провайдера",

View File

@ -416,6 +416,8 @@
"Client secret 2": "客户端密钥 2",
"Client secret 2 - Tooltip": "客户端密钥 2 - 工具提示",
"Copy": "复制",
"Disable SSL": "禁用SSL",
"Disable SSL - Tooltip": "与STMP服务器通信时是否禁用SSL安全协议",
"Domain": "域名",
"Domain - Tooltip": "存储节点自定义域名",
"Edit Provider": "编辑提供商",
@ -481,7 +483,7 @@
"Template Code - Tooltip": "模板代码",
"Terms of Use": "使用条款",
"Terms of Use - Tooltip": "使用条款 - 工具提示",
"Test Connection": "测试Smtp连接",
"Test Connection": "测试SMTP连接",
"Test Email": "测试Email配置",
"Test Email - Tooltip": "邮箱地址",
"Token URL": "Token URL",