Skip to content
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

Optionally show magic link on sign-up page #15

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ Default is `medium`.
A `string` that specifies the layout direction of the social buttons. Valid options are `horizontal` or `vertical`.
Default is `vertical`.

## `magicLink`

A `boolean` that specifies whether to show the magic link option on the sign-up page.
Default is `false`.

## `socialColors`

A `boolean` that indicates whether the social buttons should use the brand's colors.
Expand Down
3 changes: 2 additions & 1 deletion src/Auth.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
export let socialButtonSize = 'medium'
export let providers = []
export let view = 'sign_in'
export let magicLink = false;

function setView(newView) {
view = newView
Expand All @@ -32,7 +33,7 @@
/>

{#if view == 'sign_in' || view == 'sign_up'}
<EmailAuthView {supabaseClient} {view} {setView}/>
<EmailAuthView {supabaseClient} {view} {setView} {magicLink}/>
{:else if view == 'magic_link'}
<MagicLinkView {supabaseClient} {setView}/>
{:else if view == 'forgotten_password'}
Expand Down
5 changes: 4 additions & 1 deletion src/EmailAuthView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
export let supabaseClient
export let view
export let setView
export let magicLink;

let error = '', message = '', loading = false, email = '', password = ''

Expand Down Expand Up @@ -40,7 +41,9 @@
{#if view == 'sign_up'}
<Button block primary size="large" {loading} icon="inbox">Sign up</Button>
<div class="links">
<LinkButton on:click={() => setView('magic_link')}>Sign in with magic link</LinkButton>
{#if magicLink === true}
<LinkButton on:click={() => setView('magic_link')}>Sign in with magic link</LinkButton>
{/if}
<LinkButton on:click={() => setView('sign_in')}>Do you have an account? Sign in</LinkButton>
</div>
{:else}
Expand Down
1 change: 1 addition & 0 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export interface AuthProps {
socialLayout?: 'vertical' | 'horizontal'
socialColors?: boolean
socialButtonSize?: 'medium' | 'large'
magicLink?: boolean
}

export default class Auth extends SvelteComponentTyped<AuthProps> {}