Compare commits
2 commits
5f8c34ef78
...
f8f460fe74
Author | SHA1 | Date | |
---|---|---|---|
|
f8f460fe74 | ||
|
027628290f |
12 changed files with 440 additions and 981 deletions
23
package.json
23
package.json
|
@ -6,7 +6,6 @@
|
||||||
"dev": "vite dev",
|
"dev": "vite dev",
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"test": "npm run test:integration && npm run test:unit",
|
|
||||||
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
||||||
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
||||||
"lint": "prettier --plugin-search-dir . --check . && eslint .",
|
"lint": "prettier --plugin-search-dir . --check . && eslint .",
|
||||||
|
@ -24,14 +23,13 @@
|
||||||
"mode-watcher": "^0.3.1",
|
"mode-watcher": "^0.3.1",
|
||||||
"svelte-boring-avatars": "^1.2.6",
|
"svelte-boring-avatars": "^1.2.6",
|
||||||
"svelte-sonner": "^0.3.28",
|
"svelte-sonner": "^0.3.28",
|
||||||
"tailwind-merge": "^2.5.2",
|
"tailwind-merge": "^2.5.4",
|
||||||
"tailwind-variants": "^0.2.1",
|
"tailwind-variants": "^0.2.1",
|
||||||
"vaul-svelte": "^0.3.2"
|
"vaul-svelte": "^0.3.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@playwright/test": "^1.47.1",
|
"@sveltejs/adapter-node": "^5.2.7",
|
||||||
"@sveltejs/adapter-node": "^5.2.3",
|
"@sveltejs/kit": "^2.7.1",
|
||||||
"@sveltejs/kit": "^2.5.28",
|
|
||||||
"@sveltejs/vite-plugin-svelte": "^3.1.2",
|
"@sveltejs/vite-plugin-svelte": "^3.1.2",
|
||||||
"@tailwindcss/typography": "^0.5.15",
|
"@tailwindcss/typography": "^0.5.15",
|
||||||
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
||||||
|
@ -40,19 +38,18 @@
|
||||||
"boring-avatars": "^1.11.2",
|
"boring-avatars": "^1.11.2",
|
||||||
"eslint": "^8.57.1",
|
"eslint": "^8.57.1",
|
||||||
"eslint-config-prettier": "^9.1.0",
|
"eslint-config-prettier": "^9.1.0",
|
||||||
"eslint-plugin-svelte": "^2.44.0",
|
"eslint-plugin-svelte": "^2.44.1",
|
||||||
"postcss": "^8.4.47",
|
"postcss": "^8.4.47",
|
||||||
"prettier": "^3.3.3",
|
"prettier": "^3.3.3",
|
||||||
"prettier-plugin-svelte": "^3.2.6",
|
"prettier-plugin-svelte": "^3.2.7",
|
||||||
"prettier-plugin-tailwindcss": "^0.5.14",
|
"prettier-plugin-tailwindcss": "^0.5.14",
|
||||||
"svelte": "^4.2.19",
|
"svelte": "^4.2.19",
|
||||||
"svelte-check": "^3.8.6",
|
"svelte-check": "^3.8.6",
|
||||||
"sveltekit-superforms": "^2.18.1",
|
"sveltekit-superforms": "^2.19.1",
|
||||||
"tailwindcss": "^3.4.12",
|
"tailwindcss": "^3.4.14",
|
||||||
"tslib": "^2.7.0",
|
"tslib": "^2.8.0",
|
||||||
"typescript": "^5.6.2",
|
"typescript": "^5.6.3",
|
||||||
"vite": "^5.4.6",
|
"vite": "^5.4.9",
|
||||||
"vitest": "^1.6.0",
|
|
||||||
"zod": "^3.23.8"
|
"zod": "^3.23.8"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
1304
pnpm-lock.yaml
generated
1304
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load diff
|
@ -25,7 +25,7 @@ export const handle: Handle = async ({ event, resolve }) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const user: User = await res.json();
|
const user = await res.json() as User;
|
||||||
event.locals.user = user;
|
event.locals.user = user;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
event.locals.user = undefined;
|
event.locals.user = undefined;
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
import { describe, it, expect } from 'vitest';
|
|
||||||
|
|
||||||
describe('sum test', () => {
|
|
||||||
it('adds 1 + 2 to equal 3', () => {
|
|
||||||
expect(1 + 2).toBe(3);
|
|
||||||
});
|
|
||||||
});
|
|
0
src/lib/components/icons/index.ts
Normal file
0
src/lib/components/icons/index.ts
Normal file
|
@ -1,17 +0,0 @@
|
||||||
import { browser } from '$app/environment';
|
|
||||||
import { writable } from 'svelte/store';
|
|
||||||
|
|
||||||
const defaultValue = true;
|
|
||||||
const initialValue = browser
|
|
||||||
? window.localStorage.getItem('plausible_ignore') === 'true'
|
|
||||||
: defaultValue;
|
|
||||||
|
|
||||||
const plausible = writable<boolean>(initialValue);
|
|
||||||
|
|
||||||
plausible.subscribe((value) => {
|
|
||||||
if (browser) {
|
|
||||||
window.localStorage.setItem('plausible_ignore', value ? 'true' : 'false');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export default plausible;
|
|
|
@ -54,6 +54,7 @@
|
||||||
<Form.Control let:attrs>
|
<Form.Control let:attrs>
|
||||||
<Form.Label>Prénom</Form.Label>
|
<Form.Label>Prénom</Form.Label>
|
||||||
<Input {...attrs} bind:value={$formData.firstname} placeholder="Philip" />
|
<Input {...attrs} bind:value={$formData.firstname} placeholder="Philip" />
|
||||||
|
<Form.Description>Votre prénom de famille ne sera pas visible par les autres utilisateurs.</Form.Description>
|
||||||
</Form.Control>
|
</Form.Control>
|
||||||
<Form.FieldErrors />
|
<Form.FieldErrors />
|
||||||
</Form.Field>
|
</Form.Field>
|
||||||
|
@ -61,6 +62,7 @@
|
||||||
<Form.Control let:attrs>
|
<Form.Control let:attrs>
|
||||||
<Form.Label>Nom de famille</Form.Label>
|
<Form.Label>Nom de famille</Form.Label>
|
||||||
<Input {...attrs} bind:value={$formData.lastname} placeholder="Barlow" />
|
<Input {...attrs} bind:value={$formData.lastname} placeholder="Barlow" />
|
||||||
|
<Form.Description>Votre nom de famille ne sera pas visible par les autres utilisateurs.</Form.Description>
|
||||||
</Form.Control>
|
</Form.Control>
|
||||||
<Form.FieldErrors />
|
<Form.FieldErrors />
|
||||||
</Form.Field>
|
</Form.Field>
|
||||||
|
@ -69,7 +71,7 @@
|
||||||
<Form.Label>Nom d'utilisateur</Form.Label>
|
<Form.Label>Nom d'utilisateur</Form.Label>
|
||||||
<Input {...attrs} bind:value={$formData.pseudo} placeholder="Cypherwolf" />
|
<Input {...attrs} bind:value={$formData.pseudo} placeholder="Cypherwolf" />
|
||||||
</Form.Control>
|
</Form.Control>
|
||||||
<Form.Description>Ce nom sera visible par les autres utilisateurs.</Form.Description>
|
<Form.Description>Votre nom d'utilisateur sera visible par les autres utilisateurs.</Form.Description>
|
||||||
<Form.FieldErrors />
|
<Form.FieldErrors />
|
||||||
</Form.Field>
|
</Form.Field>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -21,7 +21,6 @@ export const load: PageServerLoad = async ({ locals: { user } }) => {
|
||||||
|
|
||||||
export const actions: Actions = {
|
export const actions: Actions = {
|
||||||
default: async ({ request, cookies, fetch, url: { searchParams } }) => {
|
default: async ({ request, cookies, fetch, url: { searchParams } }) => {
|
||||||
|
|
||||||
const form = await superValidate(request, zod(loginSchema));
|
const form = await superValidate(request, zod(loginSchema));
|
||||||
|
|
||||||
if (!form.valid) {
|
if (!form.valid) {
|
||||||
|
|
|
@ -25,7 +25,6 @@ export const load: PageServerLoad = async ({ locals: { user } }) => {
|
||||||
|
|
||||||
export const actions: Actions = {
|
export const actions: Actions = {
|
||||||
register: async ({ request }) => {
|
register: async ({ request }) => {
|
||||||
|
|
||||||
const form = await superValidate(request, zod(registerSchema));
|
const form = await superValidate(request, zod(registerSchema));
|
||||||
|
|
||||||
if (!form.valid) {
|
if (!form.valid) {
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
import { superForm } from 'sveltekit-superforms/client';
|
import { superForm } from 'sveltekit-superforms/client';
|
||||||
|
|
||||||
import * as Form from '$lib/components/ui/form';
|
import * as Form from '$lib/components/ui/form';
|
||||||
import Input from '$lib/components/ui/input/input.svelte';
|
import { Input } from '$lib/components/ui/input';
|
||||||
|
|
||||||
import { registerConfirmationSchema, registerSchema } from '$lib/validations/auth';
|
import { registerConfirmationSchema, registerSchema } from '$lib/validations/auth';
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@
|
||||||
<Input
|
<Input
|
||||||
{...attrs}
|
{...attrs}
|
||||||
bind:value={$registerConfirmationFormData.code}
|
bind:value={$registerConfirmationFormData.code}
|
||||||
placeholder="0000"
|
placeholder="0a0a-a0a0"
|
||||||
/>
|
/>
|
||||||
</Form.Control>
|
</Form.Control>
|
||||||
<Form.FieldErrors />
|
<Form.FieldErrors />
|
||||||
|
@ -220,9 +220,9 @@
|
||||||
{/if}
|
{/if}
|
||||||
<ul class="flex justify-between">
|
<ul class="flex justify-between">
|
||||||
<li>
|
<li>
|
||||||
<a class="text-muted-foreground hover:text-primary" href="/login{$page.url.search}"
|
<a class="text-muted-foreground hover:text-primary" href="/login{$page.url.search}">
|
||||||
>Se connecter</a
|
Se connecter
|
||||||
>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
import '../app.css';
|
import '../app.css';
|
||||||
|
|
||||||
import { Metadata } from '$lib/components';
|
import { Metadata } from '$lib/components';
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Metadata />
|
<Metadata />
|
||||||
|
|
|
@ -1,51 +0,0 @@
|
||||||
import { expect, test } from '@playwright/test';
|
|
||||||
|
|
||||||
test('index page redirects to login page', async ({ page }) => {
|
|
||||||
await page.goto('/');
|
|
||||||
|
|
||||||
await page.waitForURL('/login');
|
|
||||||
|
|
||||||
await expect(page.url()).toContain('/login');
|
|
||||||
});
|
|
||||||
|
|
||||||
test('login page has a register link that redirects to the register page', async ({ page }) => {
|
|
||||||
await page.goto('/login');
|
|
||||||
|
|
||||||
const link = await page.$('a[href*="/register"]');
|
|
||||||
|
|
||||||
await link?.click();
|
|
||||||
|
|
||||||
await page.waitForURL('/register');
|
|
||||||
|
|
||||||
await expect(page.url()).toContain('/register');
|
|
||||||
});
|
|
||||||
|
|
||||||
test('register page has a login link that redirects to the login page', async ({ page }) => {
|
|
||||||
await page.goto('/register');
|
|
||||||
|
|
||||||
const link = await page.$('a[href*="/login"]');
|
|
||||||
|
|
||||||
await link?.click();
|
|
||||||
|
|
||||||
await page.waitForURL('/login');
|
|
||||||
|
|
||||||
await expect(page.url()).toContain('/login');
|
|
||||||
});
|
|
||||||
|
|
||||||
test('dashboard page redirects to login page if user is not logged in', async ({ page }) => {
|
|
||||||
await page.goto('');
|
|
||||||
await expect(page.url()).toContain('/login');
|
|
||||||
});
|
|
||||||
|
|
||||||
test('login form accepts valid credentials', async ({ page }) => {
|
|
||||||
await page.context().clearCookies();
|
|
||||||
|
|
||||||
await page.goto('/login');
|
|
||||||
|
|
||||||
await page.fill('input[name="pseudo"]', 'glazk0');
|
|
||||||
await page.fill('input[name="passwd"]', 'Cookies Are #Miam42');
|
|
||||||
|
|
||||||
await Promise.all([page.getByRole('button').click(), page.waitForURL('')]);
|
|
||||||
|
|
||||||
await expect(page.url()).toContain('');
|
|
||||||
});
|
|
Loading…
Add table
Reference in a new issue