mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-04 09:46:40 +00:00
make username lowercase
This commit is contained in:
@@ -23,8 +23,8 @@ export const loginBodySchema = z
|
|||||||
.object({
|
.object({
|
||||||
email: z
|
email: z
|
||||||
.string()
|
.string()
|
||||||
.email()
|
.toLowerCase()
|
||||||
.transform((v) => v.toLowerCase()),
|
.email(),
|
||||||
password: z.string(),
|
password: z.string(),
|
||||||
code: z.string().optional()
|
code: z.string().optional()
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ export const requestPasswordResetBody = z
|
|||||||
.object({
|
.object({
|
||||||
email: z
|
email: z
|
||||||
.string()
|
.string()
|
||||||
.email()
|
.toLowerCase()
|
||||||
.transform((v) => v.toLowerCase())
|
.email(),
|
||||||
})
|
})
|
||||||
.strict();
|
.strict();
|
||||||
|
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ export const resetPasswordBody = z
|
|||||||
.object({
|
.object({
|
||||||
email: z
|
email: z
|
||||||
.string()
|
.string()
|
||||||
.email()
|
.toLowerCase()
|
||||||
.transform((v) => v.toLowerCase()),
|
.email(),
|
||||||
token: z.string(), // reset secret code
|
token: z.string(), // reset secret code
|
||||||
newPassword: passwordSchema,
|
newPassword: passwordSchema,
|
||||||
code: z.string().optional() // 2fa code
|
code: z.string().optional() // 2fa code
|
||||||
|
|||||||
@@ -26,8 +26,8 @@ import { UserType } from "@server/types/UserTypes";
|
|||||||
export const signupBodySchema = z.object({
|
export const signupBodySchema = z.object({
|
||||||
email: z
|
email: z
|
||||||
.string()
|
.string()
|
||||||
.email()
|
.toLowerCase()
|
||||||
.transform((v) => v.toLowerCase()),
|
.email(),
|
||||||
password: passwordSchema,
|
password: passwordSchema,
|
||||||
inviteToken: z.string().optional(),
|
inviteToken: z.string().optional(),
|
||||||
inviteId: z.string().optional()
|
inviteId: z.string().optional()
|
||||||
|
|||||||
@@ -172,10 +172,10 @@ export async function validateOidcCallback(
|
|||||||
const claims = arctic.decodeIdToken(idToken);
|
const claims = arctic.decodeIdToken(idToken);
|
||||||
logger.debug("ID token claims", { claims });
|
logger.debug("ID token claims", { claims });
|
||||||
|
|
||||||
const userIdentifier = jmespath.search(
|
let userIdentifier = jmespath.search(
|
||||||
claims,
|
claims,
|
||||||
existingIdp.idpOidcConfig.identifierPath
|
existingIdp.idpOidcConfig.identifierPath
|
||||||
);
|
) as string | null;
|
||||||
|
|
||||||
if (!userIdentifier) {
|
if (!userIdentifier) {
|
||||||
return next(
|
return next(
|
||||||
@@ -186,6 +186,8 @@ export async function validateOidcCallback(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
userIdentifier = userIdentifier.toLowerCase();
|
||||||
|
|
||||||
logger.debug("User identifier", { userIdentifier });
|
logger.debug("User identifier", { userIdentifier });
|
||||||
|
|
||||||
let email = null;
|
let email = null;
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ const authWithWhitelistBodySchema = z
|
|||||||
.object({
|
.object({
|
||||||
email: z
|
email: z
|
||||||
.string()
|
.string()
|
||||||
.email()
|
.toLowerCase()
|
||||||
.transform((v) => v.toLowerCase()),
|
.email(),
|
||||||
otp: z.string().optional()
|
otp: z.string().optional()
|
||||||
})
|
})
|
||||||
.strict();
|
.strict();
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ const bodySchema = z
|
|||||||
.object({
|
.object({
|
||||||
email: z
|
email: z
|
||||||
.string()
|
.string()
|
||||||
|
.toLowerCase()
|
||||||
.optional()
|
.optional()
|
||||||
.refine((data) => {
|
.refine((data) => {
|
||||||
if (data) {
|
if (data) {
|
||||||
@@ -28,7 +29,7 @@ const bodySchema = z
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}),
|
}),
|
||||||
username: z.string().nonempty(),
|
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(),
|
||||||
idpId: z.number().optional(),
|
idpId: z.number().optional(),
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ const inviteUserBodySchema = z
|
|||||||
.object({
|
.object({
|
||||||
email: z
|
email: z
|
||||||
.string()
|
.string()
|
||||||
.email()
|
.toLowerCase()
|
||||||
.transform((v) => v.toLowerCase()),
|
.email(),
|
||||||
roleId: z.number(),
|
roleId: z.number(),
|
||||||
validHours: z.number().gt(0).lte(168),
|
validHours: z.number().gt(0).lte(168),
|
||||||
sendEmail: z.boolean().optional(),
|
sendEmail: z.boolean().optional(),
|
||||||
|
|||||||
Reference in New Issue
Block a user