adds email confirmation

This commit is contained in:
Christian Beutel
2025-04-11 14:13:18 +02:00
parent 72d3428d5f
commit 5790da2317
14 changed files with 85 additions and 6 deletions

View File

@@ -237,7 +237,7 @@
{formatSpeed(options.autoOptions.top_speed! / 3.6)}
</p>
<hr class="border-input-border my-3" />
<p class="text-sm font-medium">{$_("width")}</p>
<p class="text-sm font-medium">{$_("car")} {$_("width")}</p>
<Slider
minValue={1}
maxValue={10}
@@ -248,7 +248,7 @@
{options.autoOptions.width?.toFixed(1)}
</p>
<hr class="border-input-border my-3" />
<p class="text-sm font-medium">{$_("height")}</p>
<p class="text-sm font-medium">{$_("car")} {$_("height")}</p>
<Slider
minValue={1}
maxValue={10}

View File

@@ -32,6 +32,7 @@
"by": "von",
"can": "kann",
"cancel": "Abbrechen",
"car": "",
"card": "{n, plural, =1 {Karte} other {Karten}}",
"categories": "Kategorien",
"category": "Kategorie",
@@ -96,6 +97,7 @@
"elevation-loss": "Höhenunterschied (abw.)",
"email": "Email",
"email-updated": "E-Mail aktualisiert",
"email-verified": "",
"empty-activities": "{username} hat noch keine Aktivitäten",
"empty-bio": "{username} hat noch keine Biographie hinzugefügt",
"empty-lists": "{username} hat keine öffentlichen Listen",
@@ -149,6 +151,7 @@
"hero_section_1_text_alternative": "Speichere dein letztes Abenteuer, um loszulegen.",
"hero_section_2_text": "Wusstest du schon? Du kannst nicht nur deine Routen speichern. Es gibt viele Kategorien für alle deine Abenteuer.",
"hiking": "Wandern",
"home": "",
"hungarian": "Ungarisch",
"hybrid": "",
"icon": "Icon",

View File

@@ -32,6 +32,7 @@
"by": "by",
"can": "can",
"cancel": "Cancel",
"car": "Car",
"card": "{n, plural, =1 {Card} other {Cards}}",
"categories": "Categories",
"category": "Category",
@@ -96,6 +97,7 @@
"elevation-loss": "Elevation Loss",
"email": "Email",
"email-updated": "Email updated",
"email-verified": "Email verified",
"empty-activities": "{username} has no activity yet",
"empty-bio": "{username} has not added a bio yet",
"empty-lists": "{username} has no public lists",
@@ -149,6 +151,7 @@
"hero_section_1_text_alternative": "Get started by saving your latest adventure.",
"hero_section_2_text": "Did you know? You cannot only save you hiking trails. There are many categories for all your adventures.",
"hiking": "Hiking",
"home": "Home",
"hungarian": "Hungarian",
"hybrid": "Hybrid",
"icon": "Icon",

View File

@@ -32,6 +32,7 @@
"by": "de",
"can": "puede",
"cancel": "Borrar",
"car": "",
"card": "{n, plural, one {}=1 {Ficha} other {Fichas}}",
"categories": "Categorías",
"category": "Categoría",
@@ -96,6 +97,7 @@
"elevation-loss": "Descenso",
"email": "Correo electrónico",
"email-updated": "Correo electrónico actualizado",
"email-verified": "",
"empty-activities": "{username} todavía no tiene actividad",
"empty-bio": "{username} no ha añadido ninguna Bio todavía",
"empty-lists": "{username} no tiene listas públicas",
@@ -149,6 +151,7 @@
"hero_section_1_text_alternative": "Empieza guardando tu última aventuras.",
"hero_section_2_text": "¿Lo sabías? No solo puedes guardar tus rutas de senderismo. Hay muchas categorías para todas tus aventuras.",
"hiking": "Senderismo",
"home": "",
"hungarian": "Húngaro",
"hybrid": "",
"icon": "Icono",

View File

@@ -32,6 +32,7 @@
"by": "par",
"can": "peut",
"cancel": "Annuler",
"car": "",
"card": "{n, plural, =1 {Tuile} other {Tuiles}}",
"categories": "Catégories",
"category": "Catégorie",
@@ -96,6 +97,7 @@
"elevation-loss": "Dénivelé négatif",
"email": "Email",
"email-updated": "Adresse mail mise à jour",
"email-verified": "",
"empty-activities": "{username} n'a encore aucune activité",
"empty-bio": "{username} n'a pas encore de description",
"empty-lists": "{username} n'a pas de liste publique",
@@ -149,6 +151,7 @@
"hero_section_1_text_alternative": "Commencez par enregistrer votre dernière aventure.",
"hero_section_2_text": "Saviez-vous que vous pouvez sauvegarder plus que vos randonnées ? De nombreuses catégories sont disponibles pour toutes vos aventures.",
"hiking": "Randonnée",
"home": "",
"hungarian": "Hongrois",
"hybrid": "",
"icon": "Icône",

View File

@@ -32,6 +32,7 @@
"by": "by",
"can": "can",
"cancel": "Mégsem",
"car": "",
"card": "{n, plural, =1 {Kártya} other {Kártyák}}",
"categories": "Kategóriák",
"category": "Kategória",
@@ -96,6 +97,7 @@
"elevation-loss": "Elevation Loss",
"email": "Email",
"email-updated": "Email updated",
"email-verified": "",
"empty-activities": "{username} has no activity yet",
"empty-bio": "{username} has not added a bio yet",
"empty-lists": "{username} has no public lists",
@@ -149,6 +151,7 @@
"hero_section_1_text_alternative": "Kezdje a legújabb kaland elmentésével.",
"hero_section_2_text": "Tudta? Nem csak a túraútvonalakat mentheti el. Számos kategória létezik minden kalandodhoz.",
"hiking": "Hiking",
"home": "",
"hungarian": "Magyar",
"hybrid": "",
"icon": "Ikon",

View File

@@ -32,6 +32,7 @@
"by": "di",
"can": "può",
"cancel": "Annulla",
"car": "",
"card": "{n, plural, =1 {Carta} other {Carte}}",
"categories": "Categorie",
"category": "Categoria",
@@ -96,6 +97,7 @@
"elevation-loss": "Perdita di quota",
"email": "Email",
"email-updated": "Indirizzo email aggiornato",
"email-verified": "",
"empty-activities": "{username} non ha ancora attività",
"empty-bio": "{username} non ha ancora aggiunto una biografia",
"empty-lists": "{username} non ha liste pubbliche",
@@ -149,6 +151,7 @@
"hero_section_1_text_alternative": "Inizia salvando la tua ultima avventura.",
"hero_section_2_text": "Lo sapevi? Non puoi salvare solo i tuoi percorsi. Ci sono molte categorie per tutte le tue avventure.",
"hiking": "Escursionismo",
"home": "",
"hungarian": "Ungherese",
"hybrid": "",
"icon": "Icona",

View File

@@ -32,6 +32,7 @@
"by": "by",
"can": "can",
"cancel": "Annuleren",
"car": "",
"card": "{n, plural, =1 {kaart} other {kaarten}}",
"categories": "Categorieën",
"category": "Categorie",
@@ -96,6 +97,7 @@
"elevation-loss": "Elevation Loss",
"email": "E-mail",
"email-updated": "Email updated",
"email-verified": "",
"empty-activities": "{username} has no activity yet",
"empty-bio": "{username} has not added a bio yet",
"empty-lists": "{username} has no public lists",
@@ -149,6 +151,7 @@
"hero_section_1_text_alternative": "Bewaar je recentste avontuur om aan de slag te gaan.",
"hero_section_2_text": "Wist je dat…? Je kunt niet alleen wandelroutes opslaan: er zijn ook categorieën voor andere avonturen.",
"hiking": "Hiking",
"home": "",
"hungarian": "Hongaars",
"hybrid": "",
"icon": "Pictogram",

View File

@@ -32,6 +32,7 @@
"by": "przez",
"can": "może",
"cancel": "Anuluj",
"car": "",
"card": "{n, plural, =1 {Karta} other {Karty}}",
"categories": "Kategorie",
"category": "Kategoria",
@@ -96,6 +97,7 @@
"elevation-loss": "Strata wysokości",
"email": "E-mail",
"email-updated": "Email zaktualizowany",
"email-verified": "",
"empty-activities": "{username} nie ma jeszcze aktywności",
"empty-bio": "{username} jeszcze nie dodał biogramu",
"empty-lists": "{username} nie ma publicznych list",
@@ -149,6 +151,7 @@
"hero_section_1_text_alternative": "Zacznij poprzez zapisanie swojej ostatniej wyprawy.",
"hero_section_2_text": "Czy wiesz że, możesz zapisywać nie tylko piesze wycieczki ale także inne kategorie wypraw?",
"hiking": "Wędrówka",
"home": "",
"hungarian": "Język węgierski",
"hybrid": "",
"icon": "Ikona",

View File

@@ -32,6 +32,7 @@
"by": "by",
"can": "pode",
"cancel": "Cancelar",
"car": "",
"card": "{n, plural, =1 {Cartão} other {Cartões}}",
"categories": "Categorias",
"category": "Categoria",
@@ -96,6 +97,7 @@
"elevation-loss": "Perda de elevação",
"email": "Correio eletrónico",
"email-updated": "Email updated",
"email-verified": "",
"empty-activities": "{username} has no activity yet",
"empty-bio": "{username} has not added a bio yet",
"empty-lists": "{username} has no public lists",
@@ -149,6 +151,7 @@
"hero_section_1_text_alternative": "Comece salvando sua última aventura.",
"hero_section_2_text": "Sabias? Você não pode apenas salvá-lo trilhas de caminhada. Há muitas categorias para todas as suas aventuras.",
"hiking": "Montanhismo",
"home": "",
"hungarian": "Húngaro",
"hybrid": "",
"icon": "Ícone",

View File

@@ -32,6 +32,7 @@
"by": "by",
"can": "可以",
"cancel": "取消",
"car": "",
"card": "{n, plural, =1 {卡片} other {卡片}}",
"categories": "分类",
"category": "分类",
@@ -96,6 +97,7 @@
"elevation-loss": "下降海拔",
"email": "电子邮箱",
"email-updated": "Email updated",
"email-verified": "",
"empty-activities": "{username} has no activity yet",
"empty-bio": "{username} has not added a bio yet",
"empty-lists": "{username} has no public lists",
@@ -149,6 +151,7 @@
"hero_section_1_text_alternative": "即刻开始规划您最新的冒险。",
"hero_section_2_text": "你知道吗?这里不仅仅可以收藏你的登山路线,还能为您的所有冒险放到相应的类别里面。",
"hiking": "徒步",
"home": "",
"hungarian": "匈牙利语",
"hybrid": "",
"icon": "图标",

View File

@@ -1,16 +1,24 @@
import { env } from '$env/dynamic/public';
import { UserCreateSchema } from '$lib/models/api/user_schema';
import type { User } from '$lib/models/user';
import { pb } from '$lib/pocketbase';
import { Collection, create, handleError } from '$lib/util/api_util';
import { json, type RequestEvent } from '@sveltejs/kit';
import { ClientResponseError } from 'pocketbase';
export async function PUT(event: RequestEvent) {
try {
if (env.PUBLIC_DISABLE_SIGNUP === "true") {
throw new ClientResponseError({ status: 401, response: { messgage: "Forbidden" } })
}
const r = await create<User>(event, UserCreateSchema, Collection.users)
try {
const data = await event.request.json();
const safeData = UserCreateSchema.parse(data);
const r = await pb.collection(Collection.users).create<User>(safeData)
await pb.collection('users').requestVerification(safeData.email);
return json(r);
} catch (e: any) {

View File

@@ -0,0 +1,20 @@
import { pb } from "$lib/pocketbase";
import { Collection } from "$lib/util/api_util";
import { error, type ServerLoad } from "@sveltejs/kit";
import { ClientResponseError } from "pocketbase";
export const load: ServerLoad = async ({ params, locals, url, fetch }) => {
if (!params.token) {
error(400, "Invalid token")
}
try {
await pb.collection(Collection.users).confirmVerification(params.token)
} catch (e) {
if (e instanceof ClientResponseError) {
error(400, e.message);
} else {
throw e;
}
}
};

View File

@@ -0,0 +1,21 @@
<script lang="ts">
import { _ } from "svelte-i18n";
</script>
<svelte:head>
<title>{$_("email-verified")} | wanderer</title>
</svelte:head>
<main class="flex justify-center items-start">
<div
class="max-w-md border border-input-border rounded-xl p-8 flex flex-col justify-center items-center gap-4 w-[28rem] mt-8"
>
<i class="fa fa-check-circle text-emerald-400 text-7xl"></i>
<h4 class="text-xl font-semibold">{$_("email-verified")}</h4>
<div class="space-y-6 w-80">
<p class="text-center">
Thank you, your email was verified. Enjoy using wanderer!
</p>
</div>
<a class="btn-primary mt-4" href="/">{$_("home")}</a>
</div>
</main>