This commit is contained in:
8
src/routes/register/+page.server.ts
Normal file
8
src/routes/register/+page.server.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import type { PageServerLoad } from './$types';
|
||||
import { Settings } from '$lib/server/database';
|
||||
|
||||
export const load: PageServerLoad = async () => {
|
||||
return {
|
||||
enabled: (await Settings.findOne({ where: { key: 'register.enabled' } }))?.value ?? true
|
||||
};
|
||||
};
|
||||
@@ -2,9 +2,12 @@
|
||||
import { fly } from 'svelte/transition';
|
||||
import RegistrationComplete from './RegistrationComplete.svelte';
|
||||
import Register from './Register.svelte';
|
||||
import type { PageData } from './$types';
|
||||
|
||||
let registered = false;
|
||||
let username: string | null = null;
|
||||
|
||||
export let data: PageData;
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
@@ -13,9 +16,16 @@
|
||||
|
||||
<!--the tooltip when not all fields are correctly filled won't completely show if the overflow is hidden-->
|
||||
<div
|
||||
class="grid card w-11/12 xl:w-2/3 2xl:w-1/2 p-6 my-12 bg-base-100 shadow-lg h-min"
|
||||
class="relative grid card w-11/12 xl:w-2/3 2xl:w-1/2 p-6 my-12 bg-base-100 shadow-lg h-min"
|
||||
class:overflow-hidden={registered}
|
||||
>
|
||||
{#if !data.enabled}
|
||||
<div
|
||||
class="absolute top-0 left-0 w-full h-full bg-black bg-opacity-50 backdrop-blur-sm z-50 rounded-xl flex justify-center md:items-center pt-20 md:pt-0"
|
||||
>
|
||||
<h1 class="text-2xl sm:text-3xl md:text-5xl text-white">Anmeldung geschlossen</h1>
|
||||
</div>
|
||||
{/if}
|
||||
{#if !registered}
|
||||
<div class="col-[1] row-[1]" transition:fly={{ x: -200, duration: 300 }}>
|
||||
<Register
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
import { ApiError, getJavaUuid, getNoAuthUuid, UserNotFoundError } from '$lib/server/minecraft';
|
||||
import { error, type RequestHandler } from '@sveltejs/kit';
|
||||
import { User } from '$lib/server/database';
|
||||
import { Settings, User } from '$lib/server/database';
|
||||
|
||||
export const POST = (async ({ request }) => {
|
||||
if ((await Settings.findOne({ where: { key: 'register.enabled' } }))?.value === false) {
|
||||
throw error(400, 'Anmeldung geschlossen');
|
||||
}
|
||||
|
||||
const data = await request.formData();
|
||||
const firstname = data.get('firstname') as string | null;
|
||||
const lastname = data.get('lastname') as string | null;
|
||||
|
||||
Reference in New Issue
Block a user