make email lower case in pangctl reset password closes #1210

This commit is contained in:
miloschwartz 2025-08-13 21:59:32 -07:00
parent eeb1d4954d
commit 74d2527af5
No known key found for this signature in database
2 changed files with 17 additions and 11 deletions

View file

@ -6,12 +6,15 @@ type ResetUserSecurityKeysArgs = {
email: string; email: string;
}; };
export const resetUserSecurityKeys: CommandModule<{}, ResetUserSecurityKeysArgs> = { export const resetUserSecurityKeys: CommandModule<
{},
ResetUserSecurityKeysArgs
> = {
command: "reset-user-security-keys", command: "reset-user-security-keys",
describe: "Reset a user's security keys (passkeys) by deleting all their webauthn credentials", describe:
"Reset a user's security keys (passkeys) by deleting all their webauthn credentials",
builder: (yargs) => { builder: (yargs) => {
return yargs return yargs.option("email", {
.option("email", {
type: "string", type: "string",
demandOption: true, demandOption: true,
describe: "User email address" describe: "User email address"
@ -48,7 +51,9 @@ export const resetUserSecurityKeys: CommandModule<{}, ResetUserSecurityKeysArgs>
process.exit(0); process.exit(0);
} }
console.log(`Found ${userSecurityKeys.length} security key(s) for user '${email}'`); console.log(
`Found ${userSecurityKeys.length} security key(s) for user '${email}'`
);
// Delete all security keys for the user // Delete all security keys for the user
await db await db

View file

@ -32,7 +32,8 @@ export const setAdminCredentials: CommandModule<{}, SetAdminCredentialsArgs> = {
}, },
handler: async (argv: { email: string; password: string }) => { handler: async (argv: { email: string; password: string }) => {
try { try {
const { email, password } = argv; let { email, password } = argv;
email = email.trim().toLowerCase();
const parsed = passwordSchema.safeParse(password); const parsed = passwordSchema.safeParse(password);