Fix email parsing validation error?

This commit is contained in:
Owen
2026-01-19 16:45:15 -08:00
parent 6765d5ad26
commit 7ae6b2df05
2 changed files with 4 additions and 9 deletions

View File

@@ -23,15 +23,10 @@ const paramsSchema = z.strictObject({
const bodySchema = z.strictObject({
email: z
.string()
.email()
.toLowerCase()
.optional()
.refine((data) => {
if (data) {
return z.email().safeParse(data).success;
}
return true;
}),
.optional(),
username: z.string().nonempty().toLowerCase(),
name: z.string().optional(),
type: z.enum(["internal", "oidc"]).optional(),

View File

@@ -361,7 +361,7 @@ export default function Page() {
const res = await api
.put(`/org/${orgId}/user`, {
username: values.email, // Use email as username for Google/Azure
email: values.email,
email: values.email || undefined,
name: values.name,
type: "oidc",
idpId: selectedUserOption.idpId,
@@ -403,7 +403,7 @@ export default function Page() {
const res = await api
.put(`/org/${orgId}/user`, {
username: values.username,
email: values.email,
email: values.email || undefined,
name: values.name,
type: "oidc",
idpId: selectedUserOption.idpId,