Adding favicon, restrict signup for now, fix seed and migration, and do not set email to empty string on signup.

This commit is contained in:
Bradley Shellnut 2024-03-02 15:53:02 -08:00
parent 24004c4533
commit 9324de4e74
8 changed files with 32 additions and 10 deletions

View file

@ -10,7 +10,8 @@ export default defineConfig({
port: Number(process.env.DATABASE_PORT) || 5432, port: Number(process.env.DATABASE_PORT) || 5432,
user: process.env.DATABASE_USER, user: process.env.DATABASE_USER,
password: process.env.DATABASE_PASSWORD, password: process.env.DATABASE_PASSWORD,
database: process.env.DATABASE || 'boredgame' database: process.env.DATABASE || 'boredgame',
ssl: true
}, },
// Print all statements // Print all statements
verbose: true, verbose: true,

View file

@ -4,7 +4,7 @@
<meta name="robots" content="noindex, nofollow" /> <meta name="robots" content="noindex, nofollow" />
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="description" content="Bored? Find a game! Bored Game!" /> <meta name="description" content="Bored? Find a game! Bored Game!" />
<link rel="icon" href="%sveltekit.assets%/favicon-bored.png" /> <link rel="icon" href="%sveltekit.assets%/favicon-bored-game.svg" />
<meta name="viewport" content="width=device-width" /> <meta name="viewport" content="width=device-width" />
<script> <script>
// const htmlElement = document.documentElement; // const htmlElement = document.documentElement;

View file

@ -5,7 +5,7 @@ import {
DATABASE_PASSWORD, DATABASE_PASSWORD,
DATABASE_HOST, DATABASE_HOST,
DATABASE_DB, DATABASE_DB,
DATABASE_PORT DATABASE_PORT,
} from '$env/static/private'; } from '$env/static/private';
import * as schema from '../schema'; import * as schema from '../schema';
@ -15,9 +15,16 @@ const pool = new pg.Pool({
password: DATABASE_PASSWORD, password: DATABASE_PASSWORD,
host: DATABASE_HOST, host: DATABASE_HOST,
port: Number(DATABASE_PORT).valueOf(), port: Number(DATABASE_PORT).valueOf(),
database: DATABASE_DB database: DATABASE_DB,
ssl: true,
}); });
// user: DATABASE_USER,
// password: DATABASE_PASSWORD,
// host: DATABASE_HOST,
// port: Number(DATABASE_PORT).valueOf(),
// database: DATABASE_DB
const db = drizzle(pool, { schema }); const db = drizzle(pool, { schema });
export default db; export default db;

View file

@ -5,7 +5,7 @@ import { migrate } from 'drizzle-orm/postgres-js/migrator';
const connection = postgres({ const connection = postgres({
host: process.env.DATABASE_HOST || 'localhost', host: process.env.DATABASE_HOST || 'localhost',
port: 3306, port: 5432,
user: process.env.DATABASE_USER || 'root', user: process.env.DATABASE_USER || 'root',
password: process.env.DATABASE_PASSWORD || '', password: process.env.DATABASE_PASSWORD || '',
database: process.env.DATABASE_DB || 'boredgame', database: process.env.DATABASE_DB || 'boredgame',

View file

@ -23,7 +23,7 @@ const signUpDefaults = {
}; };
export const load: PageServerLoad = async (event) => { export const load: PageServerLoad = async (event) => {
// redirect(302, '/waitlist', { type: 'error', message: 'Sign-up not yet available. Please add your email to the waitlist!' }, event); redirect(302, '/waitlist', { type: 'error', message: 'Sign-up not yet available. Please add your email to the waitlist!' }, event);
if (event.locals.user) { if (event.locals.user) {
const message = { type: 'success', message: 'You are already signed in' } as const; const message = { type: 'success', message: 'You are already signed in' } as const;
@ -39,7 +39,7 @@ export const load: PageServerLoad = async (event) => {
export const actions: Actions = { export const actions: Actions = {
default: async (event) => { default: async (event) => {
// fail(401, { message: 'Sign-up not yet available. Please add your email to the waitlist!' }); fail(401, { message: 'Sign-up not yet available. Please add your email to the waitlist!' });
const form = await superValidate(event, zod(signUpSchema)); const form = await superValidate(event, zod(signUpSchema));
if (!form.valid) { if (!form.valid) {
form.data.password = ''; form.data.password = '';
@ -70,7 +70,7 @@ export const actions: Actions = {
.values({ .values({
username: form.data.username, username: form.data.username,
hashed_password: hashedPassword, hashed_password: hashedPassword,
email: form.data.email || '', email: form.data.email,
first_name: form.data.firstName || '', first_name: form.data.firstName || '',
last_name: form.data.lastName || '', last_name: form.data.lastName || '',
verified: false, verified: false,

View file

@ -8,7 +8,7 @@
import { Button } from '$components/ui/button'; import { Button } from '$components/ui/button';
import { Label } from '$components/ui/label'; import { Label } from '$components/ui/label';
import { Input } from '$components/ui/input'; import { Input } from '$components/ui/input';
import { signUpSchema } from '$lib/validations/zod-schemas.js'; import { signUpSchema } from '$lib/validations/auth';
import * as Collapsible from '$lib/components/ui/collapsible'; import * as Collapsible from '$lib/components/ui/collapsible';
import * as Alert from '$lib/components/ui/alert'; import * as Alert from '$lib/components/ui/alert';
import { boredState } from '$lib/stores/boredState.js'; import { boredState } from '$lib/stores/boredState.js';

View file

@ -9,7 +9,8 @@ const pool = new pg.Pool({
password: process.env.DATABASE_PASSWORD, password: process.env.DATABASE_PASSWORD,
host: process.env.DATABASE_HOST, host: process.env.DATABASE_HOST,
port: new Number(process.env.DATABASE_PORT).valueOf(), port: new Number(process.env.DATABASE_PORT).valueOf(),
database: process.env.DATABASE_DB database: process.env.DATABASE_DB,
ssl: true,
}); });
const db = drizzle(pool, { schema: schema }); const db = drizzle(pool, { schema: schema });

View file

@ -0,0 +1,13 @@
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-go-game" width="24" height="24" viewBox="0 0 24 24" stroke-width="1" stroke="#ffff" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
<path d="M6 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0" />
<path d="M12 12m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0" />
<path d="M6 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0" />
<path d="M18 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0" />
<path d="M3 12h7m4 0h7" />
<path d="M3 6h1m4 0h13" />
<path d="M3 18h1m4 0h8m4 0h1" />
<path d="M6 3v1m0 4v8m0 4v1" />
<path d="M12 3v7m0 4v7" />
<path d="M18 3v13m0 4v1" />
</svg>

After

Width:  |  Height:  |  Size: 710 B