feat: add custom HTTP Email provider (#2542)

* feat: implement Custom HTTP Email provider

* Update Setting.js

* Update ProviderEditPage.js

* Update http.go

* Update provider.go

---------

Co-authored-by: hsluoyz <hsluoyz@qq.com>
This commit is contained in:
link89
2023-12-14 22:35:25 +08:00
committed by GitHub
parent 5c103e8cd3
commit 374928e719
5 changed files with 90 additions and 5 deletions

View File

@ -528,9 +528,12 @@ class ProviderEditPage extends React.Component {
this.updateProviderField("customTokenUrl", "https://door.casdoor.com/api/login/oauth/access_token");
this.updateProviderField("customUserInfoUrl", "https://door.casdoor.com/api/userinfo");
} else if (value === "Custom HTTP SMS") {
this.updateProviderField("endpoint", "https://example.com/send-custom-http");
this.updateProviderField("endpoint", "https://example.com/send-custom-http-sms");
this.updateProviderField("method", "GET");
this.updateProviderField("title", "code");
} else if (value === "Custom HTTP Email") {
this.updateProviderField("endpoint", "https://example.com/send-custom-http-email");
this.updateProviderField("method", "POST");
} else if (value === "Custom HTTP") {
this.updateProviderField("method", "GET");
this.updateProviderField("title", "");
@ -768,7 +771,7 @@ class ProviderEditPage extends React.Component {
</Row>
)
}
{this.state.provider.category === "Storage" || this.state.provider.type === "Custom HTTP SMS" ? (
{this.state.provider.category === "Storage" || ["Custom HTTP SMS", "Custom HTTP Email"].includes(this.state.provider.type) ? (
<div>
{["Local File System"].includes(this.state.provider.type) ? null : (
<Row style={{marginTop: "20px"}} >
@ -1017,7 +1020,7 @@ class ProviderEditPage extends React.Component {
)
}
{
!["Custom HTTP SMS"].includes(this.state.provider.type) ? null : (
!["Custom HTTP SMS", "Custom HTTP Email"].includes(this.state.provider.type) ? null : (
<React.Fragment>
<Row style={{marginTop: "20px"}} >
<Col style={{marginTop: "5px"}} span={2}>

View File

@ -169,6 +169,10 @@ export const OtherProviderInfo = {
logo: `${StaticBaseUrl}/img/social_azure.png`,
url: "https://learn.microsoft.com/zh-cn/azure/communication-services",
},
"Custom HTTP Email": {
logo: `${StaticBaseUrl}/img/social_default.png`,
url: "https://casdoor.org/docs/provider/email/overview",
},
},
Storage: {
"Local File System": {
@ -985,6 +989,7 @@ export function getProviderTypeOptions(category) {
{id: "SUBMAIL", name: "SUBMAIL"},
{id: "Mailtrap", name: "Mailtrap"},
{id: "Azure ACS", name: "Azure ACS"},
{id: "Custom HTTP Email", name: "Custom HTTP Email"},
]
);
} else if (category === "SMS") {