Skip to content

Commit 09b5599

Browse files
Merge branch 'main' into fix-axios-session-credentials
2 parents 776c31d + e7b8fc8 commit 09b5599

2 files changed

Lines changed: 35 additions & 27 deletions

File tree

backend/validators/authValidator.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ const signupSchema = z.object({
66
.min(3, "Username must be at least 3 characters long")
77
.max(30, "Username must be at most 30 characters long")
88
.regex(/^[a-zA-Z0-9_]+$/, "Username can only contain letters, numbers, and underscores")
9-
,
10-
9+
,
10+
1111
email: z.string()
1212
.trim()
1313
.toLowerCase()

src/pages/Signup/Signup.tsx

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ const SignUp: React.FC = () => {
3939
if (name === "username") {
4040
if (!value.trim()) {
4141
errorMessage = "Username is required";
42-
} else if (!/^[a-zA-Z0-9_]+$/.test(value)) {
43-
errorMessage = "Username can contain only letters, numbers, and underscores";
42+
} else if (!/^[A-Za-z\s]+$/.test(value)) {
43+
errorMessage = "Only letters are allowed";
4444
}
4545
}
4646
if (name === "email") {
@@ -70,8 +70,8 @@ const SignUp: React.FC = () => {
7070
const emailError = !formData.email.trim()
7171
? "Email is required"
7272
: !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(formData.email.trim())
73-
? "Enter a valid email"
74-
: "";
73+
? "Enter a valid email"
74+
: "";
7575
const passwordError = !formData.password.trim()
7676
? "Password is required"
7777
: !/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/.test(formData.password)
@@ -102,27 +102,32 @@ const SignUp: React.FC = () => {
102102

103103
return (
104104
<div
105-
className={`min-h-screen h-full w-full flex items-center justify-center relative overflow-hidden ${mode === "dark"
106-
? "bg-gradient-to-br from-slate-900 via-purple-900 to-slate-900"
107-
: "bg-gradient-to-br from-slate-100 via-purple-100 to-slate-100"
108-
}`}
105+
className={`min-h-screen h-full w-full flex items-center justify-center relative overflow-hidden ${
106+
mode === "dark"
107+
? "bg-gradient-to-br from-slate-900 via-purple-900 to-slate-900"
108+
: "bg-gradient-to-br from-slate-100 via-purple-100 to-slate-100"
109+
}`}
109110
>
110111
<div className="absolute inset-0">
111112
<div
112-
className={`absolute -top-40 -right-40 w-96 h-96 ${mode === "dark" ? "bg-purple-500" : "bg-purple-300"
113-
} rounded-full blur-3xl opacity-30 animate-pulse`}
113+
className={`absolute -top-40 -right-40 w-96 h-96 ${
114+
mode === "dark" ? "bg-purple-500" : "bg-purple-300"
115+
} rounded-full blur-3xl opacity-30 animate-pulse`}
114116
/>
115117
<div
116-
className={`absolute -bottom-40 -left-40 w-96 h-96 ${mode === "dark" ? "bg-blue-500" : "bg-blue-300"
117-
} rounded-full blur-3xl opacity-30 animate-pulse`}
118+
className={`absolute -bottom-40 -left-40 w-96 h-96 ${
119+
mode === "dark" ? "bg-blue-500" : "bg-blue-300"
120+
} rounded-full blur-3xl opacity-30 animate-pulse`}
118121
/>
119122
<div
120-
className={`absolute top-40 left-40 w-96 h-96 ${mode === "dark" ? "bg-pink-500" : "bg-pink-300"
121-
} rounded-full blur-3xl opacity-30 animate-pulse`}
123+
className={`absolute top-40 left-40 w-96 h-96 ${
124+
mode === "dark" ? "bg-pink-500" : "bg-pink-300"
125+
} rounded-full blur-3xl opacity-30 animate-pulse`}
122126
/>
123127
<div
124-
className={`absolute top-1/2 right-1/4 w-64 h-64 ${mode === "dark" ? "bg-indigo-500" : "bg-indigo-300"
125-
} rounded-full blur-2xl opacity-20 animate-pulse delay-1000`}
128+
className={`absolute top-1/2 right-1/4 w-64 h-64 ${
129+
mode === "dark" ? "bg-indigo-500" : "bg-indigo-300"
130+
} rounded-full blur-2xl opacity-20 animate-pulse delay-1000`}
126131
/>
127132
</div>
128133

@@ -144,15 +149,17 @@ const SignUp: React.FC = () => {
144149
initial={{ opacity: 0, y: 30 }}
145150
animate={{ opacity: 1, y: 0 }}
146151
transition={{ duration: 0.6, delay: 0.2 }}
147-
className={`rounded-3xl p-6 sm:p-10 shadow-2xl border ${mode === "dark"
148-
? "bg-white/10 backdrop-blur-xl border-white/20 text-white"
149-
: "bg-white border-gray-200 text-black"
150-
}`}
152+
className={`rounded-3xl p-6 sm:p-10 shadow-2xl border ${
153+
mode === "dark"
154+
? "bg-white/10 backdrop-blur-xl border-white/20 text-white"
155+
: "bg-white border-gray-200 text-black"
156+
}`}
151157
>
152-
158+
153159
<h2
154-
className={`text-2xl font-bold text-center mb-8 ${mode === "dark" ? "text-white" : "text-gray-800"
155-
}`}
160+
className={`text-2xl font-bold text-center mb-8 ${
161+
mode === "dark" ? "text-white" : "text-gray-800"
162+
}`}
156163
>
157164
Create Account
158165
</h2>
@@ -225,8 +232,9 @@ const SignUp: React.FC = () => {
225232
</div>
226233

227234
<div
228-
className={`${mode === "dark" ? "from-slate-900" : "from-slate-100"
229-
} absolute bottom-0 left-0 w-full h-20 bg-gradient-to-t to-transparent`}
235+
className={`${
236+
mode === "dark" ? "from-slate-900" : "from-slate-100"
237+
} absolute bottom-0 left-0 w-full h-20 bg-gradient-to-t to-transparent`}
230238
/>
231239
</div>
232240
);

0 commit comments

Comments
 (0)