mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-07-31 18:59:36 +02:00
chore: Remove unused imports and variables in settings and signup pages
This commit is contained in:
parent
41b019b610
commit
3076b78c97
4 changed files with 15 additions and 10 deletions
|
@ -1,6 +1,5 @@
|
||||||
<script>
|
<script>
|
||||||
import { enhance } from "$app/forms";
|
import { enhance } from "$app/forms";
|
||||||
import AdventureCard from "$lib/components/AdventureCard.svelte";
|
|
||||||
|
|
||||||
export let data;
|
export let data;
|
||||||
let username = data.user?.username;
|
let username = data.user?.username;
|
||||||
|
|
|
@ -2,9 +2,6 @@
|
||||||
import { page } from "$app/stores";
|
import { page } from "$app/stores";
|
||||||
|
|
||||||
import { enhance } from "$app/forms";
|
import { enhance } from "$app/forms";
|
||||||
import { goto } from "$app/navigation";
|
|
||||||
import { type SubmitFunction } from "@sveltejs/kit";
|
|
||||||
import type { DatabaseUser } from "lucia";
|
|
||||||
import UserCard from "$lib/components/UserCard.svelte";
|
import UserCard from "$lib/components/UserCard.svelte";
|
||||||
|
|
||||||
let username: string = "";
|
let username: string = "";
|
||||||
|
@ -13,8 +10,6 @@
|
||||||
let password: string = "";
|
let password: string = "";
|
||||||
import ConfirmModal from "$lib/components/ConfirmModal.svelte";
|
import ConfirmModal from "$lib/components/ConfirmModal.svelte";
|
||||||
|
|
||||||
let errors: { addUser?: string } = {};
|
|
||||||
let sucess: { addUser?: string } = {};
|
|
||||||
let isModalOpen = false;
|
let isModalOpen = false;
|
||||||
|
|
||||||
async function clearAllSessions() {
|
async function clearAllSessions() {
|
||||||
|
@ -35,8 +30,6 @@
|
||||||
isModalOpen = false;
|
isModalOpen = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let form = $page.form;
|
|
||||||
|
|
||||||
let visitCount = $page.data.visitCount[0].count;
|
let visitCount = $page.data.visitCount[0].count;
|
||||||
let userCount = $page.data.userCount[0].count;
|
let userCount = $page.data.userCount[0].count;
|
||||||
let regionCount = $page.data.regionCount[0].count;
|
let regionCount = $page.data.regionCount[0].count;
|
||||||
|
|
|
@ -31,6 +31,7 @@ export const actions: Actions = {
|
||||||
const password = formData.get("password");
|
const password = formData.get("password");
|
||||||
const firstName = formData.get("first_name");
|
const firstName = formData.get("first_name");
|
||||||
const lastName = formData.get("last_name");
|
const lastName = formData.get("last_name");
|
||||||
|
const confirmPassword = formData.get("passwordConfirm");
|
||||||
// username must be between 4 ~ 31 characters, and only consists of lowercase letters, 0-9, -, and _
|
// username must be between 4 ~ 31 characters, and only consists of lowercase letters, 0-9, -, and _
|
||||||
// keep in mind some database (e.g. mysql) are case insensitive
|
// keep in mind some database (e.g. mysql) are case insensitive
|
||||||
|
|
||||||
|
@ -38,7 +39,7 @@ export const actions: Actions = {
|
||||||
return redirect(302, "/");
|
return redirect(302, "/");
|
||||||
}
|
}
|
||||||
// check all to make sure all fields are provided
|
// check all to make sure all fields are provided
|
||||||
if (!username || !password || !firstName || !lastName) {
|
if (!username || !password || !firstName || !lastName || !confirmPassword) {
|
||||||
return error(400, {
|
return error(400, {
|
||||||
message: "All fields are required",
|
message: "All fields are required",
|
||||||
});
|
});
|
||||||
|
@ -84,6 +85,12 @@ export const actions: Actions = {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (password !== confirmPassword) {
|
||||||
|
return error(400, {
|
||||||
|
message: "Passwords do not match",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const usernameTaken = await db
|
const usernameTaken = await db
|
||||||
.select()
|
.select()
|
||||||
.from(userTable)
|
.from(userTable)
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
class="min-h-screen bg-no-repeat bg-cover flex items-center justify-center"
|
class="min-h-screen bg-no-repeat bg-cover flex items-center justify-center"
|
||||||
style="background-image: url('{backgroundImageUrl}')"
|
style="background-image: url('{backgroundImageUrl}')"
|
||||||
>
|
>
|
||||||
<div class="card card-compact w-96 bg-base-100 shadow-xl p-6">
|
<div class="card card-compact w-96 bg-base-100 shadow-xl p-6 mt-4 mb-4">
|
||||||
<article class="text-center text-4xl font-extrabold">
|
<article class="text-center text-4xl font-extrabold">
|
||||||
<h1>Signup</h1>
|
<h1>Signup</h1>
|
||||||
</article>
|
</article>
|
||||||
|
@ -70,6 +70,12 @@
|
||||||
name="password"
|
name="password"
|
||||||
id="password"
|
id="password"
|
||||||
class="block mb-2 input input-bordered w-full max-w-xs"
|
class="block mb-2 input input-bordered w-full max-w-xs"
|
||||||
|
/><br /><label for="password">Confirm Password</label>
|
||||||
|
<input
|
||||||
|
type="password"
|
||||||
|
name="passwordConfirm"
|
||||||
|
id="passwordConfirm"
|
||||||
|
class="block mb-2 input input-bordered w-full max-w-xs"
|
||||||
/><br />
|
/><br />
|
||||||
<button class="py-2 px-4 btn btn-primary">Signup</button>
|
<button class="py-2 px-4 btn btn-primary">Signup</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue