Compare commits

...

2 Commits

Author SHA1 Message Date
afd3541d4d trim all text inputs on signup actions
All checks were successful
deploy / build-and-deploy (/testvaro, /opt/website-test, website-test) (push) Successful in 22s
deploy / build-and-deploy (/varo, /opt/website, website) (push) Successful in 23s
2025-06-09 21:36:45 +02:00
e770a72f9d fix admin panel user add having an invalid id 2025-06-09 20:42:37 +02:00
2 changed files with 7 additions and 7 deletions

View File

@ -7,18 +7,18 @@ import { getSetting, SettingKey } from '@util/settings.ts';
export const signup = { export const signup = {
signup: defineAction({ signup: defineAction({
input: z.object({ input: z.object({
firstname: z.string().min(2), firstname: z.string().trim().min(2),
lastname: z.string().min(2), lastname: z.string().trim().min(2),
// this will be inaccurate as it is evaluated only once // this will be inaccurate as it is evaluated only once
birthday: z birthday: z
.string() .string()
.date() .date()
.max(Date.now() - 1000 * 60 * 60 * 24 * 365 * 6), .max(Date.now() - 1000 * 60 * 60 * 24 * 365 * 6),
phone: z.string().nullable(), phone: z.string().trim().nullable(),
username: z.string(), username: z.string().trim(),
teamMember: z.string(), teamMember: z.string().trim(),
teamName: z.string().nullable() teamName: z.string().trim().nullable()
}), }),
handler: async (input) => { handler: async (input) => {
// check if signup is allowed // check if signup is allowed

View File

@ -35,7 +35,7 @@ export async function addUser(user: User) {
return; return;
} }
addToWritableArray(users, user); addToWritableArray(users, Object.assign(user, { id: data.id }));
} }
export async function editUser(user: User) { export async function editUser(user: User) {