mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
feat: update auth0 layout
This commit is contained in:
1 parent
cd042670b0
commit
3f78b2da4b
1 file changed
+72
@@ -0,0 +1,72 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/stores';
|
||||
import { Modal, Copy, InfoSection } from '$lib/components';
|
||||
import { Button, InputPassword, InputText, InputSwitch, Form } from '$lib/elements/forms';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { sdkForConsole } from '$lib/stores/sdk';
|
||||
|
||||
export let showModal = false;
|
||||
export let provider;
|
||||
|
||||
const projectId = $page.params.project;
|
||||
const update = async () => {
|
||||
try {
|
||||
const oauth = await sdkForConsole.projects.updateOAuth2(
|
||||
projectId,
|
||||
provider.name.toLowerCase(),
|
||||
provider.id,
|
||||
provider.secret
|
||||
);
|
||||
console.log(oauth);
|
||||
showModal = false;
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
type: 'error',
|
||||
message: error.message
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<Form on:submit={update}>
|
||||
<Modal bind:show={showModal}>
|
||||
<svelte:fragment slot="header">{provider.name} OAuth2 Settings</svelte:fragment>
|
||||
<InputSwitch
|
||||
id="state"
|
||||
bind:value={provider.active}
|
||||
label={provider.active ? 'Enabled' : 'Disabled'} />
|
||||
<InputText
|
||||
id="clientID"
|
||||
label="Client ID"
|
||||
autofocus={true}
|
||||
autocomplete={false}
|
||||
placeholder="Enter ID"
|
||||
bind:value={provider.id} />
|
||||
<InputPassword
|
||||
id="secret"
|
||||
label="Client Secret"
|
||||
placeholder="Enter App Secret"
|
||||
meter={false}
|
||||
bind:value={provider.secret} />
|
||||
<InputText
|
||||
id="domain"
|
||||
label="Auth0 Domain"
|
||||
autofocus={true}
|
||||
autocomplete={false}
|
||||
placeholder="Your Auth0 domain"
|
||||
bind:value={provider.domain} />
|
||||
<InfoSection>
|
||||
<p>
|
||||
To complete set up, add this OAuth2 redirect URI to your {provider.name} app configuration.
|
||||
</p>
|
||||
<Copy
|
||||
value={`${
|
||||
sdkForConsole.config.endpoint
|
||||
}/account/session/oauth2/callback/${provider.name.toLocaleLowerCase()}/${projectId}`} />
|
||||
</InfoSection>
|
||||
<svelte:fragment slot="footer">
|
||||
<Button secondary on:click={() => (showModal = false)}>Cancel</Button>
|
||||
<Button submit>Update</Button>
|
||||
</svelte:fragment>
|
||||
</Modal>
|
||||
</Form>
|
||||
Reference in new issue
Block a user