fix: various issues

This commit is contained in:
Torsten Dittmann committed 2025-02-18 02:52:08 +01:00
1 parent a3cb118eb8
commit 2da978421e
19 files changed
+406 -519

No files matched your search

+2 -2
View File
@@ -21,9 +21,9 @@
"dependencies": {
"@appwrite.io/console": "https://pkg.pr.new/appwrite/appwrite/@appwrite.io/console@f6fbc25",
"@appwrite.io/pink-icons": "0.25.0",
"@appwrite.io/pink-icons-svelte": "https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@bc66aea",
"@appwrite.io/pink-icons-svelte": "https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@35f29290",
"@appwrite.io/pink-legacy": "^1.0.1",
"@appwrite.io/pink-svelte": "https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@bc66aea",
"@appwrite.io/pink-svelte": "https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@35f29290",
"@popperjs/core": "^2.11.8",
"@sentry/sveltekit": "^8.38.0",
"@stripe/stripe-js": "^3.5.0",
+14 -14
View File
@@ -15,14 +15,14 @@ importers:
specifier: 0.25.0
version: 0.25.0
'@appwrite.io/pink-icons-svelte':
specifier: https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@bc66aea
version: https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@bc66aea(svelte@4.2.19)
specifier: https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@35f29290
version: https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@35f29290(svelte@4.2.19)
'@appwrite.io/pink-legacy':
specifier: ^1.0.1
version: 1.0.1
'@appwrite.io/pink-svelte':
specifier: https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@bc66aea
version: https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@bc66aea(react-dom@18.3.1(react@18.3.1))(svelte@4.2.19)
specifier: https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@35f29290
version: https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@35f29290(react-dom@18.3.1(react@18.3.1))(svelte@4.2.19)
'@popperjs/core':
specifier: ^2.11.8
version: 2.11.8
@@ -215,14 +215,14 @@ packages:
resolution: {tarball: https://pkg.pr.new/appwrite/appwrite/@appwrite.io/console@f6fbc25}
version: 1.2.1
'@appwrite.io/pink-icons-svelte@https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@bc66aea':
resolution: {tarball: https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@bc66aea}
'@appwrite.io/pink-icons-svelte@https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@35f29290':
resolution: {tarball: https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@35f29290}
version: 1.0.0-next.7
peerDependencies:
svelte: ^4.0.0
'@appwrite.io/pink-icons-svelte@https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@bc66aea96b32baf5a0ffe2dad22caf7ef1921c65':
resolution: {tarball: https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@bc66aea96b32baf5a0ffe2dad22caf7ef1921c65}
'@appwrite.io/pink-icons-svelte@https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@35f2929064b9d126a377b6a3e85f59198c5901a2':
resolution: {tarball: https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@35f2929064b9d126a377b6a3e85f59198c5901a2}
version: 1.0.0-next.7
peerDependencies:
svelte: ^4.0.0
@@ -236,8 +236,8 @@ packages:
'@appwrite.io/pink-legacy@1.0.1':
resolution: {integrity: sha512-e5IZx2drqSxgl2WXvmr0eLfg/WiOCzuqQE8oksD+9GoFBkcL9HWvXul5GjFni3RBAN9XFRL3nUExGk4T0H8sFw==}
'@appwrite.io/pink-svelte@https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@bc66aea':
resolution: {tarball: https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@bc66aea}
'@appwrite.io/pink-svelte@https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@35f29290':
resolution: {tarball: https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@35f29290}
version: 1.0.0-next.85
peerDependencies:
react-dom: ^18.0.0
@@ -4099,11 +4099,11 @@ snapshots:
'@appwrite.io/console@https://pkg.pr.new/appwrite/appwrite/@appwrite.io/console@f6fbc25': {}
'@appwrite.io/pink-icons-svelte@https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@bc66aea(svelte@4.2.19)':
'@appwrite.io/pink-icons-svelte@https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@35f29290(svelte@4.2.19)':
dependencies:
svelte: 4.2.19
'@appwrite.io/pink-icons-svelte@https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@bc66aea96b32baf5a0ffe2dad22caf7ef1921c65(svelte@4.2.19)':
'@appwrite.io/pink-icons-svelte@https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@35f2929064b9d126a377b6a3e85f59198c5901a2(svelte@4.2.19)':
dependencies:
svelte: 4.2.19
@@ -4116,9 +4116,9 @@ snapshots:
'@appwrite.io/pink-icons': 1.0.0
the-new-css-reset: 1.11.3
'@appwrite.io/pink-svelte@https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@bc66aea(react-dom@18.3.1(react@18.3.1))(svelte@4.2.19)':
'@appwrite.io/pink-svelte@https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@35f29290(react-dom@18.3.1(react@18.3.1))(svelte@4.2.19)':
dependencies:
'@appwrite.io/pink-icons-svelte': https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@bc66aea96b32baf5a0ffe2dad22caf7ef1921c65(svelte@4.2.19)
'@appwrite.io/pink-icons-svelte': https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@35f2929064b9d126a377b6a3e85f59198c5901a2(svelte@4.2.19)
'@floating-ui/dom': 1.6.13
'@melt-ui/pp': 0.3.2(@melt-ui/svelte@0.86.3(svelte@4.2.19))(svelte@4.2.19)
'@melt-ui/svelte': 0.86.3(svelte@4.2.19)
+67 -71
View File
@@ -22,13 +22,13 @@
<script lang="ts">
import { onMount } from 'svelte';
import { invalidate } from '$app/navigation';
import { Button, FormList, InputDigits, InputText } from '$lib/elements/forms';
import { Button, InputDigits, InputText } from '$lib/elements/forms';
import { sdk } from '$lib/stores/sdk';
import { Dependencies } from '$lib/constants';
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
import { AuthenticationFactor, type Models } from '@appwrite.io/console';
import { addNotification } from '$lib/stores/notifications';
import { Icon } from '@appwrite.io/pink-svelte';
import { Icon, Typography } from '@appwrite.io/pink-svelte';
import { IconChatAlt, IconDeviceMobile, IconMail } from '@appwrite.io/pink-icons-svelte';
export let factors: Models.MfaFactors & { recoveryCode: boolean };
@@ -72,73 +72,69 @@
});
</script>
<FormList>
{#if challengeType == AuthenticationFactor.Recoverycode}
<p>
Enter below one of the recovery codes you received when enabling MFA for this account.
</p>
<InputText id="recovery-code" bind:value={code} required autofocus />
{:else}
{#if factors.totp && (challengeType == AuthenticationFactor.Totp || challengeType == null)}
<p>Enter below a 6-digit one-time code generated by your authentication app.</p>
{:else if challengeType == AuthenticationFactor.Email}
<p>A 6-digit verification code was sent to your email, enter it below.</p>
{:else if challengeType == AuthenticationFactor.Phone}
<p>A 6-digit verification code was sent to your phone, enter it below.</p>
{#if challengeType == AuthenticationFactor.Recoverycode}
<Typography.Text align="center">
Enter below one of the recovery codes you received when enabling MFA for this account.
</Typography.Text>
<InputText id="recovery-code" bind:value={code} required autofocus />
{:else}
{#if factors.totp && (challengeType == AuthenticationFactor.Totp || challengeType == null)}
<Typography.Text align="center"
>Enter below a 6-digit one-time code generated by your authentication app.</Typography.Text>
{:else if challengeType == AuthenticationFactor.Email}
<Typography.Text align="center"
>A 6-digit verification code was sent to your email, enter it below.</Typography.Text>
{:else if challengeType == AuthenticationFactor.Phone}
<Typography.Text align="center"
>A 6-digit verification code was sent to your phone, enter it below.</Typography.Text>
{/if}
<InputDigits bind:value={code} required autofocus />
{/if}
{#if showVerifyButton}
<Button fullWidth submit {disabled}>Verify</Button>
{/if}
{#if enabledFactors.length > 1}
<span class="with-separators eyebrow-heading-3">or</span>
<div class="u-flex-vertical u-gap-8">
{#if factors.totp && challengeType != null && challengeType != AuthenticationFactor.Totp}
<Button
secondary
fullWidth
{disabled}
on:click={() => createChallenge(AuthenticationFactor.Totp)}>
<Icon icon={IconDeviceMobile} slot="start" size="s" />
Authenticator app
</Button>
{/if}
<InputDigits
bind:value={code}
required
autofocus
{autoSubmit}
bind:this={inputDigitFields} />
{/if}
{#if showVerifyButton}
<Button fullWidth submit {disabled}>Verify</Button>
{/if}
{#if enabledFactors.length > 1}
<span class="with-separators eyebrow-heading-3">or</span>
<div class="u-flex-vertical u-gap-8">
{#if factors.totp && challengeType != null && challengeType != AuthenticationFactor.Totp}
<Button
secondary
fullWidth
{disabled}
on:click={() => createChallenge(AuthenticationFactor.Totp)}>
<Icon icon={IconDeviceMobile} slot="start" size="s" />
Authenticator app
</Button>
{/if}
{#if factors.email && challengeType != AuthenticationFactor.Email}
<Button
secondary
fullWidth
{disabled}
on:click={() => createChallenge(AuthenticationFactor.Email)}>
<span class="icon-mail u-font-size-20" aria-hidden="true" />
<Icon icon={IconMail} slot="start" size="s" />
Email verification
</Button>
{/if}
{#if factors.phone && challengeType != AuthenticationFactor.Phone}
<Button
secondary
fullWidth
{disabled}
on:click={() => createChallenge(AuthenticationFactor.Phone)}>
<Icon icon={IconChatAlt} slot="start" size="s" />
Phone verification
</Button>
{/if}
{#if factors.recoveryCode && challengeType != AuthenticationFactor.Recoverycode}
<Button
text
fullWidth
{disabled}
on:click={() => createChallenge(AuthenticationFactor.Recoverycode)}>
<span class="text">Use recovery code</span>
</Button>
{/if}
</div>
{/if}
</FormList>
{#if factors.email && challengeType != AuthenticationFactor.Email}
<Button
secondary
fullWidth
{disabled}
on:click={() => createChallenge(AuthenticationFactor.Email)}>
<span class="icon-mail u-font-size-20" aria-hidden="true" />
<Icon icon={IconMail} slot="start" size="s" />
Email verification
</Button>
{/if}
{#if factors.phone && challengeType != AuthenticationFactor.Phone}
<Button
secondary
fullWidth
{disabled}
on:click={() => createChallenge(AuthenticationFactor.Phone)}>
<Icon icon={IconChatAlt} slot="start" size="s" />
Phone verification
</Button>
{/if}
{#if factors.recoveryCode && challengeType != AuthenticationFactor.Recoverycode}
<Button
text
fullWidth
{disabled}
on:click={() => createChallenge(AuthenticationFactor.Recoverycode)}>
<span class="text">Use recovery code</span>
</Button>
{/if}
</div>
{/if}
+3 -96
View File
@@ -1,6 +1,5 @@
<script lang="ts">
import { onMount } from 'svelte';
import { createPinInput, melt } from '@melt-ui/svelte';
import { Input } from '@appwrite.io/pink-svelte';
export let length: number = 6;
export let value: string = '';
@@ -11,99 +10,7 @@
export let fullWidth = false;
export let autoSubmit = true;
let element: HTMLOListElement;
let autoSubmitted = false;
const {
elements: { root, input }
} = createPinInput({
placeholder: '',
defaultValue: value.split(''),
onValueChange: ({ next }) => {
value = next.join('');
if (value.length < length) {
autoSubmitted = false;
}
if (element && autoSubmit && value.length === length && !autoSubmitted) {
autoSubmitted = true;
const firstInputElement = element.querySelector('input');
firstInputElement?.form.requestSubmit();
}
return next;
}
});
/**
* Clears the input fields and moves the focus to the first input.
* Usually used when resetting fields on auth fails, etc.
*/
export function clearInputsAndRefocus() {
value = '';
autoSubmitted = false;
if (element) {
const inputs = element.querySelectorAll('input');
inputs.forEach((input) => (input.value = ''));
if (autofocus) inputs[0].focus();
}
}
onMount(() => {
const interval = setInterval(() => {
const input = element.querySelector('input');
if (element) {
if (input && autofocus) {
input.focus();
}
clearInterval(interval);
}
}, 10);
});
$: console.log(value);
</script>
<ol class="u-flex u-main-center" use:melt={$root} bind:this={element}>
{#each Array.from({ length }) as _}
<li>
<input
type="number"
class="verification-code-input u-bold u-remove-input-number-buttons"
inputmode="numeric"
maxlength="1"
style:border-radius="var(--border-radius-small)"
use:melt={$input()}
{required}
{readonly}
{disabled} />
</li>
{/each}
</ol>
<style lang="scss">
@use '@appwrite.io/pink-legacy/src/abstract/variables/devices';
/* Default (including mobile) */
ol {
gap: 0.5rem;
input {
--p-input-size: 2.5rem;
font-size: 1rem;
}
}
/* for smaller screens */
@media #{devices.$break2open} {
ol {
gap: 1rem;
input {
--p-input-size: 3.75rem;
font-size: 2rem;
}
}
}
</style>
<Input.OTP {length} bind:value {required} {disabled} {readonly} {autofocus} size="s" {fullWidth} />
+2 -1
View File
@@ -4,6 +4,7 @@
export let id: string;
export let label: string;
export let value = '';
export let helper = '';
export let placeholder = '';
export let required = false;
export let disabled = false;
@@ -44,6 +45,6 @@
state={error ? 'error' : 'default'}
autofocus={autofocus || undefined}
autocomplete={autocomplete ? 'on' : 'off'}
helper={error}
helper={helper || error}
on:invalid={handleInvalid}
bind:value />
+4 -1
View File
@@ -3,7 +3,7 @@
import { Container } from '$lib/layout';
import { toLocaleDateTime } from '$lib/helpers/date';
import type { Models } from '@appwrite.io/console';
import { Layout, Table, Card, Empty } from '@appwrite.io/pink-svelte';
import { Layout, Table, Card, Empty, Typography } from '@appwrite.io/pink-svelte';
import Button from '$lib/elements/forms/button.svelte';
export let logs: Models.LogList;
@@ -12,6 +12,9 @@
</script>
<Container>
<Layout.Stack direction="row" justifyContent="space-between">
<Typography.Title>Activity</Typography.Title>
</Layout.Stack>
{#if logs.total}
<Table.Root>
<svelte:fragment slot="header">
+4 -7
View File
@@ -9,12 +9,14 @@
import { app } from '$lib/stores/app';
import type { Campaign } from '$lib/stores/campaigns';
import { getApiEndpoint } from '$lib/stores/sdk';
import { Typography } from '@appwrite.io/pink-svelte';
export const imgLight = LoginLight;
export const imgDark = LoginDark;
export let campaign: Campaign = null;
export let coupon: Coupon = null;
export let align: 'start' | 'center' | 'end' = 'start';
$: variation = ((coupon?.campaign ?? campaign) ? campaign?.template : 'default') as
| 'default'
@@ -181,14 +183,9 @@
<slot name="top" />
<div class="container u-flex u-flex-vertical u-cross-center u-main-center">
<div class="auth-container u-width-full-line">
<h1 class="heading-level-4 u-margin-block-start-auto is-not-mobile">
<Typography.Title size="m" {align}>
<slot name="title" />
</h1>
<h1
class="heading-level-5 u-margin-block-start-auto is-only-mobile"
class:u-padding-block-start-24={variation !== 'default'}>
<slot name="title" />
</h1>
</Typography.Title>
<div class="u-margin-block-start-24">
<slot />
</div>
+8 -8
View File
@@ -8,7 +8,7 @@
import MfaChallengeFormList, { verify } from '$lib/components/mfaChallengeFormList.svelte';
import { page } from '$app/stores';
import { addNotification } from '$lib/stores/notifications.js';
import { Icon } from '@appwrite.io/pink-svelte';
import { Icon, Layout } from '@appwrite.io/pink-svelte';
import { IconChevronLeft } from '@appwrite.io/pink-icons-svelte';
export let data;
@@ -53,11 +53,11 @@
<title>Verify - Appwrite</title>
</svelte:head>
<Unauthenticated>
<Unauthenticated align="center">
<svelte:fragment slot="top">
<div class="top u-flex u-position-absolute u-main-center">
<div class="flex u-width-full-line">
<Button text class="u-border-width-0" on:click={back}>
<Button compact on:click={back}>
<Icon icon={IconChevronLeft} slot="start" size="s" />
Back
</Button>
@@ -65,11 +65,11 @@
</div>
</svelte:fragment>
<svelte:fragment slot="title">Verify your identity</svelte:fragment>
<svelte:fragment>
<Form onSubmit={submit} class="body-text-1">
<Form onSubmit={submit}>
<Layout.Stack gap="l" justifyContent="center" alignContent="center" alignItems="center">
<MfaChallengeFormList {factors} bind:challenge bind:code bind:disabled />
</Form>
</svelte:fragment>
</Layout.Stack>
</Form>
</Unauthenticated>
<style lang="scss">
@@ -87,7 +87,7 @@
@media (max-width: 440px) {
.top {
inset-block-start: 0rem;
inset-block-start: 1rem;
padding-inline: 0.5rem;
}
}
@@ -9,8 +9,7 @@
import { invalidate } from '$app/navigation';
import { Dependencies } from '$lib/constants';
import { oAuthProviders } from '$lib/stores/oauth-providers';
import EmptySearch from '$lib/components/emptySearch.svelte';
import { Icon, Layout, Table } from '@appwrite.io/pink-svelte';
import { Card, Empty, Icon, Layout, Table } from '@appwrite.io/pink-svelte';
import { IconTrash } from '@appwrite.io/pink-icons-svelte';
async function deleteIdentity(id: string) {
@@ -38,12 +37,13 @@
<svelte:fragment slot="aside">
{#if $identities.length === 0}
<EmptySearch hidePagination>
<div class="u-text-center">
No identities are currently available. Once you sign in via GitHub, you'll see
it here.
</div>
</EmptySearch>
<Card.Base padding="none">
<Empty
type="secondary"
title="No identities are currently available."
description="Once you sign in via GitHub, you'll see
it here." />
</Card.Base>
{:else}
<Table.Root>
<svelte:fragment slot="header">
@@ -1,10 +1,9 @@
<script lang="ts">
import { Modal, Output, Copy, Alert } from '$lib/components';
import { Modal, Output, Copy } from '$lib/components';
import { Button } from '$lib/elements/forms';
import { Table, TableBody, TableCell, TableRow } from '$lib/elements/table';
import { type Models } from '@appwrite.io/console';
import { IconDownload } from '@appwrite.io/pink-icons-svelte';
import { Icon } from '@appwrite.io/pink-svelte';
import { IconDownload, IconDuplicate } from '@appwrite.io/pink-icons-svelte';
import { Icon, Alert, Layout, Divider, Table } from '@appwrite.io/pink-svelte';
export let showRecoveryCodes = false;
export let codes: Models.MfaRecoveryCodes = null;
@@ -13,54 +12,44 @@
<Modal title="Recovery codes" bind:show={showRecoveryCodes}>
{#if codes}
{@const formattedBackupCodes = codes.recoveryCodes.join('\n')}
<Alert type="warning">
<span slot="title">
Securely store your recovery codes as they won't be visible again for security
purposes
<Alert.Inline
status="warning"
title="Securely store your recovery codes as they won't be visible again for security
purposes">
Use security codes for emergency sign-ins in case you've lost access to your mobile
device. Each recovery code can only be used once.
</Alert.Inline>
<Layout.Stack direction="row-reverse" alignItems="center" gap="s">
<Button
download="appwrite-backups.txt"
href={`data:application/octet-stream;charset=utf-8,${formattedBackupCodes}`}
text>
<Icon icon={IconDownload} slot="start" size="s" />
Download .txt
</Button>
<span style:height="20px">
<Divider vertical />
</span>
<p>
Use security codes for emergency sign-ins in case you've lost access to your mobile
device. Each recovery code can only be used once.
</p>
</Alert>
<div
style:flex-direction="row-reverse"
class="u-flex u-flex-vertical-mobile u-main-space-between u-gap-16">
<ul class="buttons-list">
<li class="buttons-list-item">
<Button
download="appwrite-backups.txt"
href={`data:application/octet-stream;charset=utf-8,${formattedBackupCodes}`}
text>
<Icon icon={IconDownload} slot="start" size="s" />
Download .txt
</Button>
</li>
<li class="buttons-list-item">
<Copy value={formattedBackupCodes} appendTo="parent">
<Button text>
<span class="icon-duplicate" />
<span class="text">Copy all</span>
</Button>
</Copy>
</li>
</ul>
</div>
<Table noMargin noStyles>
<TableBody>
{#each codes.recoveryCodes as code}
<TableRow>
<TableCell title="code">
<Output value={code} hideCopyIcon>{code}</Output>
</TableCell>
<TableCell title="actions" width={24}>
<Copy value={code} appendTo="parent">
<span class="icon-duplicate" aria-hidden="true" />
</Copy>
</TableCell>
</TableRow>
{/each}
</TableBody>
</Table>
<Copy value={formattedBackupCodes}>
<Button text>
<Icon icon={IconDuplicate} slot="start" size="s" />
Copy all
</Button>
</Copy>
</Layout.Stack>
<Table.Root>
{#each codes.recoveryCodes as code}
<Table.Row>
<Table.Cell>
<Output value={code} hideCopyIcon>{code}</Output>
</Table.Cell>
<Table.Cell width="24px">
<Copy value={code}>
<Icon icon={IconDuplicate} />
</Copy>
</Table.Cell>
</Table.Row>
{/each}
</Table.Root>
{/if}
</Modal>
@@ -65,7 +65,8 @@
{@const avatarList = getMemberships(organization.$id)}
<GridItem1 href={`${base}/organization-${organization.$id}`}>
<svelte:fragment slot="eyebrow">
{organization?.total ? organization?.total : 'No'} members
{organization?.total}
{organization?.total > 1 ? 'members' : 'member'}
</svelte:fragment>
<svelte:fragment slot="title">
{organization.name}
@@ -5,17 +5,7 @@
import { Submit, trackEvent } from '$lib/actions/analytics';
import { Heading, Trim } from '$lib/components';
import { Dependencies } from '$lib/constants';
import { Pill } from '$lib/elements';
import { Button } from '$lib/elements/forms';
import {
TableBody,
TableCell,
TableCellHead,
TableCellText,
TableHeader,
TableRow,
TableScroll
} from '$lib/elements/table';
import { isValueOfStringEnum } from '$lib/helpers/types';
import { Container } from '$lib/layout';
import { sdk } from '$lib/stores/sdk';
@@ -23,6 +13,7 @@
import type { PageData } from './$types';
import { addNotification } from '$lib/stores/notifications';
import { onMount } from 'svelte';
import { Badge, Layout, Table, Typography } from '@appwrite.io/pink-svelte';
export let data: PageData;
@@ -89,78 +80,69 @@
</script>
<Container>
<div class="u-flex u-gap-12 common-section u-main-space-between">
<Heading tag="h2" size="5">Sessions</Heading>
<Layout.Stack direction="row" justifyContent="space-between">
<Typography.Title>Sessions</Typography.Title>
<Button secondary on:click={logoutAll}>Sign out all sessions</Button>
</Layout.Stack>
<Button secondary on:click={logoutAll}>
<span class="text">Sign out all sessions</span>
</Button>
</div>
<TableScroll>
<TableHeader>
<TableCellHead width={250}>Client</TableCellHead>
<TableCellHead width={70}>Location</TableCellHead>
<TableCellHead width={90}>IP</TableCellHead>
<TableCellHead width={60} />
</TableHeader>
<TableBody>
{#each data.sessions.sessions as session}
{@const browser = getBrowser(session.clientCode)}
<TableRow>
<TableCell title="Client">
<div class="u-flex u-gap-12 u-cross-center">
{#if session.clientName}
<div class="avatar">
{#if browser}
<img
height="20"
width="20"
src={getBrowser(session.clientCode).toString()}
style="--p-text-size: 1.25rem"
alt={session.clientName} />
{:else}
<span
class="icon-globe-alt"
style="--p-text-size: 1.25rem"
aria-hidden="true" />
{/if}
</div>
<Trim>
{session.clientName}
{session.clientVersion}
on {session.osName}
{session.osVersion}
</Trim>
{:else}
<span class="avatar is-color-empty" />
<p class="text u-trim">Unknown</p>
{/if}
<div class="is-only-desktop">
<Pill>{session.provider}</Pill>
<Table.Root>
<svelte:fragment slot="header">
<Table.Header.Cell>Client</Table.Header.Cell>
<Table.Header.Cell>Location</Table.Header.Cell>
<Table.Header.Cell>IP</Table.Header.Cell>
<Table.Header.Cell width="68px" />
</svelte:fragment>
{#each data.sessions.sessions as session}
{@const browser = getBrowser(session.clientCode)}
<Table.Row>
<Table.Cell>
<Layout.Stack direction="row" alignItems="center">
{#if session.clientName}
<div class="avatar is-size-small">
{#if browser}
<img
height="20"
width="20"
src={getBrowser(session.clientCode).toString()}
style="--p-text-size: 1.25rem"
alt={session.clientName} />
{:else}
<span
class="icon-globe-alt"
style="--p-text-size: 1.25rem"
aria-hidden="true" />
{/if}
</div>
{#if session.current}
<Pill success>current session</Pill>
{/if}
</div>
</TableCell>
<TableCellText title="Location">
{#if session.countryCode !== '--'}
{session.countryName}
<Trim>
{session.clientName}
{session.clientVersion}
on {session.osName}
{session.osVersion}
</Trim>
{:else}
Unknown
<span class="avatar is-color-empty" />
<p class="text u-trim">Unknown</p>
{/if}
</TableCellText>
<TableCellText title="IP">{session.ip}</TableCellText>
<TableCell title="Client">
<Button secondary on:click={() => logout(session)}>Sign out</Button>
</TableCell>
</TableRow>
{/each}
</TableBody>
</TableScroll>
<div class="u-flex u-margin-block-start-32 u-main-space-between">
<p class="text">Total results: {data.sessions.total}</p>
</div>
<div class="is-only-desktop">
<Badge variant="secondary" content={session.provider} />
</div>
{#if session.current}
<Badge type="success" variant="secondary" content="current session" />
{/if}
</Layout.Stack>
</Table.Cell>
<Table.Cell>
{#if session.countryCode !== '--'}
{session.countryName}
{:else}
Unknown
{/if}
</Table.Cell>
<Table.Cell>{session.ip}</Table.Cell>
<Table.Cell>
<Button size="xs" secondary on:click={() => logout(session)}>Sign out</Button>
</Table.Cell>
</Table.Row>
{/each}
</Table.Root>
</Container>
@@ -40,13 +40,18 @@
<svelte:fragment slot="title">Email</svelte:fragment>
<svelte:fragment slot="aside">
<FormList>
<InputText id="email" label="Email" placeholder="Enter email" bind:value={email} />
<InputText
id="email"
label="Email"
placeholder="Enter email"
bind:value={email}
required />
{#if email !== $user.email && email}
<InputPassword
id="emailPassword"
label="Password"
placeholder="Enter password"
showPasswordButton={true}
required
bind:value={emailPassword} />
{/if}
</FormList>
+145 -150
View File
@@ -16,6 +16,7 @@
import { Pill } from '$lib/elements';
import { page } from '$app/stores';
import { onMount } from 'svelte';
import { Badge, Divider, Layout, Link, Typography } from '@appwrite.io/pink-svelte';
let showSetup: boolean = false;
let showDelete: boolean = false;
@@ -137,170 +138,164 @@
<CardGrid>
<svelte:fragment slot="title">Multi-factor authentication</svelte:fragment>
Enhance your account's security by requiring a second sign-in method.
<Link.Anchor
target="_blank"
rel="noopener noreferrer"
href="https://appwrite.io/docs/products/auth/mfa">Learn more</Link.Anchor>
<svelte:fragment slot="aside">
<div class="u-flex u-flex-vertical u-gap-32">
<div class="u-flex u-flex-vertical u-gap-16">
<FormList>
<InputChoice
on:change={updateMfa}
type="switchbox"
id="mfa"
label="Multi-factor authentication"
value={$user.mfa} />
</FormList>
<p>
Two-factor authentication enhances your account's security by requiring a second
sign-in method. <Button
link
external
href="https://appwrite.io/docs/products/auth/mfa">Learn more.</Button>
</p>
</div>
{#if $user.mfa}
<div class="u-flex-vertical u-gap-16">
<div class="u-sep-block-end" style="padding-block-end: 8px;">
<Layout.Stack gap="xl">
<InputChoice
on:change={updateMfa}
type="switchbox"
id="mfa"
label="Multi-factor authentication"
value={$user.mfa} />
<Layout.Stack gap="xl">
{#if $user.mfa}
<Layout.Stack>
<EyebrowHeading tag="h3" size={3} class="u-normal">Methods</EyebrowHeading>
</div>
<div
class="method u-flex u-flex-vertical-mobile u-gap-16 u-main-space-between u-sep-block-end"
style="padding-block-end: 16px">
<div class="u-flex u-gap-8 u-cross-baseline">
<Layout.Stack direction="row">
<div class="avatar is-size-x-small">
<span class="icon-device-mobile" aria-hidden="true" />
</div>
<div class="u-flex-vertical u-gap-4">
<div class="u-flex u-gap-4 u-cross-center">
<span class="body-text-2 u-bold">Authenticator app</span>
<Layout.Stack gap="xxxs">
<Layout.Stack gap="s">
<Typography.Text variant="m-600"
>Authenticator app</Typography.Text>
{#if $factors.totp}
<Pill>connected</Pill>
{/if}
</div>
<span class="body-text-2"
>Use an authentication app to generate two-factor authentication
codes.</span>
</div>
</div>
<div class="method-button">
{#if $factors.totp}
<Button
text
class="is-not-mobile"
on:click={() => (showDelete = true)}>Delete</Button>
<Button
text
class="is-only-mobile"
on:click={() => (showDelete = true)}>Delete</Button>
{:else}
<Button secondary on:click={() => (showSetup = true)}>Add</Button>
{/if}
</div>
</div>
{#if $factors.email}
<div
class="u-flex u-main-space-between u-sep-block-end"
style="padding-block-end: 16px">
<div class="u-flex u-gap-8 u-cross-baseline">
<div class="avatar is-size-x-small">
<span class="icon-mail" aria-hidden="true" />
</div>
<div class="u-flex-vertical u-gap-4">
<div class="u-flex u-gap-4 u-cross-center">
<span class="body-text-2 u-bold">Email</span>
<Pill>verified</Pill>
</div>
<span>One-time codes will be sent to: {$user.email}</span>
</div>
</div>
</div>
{:else if !$user.emailVerification}
<div
class="u-flex u-main-space-between u-sep-block-end"
style="padding-block-end: 16px">
<div class="u-flex u-gap-8 u-cross-baseline">
<div class="avatar is-size-x-small">
<span class="icon-mail" aria-hidden="true" />
</div>
<div class="u-flex-vertical u-gap-4">
<div class="u-flex u-gap-4 u-cross-center">
<span class="body-text-2 u-bold">Email</span>
<Pill>unverified</Pill>
</div>
<span>Verify your email to receive login MFA codes.</span>
</div>
</div>
<Button
secondary
disabled={creatingVerification}
on:click={() => createVerification()}>Verify</Button>
</div>
{/if}
{#if $factors.phone}
<div
class="u-flex u-main-space-between u-sep-block-end"
style="padding-block-end: 16px">
<div class="u-flex u-gap-8 u-cross-baseline">
<div class="avatar is-size-x-small">
<span class="icon-send" aria-hidden="true" />
</div>
<div class="u-flex-vertical u-gap-4">
<div class="u-flex u-gap-4 u-cross-center">
<span class="body-text-2 u-bold">SMS</span>
<Pill>verified</Pill>
</div>
<span>One-time codes will be sent to: {$user.phone}</span>
</div>
</div>
</div>
{/if}
</div>
{#if enabledMethods.length > 0}
<div class="u-flex-vertical u-gap-16">
<div class="u-sep-block-end" style="padding-block-end: 8px;">
<EyebrowHeading tag="h6" size={3} class="u-normal"
>Recovery</EyebrowHeading>
</div>
<div
class="method u-flex u-flex-vertical-mobile u-gap-16 u-main-space-between u-sep-block-end"
style="padding-block-end: 16px">
<div class="u-flex u-gap-8 u-cross-baseline">
<div class="avatar is-size-x-small">
<span class="icon-lock-open" aria-hidden="true" />
</div>
<div class="u-flex-vertical u-gap-4 body-text-2">
<span class="u-bold">Recovery codes</span>
<span
>Use in case you can't receive two-factor authentication
codes.</span>
</div>
</div>
<div class="method-button">
{#if $factors.recoveryCode}
</Layout.Stack>
<Typography.Text variant="m-400">
Use an authentication app to generate two-factor authentication
codes.
</Typography.Text>
</Layout.Stack>
<div>
{#if $factors.totp}
<Button
class="method-button is-not-mobile"
text
on:click={() => (showRegenerateRecoveryCodes = true)}
>Regenerate</Button>
<Button
class="method-button is-only-mobile"
text
on:click={() => (showRegenerateRecoveryCodes = true)}
>Regenerate</Button>
class="is-not-mobile"
on:click={() => (showDelete = true)}>Delete</Button>
{:else}
<Button
class="method-button"
secondary
on:click={createRecoveryCodes}>View</Button>
<Button secondary on:click={() => (showSetup = true)}
>Add</Button>
{/if}
</div>
</div>
</div>
</Layout.Stack>
<Divider />
{#if $factors.email}
<Layout.Stack>
<Layout.Stack direction="row">
<div class="avatar is-size-x-small">
<span class="icon-mail" aria-hidden="true" />
</div>
<Layout.Stack gap="xxxs">
<Layout.Stack gap="s" direction="row">
<Typography.Text variant="m-600">Email</Typography.Text>
<Badge
variant="secondary"
content="verified"
size="s" />
</Layout.Stack>
<Typography.Text variant="m-400">
One-time codes will be sent to: {$user.email}
</Typography.Text>
</Layout.Stack>
</Layout.Stack>
</Layout.Stack>
{:else if !$user.emailVerification}
<Layout.Stack>
<Layout.Stack direction="row">
<div class="avatar is-size-x-small">
<span class="icon-mail" aria-hidden="true" />
</div>
<Layout.Stack gap="xxxs">
<Layout.Stack gap="s" direction="row">
<Typography.Text variant="m-600">Email</Typography.Text>
<Badge
variant="secondary"
size="s"
content="unverified" />
</Layout.Stack>
<Typography.Text variant="m-400">
Verify your email to receive login MFA codes.
</Typography.Text>
</Layout.Stack>
<div>
<Button
secondary
disabled={creatingVerification}
on:click={() => createVerification()}>Verify</Button>
</div>
</Layout.Stack>
</Layout.Stack>
{/if}
{#if $factors.phone}
<Layout.Stack>
<Layout.Stack direction="row">
<div class="avatar is-size-x-small">
<span class="icon-send" aria-hidden="true" />
</div>
<Layout.Stack gap="xxxs">
<Layout.Stack gap="s" direction="row">
<Typography.Text variant="m-600">SMS</Typography.Text>
<Badge
variant="secondary"
size="s"
content="verified" />
</Layout.Stack>
<Typography.Text variant="m-400">
One-time codes will be sent to: {$user.phone}
</Typography.Text>
</Layout.Stack>
</Layout.Stack>
</Layout.Stack>
{/if}
</Layout.Stack>
{#if enabledMethods.length > 0}
<Layout.Stack>
<EyebrowHeading tag="h6" size={3} class="u-normal"
>Recovery</EyebrowHeading>
<Layout.Stack>
<Layout.Stack direction="row">
<div class="avatar is-size-x-small">
<span class="icon-lock-open" aria-hidden="true" />
</div>
<Layout.Stack gap="xxxs">
<Layout.Stack gap="s" direction="row">
<Typography.Text variant="m-600"
>Recovery codes</Typography.Text>
</Layout.Stack>
<Typography.Text variant="m-400">
Use in case you can't receive two-factor authentication
codes.
</Typography.Text>
</Layout.Stack>
{#if $factors.recoveryCode}
<Button
text
on:click={() => (showRegenerateRecoveryCodes = true)}>
Regenerate
</Button>
{:else}
<Button
class="method-button"
secondary
on:click={createRecoveryCodes}>View</Button>
{/if}
</Layout.Stack>
</Layout.Stack>
</Layout.Stack>
{/if}
{/if}
{/if}
</div>
</Layout.Stack>
</Layout.Stack>
</svelte:fragment>
</CardGrid>
@@ -40,7 +40,12 @@
<svelte:fragment slot="aside">
<FormList>
<InputText id="name" label="Name" placeholder="Enter name" bind:value={name} />
<InputText
id="name"
label="Name"
placeholder="Enter name"
bind:value={name}
required />
</FormList>
</svelte:fragment>
@@ -5,6 +5,7 @@
import { Button, Form, FormList, InputPassword } from '$lib/elements/forms';
import { addNotification } from '$lib/stores/notifications';
import { sdk } from '$lib/stores/sdk';
import { Link } from '@appwrite.io/pink-svelte';
let newPassword: string = null;
let oldPassword: string = null;
@@ -31,7 +32,8 @@
<Form onSubmit={updatePassword}>
<CardGrid>
<svelte:fragment slot="title">Password</svelte:fragment>
Forgot your password? <a class="link" href={`${base}/recover`}>Recover your password</a>
Forgot your password? <Link.Anchor href={`${base}/recover`}
>Recover your password</Link.Anchor>
<svelte:fragment slot="aside">
<FormList>
@@ -39,12 +41,13 @@
id="oldPassword"
label="Old password"
placeholder="Enter password"
required
bind:value={oldPassword} />
<InputPassword
id="newPassword"
label="New password"
placeholder="Enter password"
showPasswordButton={true}
required
bind:value={newPassword} />
</FormList>
</svelte:fragment>
@@ -20,6 +20,7 @@
import { page } from '$app/stores';
import { redirectTo } from '$routes/store';
import { checkPricingRefAndRedirect } from '$lib/helpers/pricingRedirect';
import { Typography } from '@appwrite.io/pink-svelte';
export let data;
@@ -107,6 +108,7 @@
id="password"
label="Password"
placeholder="Your password"
helper="Password must be at least 8 characters long"
required
bind:value={pass} />
<InputChoice required value={terms} id="terms" label="terms" showLabel={false}>
@@ -126,7 +128,7 @@
<Button fullWidth submit {disabled}>Sign up</Button>
{#if isCloud}
<span class="with-separators eyebrow-heading-3">or</span>
<Button fullWidth on:click={onGithubLogin} {disabled}>
<Button secondary fullWidth on:click={onGithubLogin} {disabled}>
<span class="icon-github" aria-hidden="true" />
<span class="text">Sign up with GitHub</span>
</Button>
@@ -135,12 +137,10 @@
</Form>
</svelte:fragment>
<svelte:fragment slot="links">
<li class="inline-links-item">
<span class="text">
Already got an account? <a
class="link"
href={`${base}/login${$page?.url?.search ?? ''}`}>Sign in</a>
</span>
</li>
<Typography.Text variant="m-400">
Already got an account? <a
class="link"
href={`${base}/login${$page?.url?.search ?? ''}`}>Sign in</a>
</Typography.Text>
</svelte:fragment>
</Unauthenticated>
+10 -9
View File
@@ -9,6 +9,7 @@
import { onMount } from 'svelte';
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
import { Alert } from '$lib/components';
import { Layout, Link, Typography } from '@appwrite.io/pink-svelte';
let teamId: string, membershipId: string, userId: string, secret: string;
let terms = false;
@@ -61,8 +62,10 @@
<Button href={`${base}/register`}>Sign up to Appwrite</Button>
</div>
{:else}
<div class="u-flex-vertical u-gap-16">
<p class="text">You have been invited to join an organization on Appwrite</p>
<Layout.Stack>
<Typography.Text>
You have been invited to join an organization on Appwrite
</Typography.Text>
<Form onSubmit={acceptInvite}>
<FormList>
<InputChoice
@@ -71,18 +74,16 @@
id="terms"
label="terms"
showLabel={false}>
By accepting the invitation, you agree to the <a
class="link"
By accepting the invitation, you agree to the <Link.Anchor
href="https://appwrite.io/terms"
target="_blank"
rel="noopener noreferrer">Terms and Conditions</a>
rel="noopener noreferrer">Terms and Conditions</Link.Anchor>
and
<a
class="link"
<Link.Anchor
href="https://appwrite.io/privacy"
target="_blank"
rel="noopener noreferrer">
Privacy Policy</a
Privacy Policy</Link.Anchor
>.</InputChoice>
<div class="u-flex u-main-end u-gap-12">
@@ -91,7 +92,7 @@
</div>
</FormList>
</Form>
</div>
</Layout.Stack>
{/if}
</svelte:fragment>
</Unauthenticated>
+8 -6
View File
@@ -8,6 +8,7 @@
import { onMount } from 'svelte';
import { page } from '$app/stores';
import { goto } from '$app/navigation';
import { Divider, Layout, Link } from '@appwrite.io/pink-svelte';
let email: string;
let userId: string;
@@ -102,11 +103,12 @@
{/if}
</svelte:fragment>
<svelte:fragment slot="links">
<li class="inline-links-item">
<a href={`${base}/login`}><span class="text">Sign in</span></a>
</li>
<li class="inline-links-item">
<a href={`${base}/register`}><span class="text">Sign Up</span></a>
</li>
<Layout.Stack direction="row" justifyContent="center" alignItems="center">
<Link.Anchor href={`${base}/login`} variant="quiet">Sign in</Link.Anchor>
<div style:height="20px">
<Divider vertical />
</div>
<Link.Anchor href={`${base}/register`} variant="quiet">Sign up</Link.Anchor>
</Layout.Stack>
</svelte:fragment>
</Unauthenticated>