Add user icon field and update version number

This commit is contained in:
Sean Morley
2024-04-11 13:46:41 +00:00
parent a10f7485e0
commit 7decfd61e8
9 changed files with 249 additions and 3 deletions

View File

@@ -20,6 +20,7 @@ export const actions: Actions = {
let username = formData.get("username");
let firstName = formData.get("first_name");
let lastName = formData.get("last_name");
let icon = formData.get("icon");
let password = formData.get("password");
@@ -32,6 +33,15 @@ export const actions: Actions = {
};
}
if (icon.length > 1) {
return {
status: 400,
body: {
message: "Icon must be a single character"
}
};
}
if (password) {
let hashedPassword = await new Argon2id().hash(password);
console.log(hashedPassword)
@@ -47,6 +57,7 @@ export const actions: Actions = {
username: username,
first_name: firstName,
last_name: lastName,
icon: icon
})
.where(eq(userTable.id, userId));

View File

@@ -6,6 +6,7 @@
let first_name = data.user?.first_name;
let last_name = data.user?.last_name;
let user_id = data.user?.id;
let icon = data.user?.icon;
</script>
<h1 class="text-center font-extrabold text-4xl mb-6">Settings Page</h1>
@@ -37,6 +38,14 @@
id="last_name"
class="block mb-2 input input-bordered w-full max-w-xs"
/><br />
<label for="icon">Profile Icon (emoji)</label>
<input
type="emoji"
bind:value={icon}
name="icon"
id="icon"
class="block mb-2 input input-bordered w-full max-w-xs"
/><br />
<label for="password">Password</label>
<input
type="password"