[#3364] added mailcow OAuth2 provider
Co-authored-by: thisni1s <nils@jn2p.de>
This commit is contained in:
@@ -102,7 +102,12 @@
|
||||
|
||||
{#if provider.optionsComponent}
|
||||
<div class="col-lg-12">
|
||||
<svelte:component this={provider.optionsComponent} key={provider.key} bind:config />
|
||||
<svelte:component
|
||||
this={provider.optionsComponent}
|
||||
key={provider.key}
|
||||
bind:config
|
||||
{...provider.optionsComponentProps || {}}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
</form>
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
<script>
|
||||
import Field from "@/components/base/Field.svelte";
|
||||
|
||||
export let key = "";
|
||||
export let config = {};
|
||||
</script>
|
||||
|
||||
<div class="section-title">Endpoints</div>
|
||||
<Field class="form-field {config.enabled ? 'required' : ''}" name="{key}.authUrl" let:uniqueId>
|
||||
<label for={uniqueId}>Auth URL</label>
|
||||
<input type="url" id={uniqueId} bind:value={config.authUrl} required={config.enabled} />
|
||||
<div class="help-block">Eg. https://example.com/authorize/</div>
|
||||
</Field>
|
||||
<Field class="form-field {config.enabled ? 'required' : ''}" name="{key}.tokenUrl" let:uniqueId>
|
||||
<label for={uniqueId}>Token URL</label>
|
||||
<input type="url" id={uniqueId} bind:value={config.tokenUrl} required={config.enabled} />
|
||||
<div class="help-block">Eg. https://example.com/token/</div>
|
||||
</Field>
|
||||
<Field class="form-field {config.enabled ? 'required' : ''}" name="{key}.userApiUrl" let:uniqueId>
|
||||
<label for={uniqueId}>User API URL</label>
|
||||
<input type="url" id={uniqueId} bind:value={config.userApiUrl} required={config.enabled} />
|
||||
<div class="help-block">Eg. https://example.com/userinfo/</div>
|
||||
</Field>
|
||||
@@ -3,18 +3,22 @@
|
||||
|
||||
export let key = "";
|
||||
export let config = {};
|
||||
export let required = false;
|
||||
export let title = "Provider endpoints";
|
||||
|
||||
$: isRequired = required && config?.enabled;
|
||||
</script>
|
||||
|
||||
<div class="section-title">Selfhosted endpoints (optional)</div>
|
||||
<Field class="form-field" name="{key}.authUrl" let:uniqueId>
|
||||
<div class="section-title">{title}</div>
|
||||
<Field class="form-field {isRequired ? 'required' : ''}" name="{key}.authUrl" let:uniqueId>
|
||||
<label for={uniqueId}>Auth URL</label>
|
||||
<input type="url" id={uniqueId} bind:value={config.authUrl} />
|
||||
<input type="url" id={uniqueId} bind:value={config.authUrl} required={isRequired} />
|
||||
</Field>
|
||||
<Field class="form-field" name="{key}.tokenUrl" let:uniqueId>
|
||||
<Field class="form-field {isRequired ? 'required' : ''}" name="{key}.tokenUrl" let:uniqueId>
|
||||
<label for={uniqueId}>Token URL</label>
|
||||
<input type="url" id={uniqueId} bind:value={config.tokenUrl} />
|
||||
<input type="url" id={uniqueId} bind:value={config.tokenUrl} required={isRequired} />
|
||||
</Field>
|
||||
<Field class="form-field" name="{key}.userApiUrl" let:uniqueId>
|
||||
<Field class="form-field {isRequired ? 'required' : ''}" name="{key}.userApiUrl" let:uniqueId>
|
||||
<label for={uniqueId}>User API URL</label>
|
||||
<input type="url" id={uniqueId} bind:value={config.userApiUrl} />
|
||||
<input type="url" id={uniqueId} bind:value={config.userApiUrl} required={isRequired} />
|
||||
</Field>
|
||||
|
||||
+17
-5
@@ -1,11 +1,10 @@
|
||||
import SelfHostedOptions from "@/components/settings/providers/SelfHostedOptions.svelte";
|
||||
import MicrosoftOptions from "@/components/settings/providers/MicrosoftOptions.svelte";
|
||||
import OIDCOptions from "@/components/settings/providers/OIDCOptions.svelte";
|
||||
import AppleOptions from "@/components/settings/providers/AppleOptions.svelte";
|
||||
|
||||
// Object list with all supported OAuth2 providers in the format:
|
||||
// ```
|
||||
// [ { key, title, logo, optionsComponent? }, ... ]
|
||||
// [ { key, title, logo, optionsComponent?, optionComponentProps? }, ... ]
|
||||
// ```
|
||||
//
|
||||
// The logo images must be placed inside the /public/images/oauth2 directory.
|
||||
@@ -13,6 +12,7 @@ import AppleOptions from "@/components/settings/providers/AppleOptions.svel
|
||||
// If `optionsComponent` is provided it will receive 2 parameters:
|
||||
// - `key` - the provider settings key (eg. "gitlabAuth")
|
||||
// - `config` - the provider settings config that is currently being updated
|
||||
// - any other prop from optionComponentProps
|
||||
export default [
|
||||
{
|
||||
key: "appleAuth",
|
||||
@@ -56,6 +56,7 @@ export default [
|
||||
title: "GitLab",
|
||||
logo: "gitlab.svg",
|
||||
optionsComponent: SelfHostedOptions,
|
||||
optionsComponentProps: { title: "Self-hosted endpoints (optional)" },
|
||||
},
|
||||
{
|
||||
key: "giteeAuth",
|
||||
@@ -67,6 +68,7 @@ export default [
|
||||
title: "Gitea",
|
||||
logo: "gitea.svg",
|
||||
optionsComponent: SelfHostedOptions,
|
||||
optionsComponentProps: { title: "Self-hosted endpoints (optional)" },
|
||||
},
|
||||
{
|
||||
key: "discordAuth",
|
||||
@@ -113,22 +115,32 @@ export default [
|
||||
title: "LiveChat",
|
||||
logo: "livechat.svg",
|
||||
},
|
||||
{
|
||||
key: "mailcowAuth",
|
||||
title: "mailcow",
|
||||
logo: "mailcow.svg",
|
||||
optionsComponent: SelfHostedOptions,
|
||||
optionsComponentProps: { required: true },
|
||||
},
|
||||
{
|
||||
key: "oidcAuth",
|
||||
title: "OpenID Connect",
|
||||
logo: "oidc.svg",
|
||||
optionsComponent: OIDCOptions,
|
||||
optionsComponent: SelfHostedOptions,
|
||||
optionsComponentProps: { required: true },
|
||||
},
|
||||
{
|
||||
key: "oidc2Auth",
|
||||
title: "(2) OpenID Connect",
|
||||
logo: "oidc.svg",
|
||||
optionsComponent: OIDCOptions,
|
||||
optionsComponent: SelfHostedOptions,
|
||||
optionsComponentProps: { required: true },
|
||||
},
|
||||
{
|
||||
key: "oidc3Auth",
|
||||
title: "(3) OpenID Connect",
|
||||
logo: "oidc.svg",
|
||||
optionsComponent: OIDCOptions,
|
||||
optionsComponent: SelfHostedOptions,
|
||||
optionsComponentProps: { required: true },
|
||||
},
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user