-
Notifications
You must be signed in to change notification settings - Fork 235
Add custom copy for google oauth provider #453
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
src/routes/console/project-[project]/auth/googleOAuth.svelte
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| <script lang="ts"> | ||
| import { page } from '$app/stores'; | ||
| import { Alert, CopyInput, Modal } from '$lib/components'; | ||
| import { Button, FormList, InputPassword, InputSwitch, InputText } from '$lib/elements/forms'; | ||
| import type { Provider } from '$lib/stores/oauth-providers'; | ||
| import { sdk } from '$lib/stores/sdk'; | ||
| import { onMount } from 'svelte'; | ||
| import { updateOAuth } from './updateOAuth'; | ||
|
|
||
| export let provider: Provider; | ||
|
|
||
| const projectId = $page.params.project; | ||
|
|
||
| let enabled: boolean = null; | ||
| let appId: string = null; | ||
| let secret: string = null; | ||
|
|
||
| onMount(() => { | ||
| enabled ??= provider.enabled; | ||
| appId ??= provider.appId; | ||
| secret ??= provider.secret; | ||
| }); | ||
|
|
||
| let error: string; | ||
|
|
||
| const update = async () => { | ||
| const result = await updateOAuth({ projectId, provider, secret, appId, enabled }); | ||
|
|
||
| if (result.status === 'error') { | ||
| error = result.message; | ||
| } else { | ||
| provider = null; | ||
| } | ||
| }; | ||
| </script> | ||
|
|
||
| <Modal {error} size="big" show onSubmit={update} on:close> | ||
| <svelte:fragment slot="header">{provider.name} OAuth2 Settings</svelte:fragment> | ||
| <FormList> | ||
| <p> | ||
| To use {provider.name} authentication in your application, first fill in this form. For more | ||
| info you can | ||
| <a class="link" href={provider.docs} target="_blank" rel="noopener noreferrer" | ||
| >visit the docs.</a> | ||
| </p> | ||
| <InputSwitch id="state" bind:value={enabled} label={enabled ? 'Enabled' : 'Disabled'} /> | ||
| <InputText | ||
| id="appID" | ||
| label="App ID" | ||
| autofocus={true} | ||
| placeholder="Enter ID" | ||
| bind:value={appId} /> | ||
| <InputPassword | ||
| id="secret" | ||
| label="App Secret" | ||
| placeholder="Enter App Secret" | ||
| minlength={0} | ||
| showPasswordButton | ||
| bind:value={secret} /> | ||
| <Alert type="info"> | ||
| To complete set up, add this OAuth2 redirect URI to your {provider.name} app configuration | ||
| and select web application as the application type. | ||
| </Alert> | ||
| <div> | ||
| <p>URI</p> | ||
| <CopyInput | ||
| value={`${ | ||
| sdk.forConsole.client.config.endpoint | ||
| }/account/sessions/oauth2/callback/${provider.name.toLocaleLowerCase()}/${projectId}`} /> | ||
| </div> | ||
| </FormList> | ||
| <svelte:fragment slot="footer"> | ||
| <Button secondary on:click={() => (provider = null)}>Cancel</Button> | ||
| <Button | ||
| disabled={!appId || | ||
| !secret || | ||
| (appId === provider.appId && | ||
| secret === provider.secret && | ||
| enabled === provider.enabled)} | ||
| submit>Update</Button> | ||
| </svelte:fragment> | ||
| </Modal> | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.