diff --git a/src/App.tsx b/src/App.tsx
index 9a8c77cc..9ed3319d 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -7,6 +7,28 @@ import PostPage from './pages/PostPage.tsx'
import CreateCommunityPage from './pages/CreateCommunityPage.tsx'
import {CommunityPage} from './pages/CommunityPage.tsx'
import { CommunitiesPage } from './pages/CommunitiesPage.tsx'
+ feat/auth-security-validation-128
+import Register from './pages/Register.tsx' // Import the new page
+
+function App() {
+ return (
+ <>
+
+
+
+
+ } />
+ } /> {/* New Security-focused route */}
+ } />
+ } />
+ } />
+ } />
+ } />
+
+
+
+ >
+
import MessagesPage from './pages/MessagesPage.tsx'
import EventsPage from './pages/EventsPage.tsx'
import EventDetailPage from './pages/EventDetailPage.tsx'
@@ -58,7 +80,8 @@ function App() {
+
)
}
-export default App
+export default App
\ No newline at end of file
diff --git a/src/pages/Register.tsx b/src/pages/Register.tsx
new file mode 100644
index 00000000..fbd44b16
--- /dev/null
+++ b/src/pages/Register.tsx
@@ -0,0 +1,106 @@
+import { useState } from "react";
+import { useNavigate, Link } from "react-router-dom";
+import { supabase } from "../supabase-client";
+import { AlertCircle, CheckCircle2 } from "lucide-react";
+
+const Register = () => {
+ const navigate = useNavigate();
+ const [loading, setLoading] = useState(false);
+ const [errors, setErrors] = useState>({});
+ const [serverError, setServerError] = useState("");
+
+ const [formData, setFormData] = useState({
+ fullName: "",
+ email: "",
+ password: "",
+ });
+
+ const validate = () => {
+ const newErrors: Record = {};
+ if (formData.fullName.length < 2) newErrors.fullName = "Name must be at least 2 characters.";
+ if (!/\S+@\S+\.\S+/.test(formData.email)) newErrors.email = "Valid email is required.";
+ if (formData.password.length < 6) newErrors.password = "Password must be at least 6 characters.";
+
+ setErrors(newErrors);
+ return Object.keys(newErrors).length === 0;
+ };
+
+ const handleRegister = async (e: React.FormEvent) => {
+ e.preventDefault();
+ setServerError("");
+ if (!validate()) return;
+
+ setLoading(true);
+ const { data, error } = await supabase.auth.signUp({
+ email: formData.email,
+ password: formData.password,
+ options: {
+ data: { full_name: formData.fullName }
+ }
+ });
+
+ if (error) {
+ // Handles the "Duplicate Check" requirement (400 error equivalent)
+ setServerError(error.message);
+ setLoading(false);
+ } else {
+ // Standardized success feedback
+ alert("Registration successful! Please check your email for verification.");
+ navigate("/");
+ }
+ };
+
+ return (
+
+
Create Account
+
+ {serverError && (
+
+ )}
+
+
+
+ );
+};
+
+export default Register;