Skip to content

A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!

- normalize username and email fields to lowercase, resolves #1740 - add autoComplete attributes to auth flow for easier sign in/sign up

Amruth Pillai89a44cc33a84
diff --git a/apps/client/src/pages/auth/backup-otp/page.tsx b/apps/client/src/pages/auth/backup-otp/page.tsx
index 9730a2510..606f76024 100644
--- a/apps/client/src/pages/auth/backup-otp/page.tsx
+++ b/apps/client/src/pages/auth/backup-otp/page.tsx
@@ -77,6 +77,7 @@ export const BackupOtpPage = () => {
<Input
pattern="[a-z0-9]{10}"
placeholder="a1b2c3d4e5"
+ autoComplete="one-time-code"
title={t`Backup Codes may contain only lowercase letters or numbers, and must be exactly 10 characters.`}
{...field}
/>
diff --git a/apps/client/src/pages/auth/forgot-password/page.tsx b/apps/client/src/pages/auth/forgot-password/page.tsx
index 6d34edd13..ebad0d6d5 100644
--- a/apps/client/src/pages/auth/forgot-password/page.tsx
+++ b/apps/client/src/pages/auth/forgot-password/page.tsx
@@ -81,7 +81,7 @@ export const ForgotPasswordPage = () => {
<FormItem>
<FormLabel>{t`Email`}</FormLabel>
<FormControl>
- <Input placeholder="[email protected]" {...field} />
+ <Input placeholder="[email protected]" autoComplete="email" {...field} />
</FormControl>
<FormMessage />
</FormItem>
diff --git a/apps/client/src/pages/auth/login/page.tsx b/apps/client/src/pages/auth/login/page.tsx
index 557e71090..708895aa7 100644
--- a/apps/client/src/pages/auth/login/page.tsx
+++ b/apps/client/src/pages/auth/login/page.tsx
@@ -89,7 +89,12 @@ export const LoginPage = () => {
<FormItem>
<FormLabel>{t`Email`}</FormLabel>
<FormControl>
- <Input placeholder="[email protected]" {...field} />
+ <Input
+ autoComplete="email"
+ className="lowercase"
+ placeholder="[email protected]"
+ {...field}
+ />
</FormControl>
<FormDescription>{t`You can also enter your username.`}</FormDescription>
<FormMessage />
@@ -104,7 +109,7 @@ export const LoginPage = () => {
<FormItem>
<FormLabel>{t`Password`}</FormLabel>
<FormControl>
- <Input type="password" {...field} />
+ <Input type="password" autoComplete="password" {...field} />
</FormControl>
<FormDescription>
<Trans>
diff --git a/apps/client/src/pages/auth/register/page.tsx b/apps/client/src/pages/auth/register/page.tsx
index f5a8dc32a..5e7fe1fbb 100644
--- a/apps/client/src/pages/auth/register/page.tsx
+++ b/apps/client/src/pages/auth/register/page.tsx
@@ -119,6 +119,7 @@ export const RegisterPage = () => {
<FormLabel>{t`Username`}</FormLabel>
<FormControl>
<Input
+ className="lowercase"
placeholder={t({
message: "john.doe",
context:
@@ -140,6 +141,7 @@ export const RegisterPage = () => {
<FormLabel>{t`Email`}</FormLabel>
<FormControl>
<Input
+ className="lowercase"
placeholder={t({
message: "[email protected]",
context:
diff --git a/apps/client/src/pages/auth/reset-password/page.tsx b/apps/client/src/pages/auth/reset-password/page.tsx
index 805d6dfcb..ed138eb9a 100644
--- a/apps/client/src/pages/auth/reset-password/page.tsx
+++ b/apps/client/src/pages/auth/reset-password/page.tsx
@@ -82,7 +82,7 @@ export const ResetPasswordPage = () => {
<FormItem>
<FormLabel>{t`Password`}</FormLabel>
<FormControl>
- <Input type="password" {...field} />
+ <Input type="password" autoComplete="new-password" {...field} />
</FormControl>
<FormDescription>
<Trans>
diff --git a/apps/client/src/pages/auth/verify-otp/page.tsx b/apps/client/src/pages/auth/verify-otp/page.tsx
index bbae6ca52..2ad06bcf0 100644
--- a/apps/client/src/pages/auth/verify-otp/page.tsx
+++ b/apps/client/src/pages/auth/verify-otp/page.tsx
@@ -81,7 +81,7 @@ export const VerifyOtpPage = () => {
<FormItem>
<FormLabel>{t`One-Time Password`}</FormLabel>
<FormControl>
- <Input placeholder="123456" {...field} />
+ <Input placeholder="123456" autoComplete="one-time-code" {...field} />
</FormControl>
<FormMessage />
</FormItem>
diff --git a/apps/client/src/pages/dashboard/settings/_sections/account.tsx b/apps/client/src/pages/dashboard/settings/_sections/account.tsx
index 3fab2e18b..6e9049642 100644
--- a/apps/client/src/pages/dashboard/settings/_sections/account.tsx
+++ b/apps/client/src/pages/dashboard/settings/_sections/account.tsx
@@ -151,7 +151,7 @@ export const AccountSettings = () => {
<FormItem>
<FormLabel>{t`Name`}</FormLabel>
<FormControl>
- <Input {...field} />
+ <Input autoComplete="name" {...field} />
</FormControl>
<FormMessage />
</FormItem>
@@ -165,7 +165,7 @@ export const AccountSettings = () => {
<FormItem>
<FormLabel>{t`Username`}</FormLabel>
<FormControl>
- <Input {...field} />
+ <Input autoComplete="username" className="lowercase" {...field} />
</FormControl>
<FormMessage />
</FormItem>
@@ -179,7 +179,7 @@ export const AccountSettings = () => {
<FormItem>
<FormLabel>{t`Email`}</FormLabel>
<FormControl>
- <Input type="email" {...field} />
+ <Input type="email" autoComplete="email" className="lowercase" {...field} />
</FormControl>
<FormDescription
className={cn(
diff --git a/apps/client/src/pages/dashboard/settings/_sections/security.tsx b/apps/client/src/pages/dashboard/settings/_sections/security.tsx
index 34b292791..87761705e 100644
--- a/apps/client/src/pages/dashboard/settings/_sections/security.tsx
+++ b/apps/client/src/pages/dashboard/settings/_sections/security.tsx
@@ -84,7 +84,7 @@ export const SecuritySettings = () => {
<FormItem>
<FormLabel>{t`New Password`}</FormLabel>
<FormControl>
- <Input type="password" {...field} />
+ <Input type="password" autoComplete="new-password" {...field} />
</FormControl>
</FormItem>
)}
@@ -97,7 +97,7 @@ export const SecuritySettings = () => {
<FormItem>
<FormLabel>{t`Confirm New Password`}</FormLabel>
<FormControl>
- <Input type="password" {...field} />
+ <Input type="password" autoComplete="new-password" {...field} />
</FormControl>
{fieldState.error && (
<FormDescription className="text-error-foreground">
diff --git a/apps/client/src/pages/home/sections/statistics/index.tsx b/apps/client/src/pages/home/sections/statistics/index.tsx
index 796847e07..b939134ee 100644
--- a/apps/client/src/pages/home/sections/statistics/index.tsx
+++ b/apps/client/src/pages/home/sections/statistics/index.tsx
@@ -9,9 +9,9 @@ type Statistic = {
export const StatisticsSection = () => {
const stats: Statistic[] = [
- { name: t`GitHub Stars`, value: 19_500 },
- { name: t`Users Signed Up`, value: 500_000 },
- { name: t`Resumes Generated`, value: 700_000 },
+ { name: t`GitHub Stars`, value: 27_000 },
+ { name: t`Users Signed Up`, value: 650_000 },
+ { name: t`Resumes Generated`, value: 840_000 },
];
return (
diff --git a/libs/dto/src/auth/login.ts b/libs/dto/src/auth/login.ts
index befb89570..d859f8b87 100644
--- a/libs/dto/src/auth/login.ts
+++ b/libs/dto/src/auth/login.ts
@@ -5,7 +5,7 @@ import { usernameSchema } from "../user";
export const loginSchema = z
.object({
- identifier: z.string(),
+ identifier: z.string().transform((value) => value.toLowerCase()),
password: z.password().min(6),
})
.refine(
diff --git a/libs/dto/src/user/user.ts b/libs/dto/src/user/user.ts
index 36e99fd7f..14dec495d 100644
--- a/libs/dto/src/user/user.ts
+++ b/libs/dto/src/user/user.ts
@@ -8,17 +8,20 @@ export const usernameSchema = z
.string()
.min(3)
.max(255)
- .regex(/^[\d._a-z-]+$/, {
- message:
- "Usernames can only contain lowercase letters, numbers, periods, hyphens, and underscores.",
- });
+ .regex(/^[\w.-]+$/, {
+ message: "Usernames can only contain letters, numbers, periods, hyphens, and underscores.",
+ })
+ .transform((value) => value.toLowerCase());
export const userSchema = z.object({
id: idSchema,
name: z.string().min(1).max(255),
picture: z.literal("").or(z.null()).or(z.string().url()),
username: usernameSchema,
- email: z.string().email(),
+ email: z
+ .string()
+ .email()
+ .transform((value) => value.toLowerCase()),
locale: z.string().default("en-US"),
emailVerified: z.boolean().default(false),
twoFactorEnabled: z.boolean().default(false),
diff --git a/tools/prisma/migrations/20250112140257_normalize_user_email_fields/migration.sql b/tools/prisma/migrations/20250112140257_normalize_user_email_fields/migration.sql
new file mode 100644
index 000000000..b3a6d8125
--- /dev/null
+++ b/tools/prisma/migrations/20250112140257_normalize_user_email_fields/migration.sql
@@ -0,0 +1,6 @@
+-- This migration normalizes the username and email fields for all users,
+-- ensuring that they are stored in lowercase.
+UPDATE "User"
+SET username = LOWER(username),
+ email = LOWER(email);
+