mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-09 20:26:40 +00:00
Fix email parsing validation error?
This commit is contained in:
@@ -23,15 +23,10 @@ const paramsSchema = z.strictObject({
|
|||||||
|
|
||||||
const bodySchema = z.strictObject({
|
const bodySchema = z.strictObject({
|
||||||
email: z
|
email: z
|
||||||
|
.string()
|
||||||
.email()
|
.email()
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.optional()
|
.optional(),
|
||||||
.refine((data) => {
|
|
||||||
if (data) {
|
|
||||||
return z.email().safeParse(data).success;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}),
|
|
||||||
username: z.string().nonempty().toLowerCase(),
|
username: z.string().nonempty().toLowerCase(),
|
||||||
name: z.string().optional(),
|
name: z.string().optional(),
|
||||||
type: z.enum(["internal", "oidc"]).optional(),
|
type: z.enum(["internal", "oidc"]).optional(),
|
||||||
|
|||||||
@@ -361,7 +361,7 @@ export default function Page() {
|
|||||||
const res = await api
|
const res = await api
|
||||||
.put(`/org/${orgId}/user`, {
|
.put(`/org/${orgId}/user`, {
|
||||||
username: values.email, // Use email as username for Google/Azure
|
username: values.email, // Use email as username for Google/Azure
|
||||||
email: values.email,
|
email: values.email || undefined,
|
||||||
name: values.name,
|
name: values.name,
|
||||||
type: "oidc",
|
type: "oidc",
|
||||||
idpId: selectedUserOption.idpId,
|
idpId: selectedUserOption.idpId,
|
||||||
@@ -403,7 +403,7 @@ export default function Page() {
|
|||||||
const res = await api
|
const res = await api
|
||||||
.put(`/org/${orgId}/user`, {
|
.put(`/org/${orgId}/user`, {
|
||||||
username: values.username,
|
username: values.username,
|
||||||
email: values.email,
|
email: values.email || undefined,
|
||||||
name: values.name,
|
name: values.name,
|
||||||
type: "oidc",
|
type: "oidc",
|
||||||
idpId: selectedUserOption.idpId,
|
idpId: selectedUserOption.idpId,
|
||||||
|
|||||||
Reference in New Issue
Block a user