feat: add birthday field to register page

This commit is contained in:
limes
2026-08-17 23:25:17 +02:00
parent 1f5745d8a1
commit 09e08f44d0
3 changed files with 16 additions and 2 deletions

View File

@@ -5,6 +5,8 @@ export default defineEventHandler(async (event): Promise<ApiAuthLogin> => {
const body = await readZodBody(event, RegisterSchema);
const grpc = useApiGrpc(event);
console.log(body.birthday);
// eslint-disable-next-line no-useless-catch -- Temp before error handling is implemented
try {
// TODO Add ip
@@ -15,7 +17,7 @@ export default defineEventHandler(async (event): Promise<ApiAuthLogin> => {
captchaResponse: body.captchaResponse,
username: body.username,
password: body.password,
passwordConfirm: body.password
passwordConfirm: body.password,
});
return {

View File

@@ -100,6 +100,7 @@ export const RegisterSchema = z.object({
username: z.string(),
miiName: z.string(),
password: z.string(),
birthday: z.string(),
captchaResponse: z.string().optional()
});
export type ApiAuthRegisterRequest = z.infer<typeof RegisterSchema>;

View File

@@ -16,7 +16,7 @@ const loginURI = computed(() => {
return `/account/login`;
});
const registerForm = reactive({ email: '', username: '', mii_name: '', password: '', password_confirm: '' });
const registerForm = reactive({ email: '', username: '', mii_name: '', birthday: '', password: '', password_confirm: '' });
const captchaRef = useTemplateRef('captcha');
const { execute, isLoading } = useAsync({
@@ -36,6 +36,7 @@ const { execute, isLoading } = useAsync({
miiName: registerForm.mii_name,
password: registerForm.password,
username: registerForm.username,
birthday: registerForm.birthday,
captchaResponse: captchaResponse ?? undefined
} satisfies ApiAuthRegisterRequest
});
@@ -95,6 +96,16 @@ const { execute, isLoading } = useAsync({
required
>
</div>
<div>
<label for="mii_name">{{ $t("account.loginForm.birthdate") }}</label>
<input
id="birthday"
v-model="registerForm.birthday"
name="birthday"
type="date"
required
>
</div>
<div>
<label for="password">{{ $t("account.loginForm.password") }}</label>
<input