diff --git a/.env b/.env
new file mode 100644
index 0000000..8cf65dd
--- /dev/null
+++ b/.env
@@ -0,0 +1 @@
+VITE_SERVER_URL=https://backend.planpostai.com/api/v2
\ No newline at end of file
diff --git a/src/pages/Signup.tsx b/src/pages/Signup.tsx
index 98ffcef..c17758b 100644
--- a/src/pages/Signup.tsx
+++ b/src/pages/Signup.tsx
@@ -6,6 +6,7 @@ import {
CheckCircle,
ArrowRight,
User,
+ Phone,
} from "lucide-react";
import { useNavigate } from "react-router-dom";
import { useAuthStore } from "@/stores/authStore";
@@ -15,6 +16,7 @@ const Signup: React.FC = () => {
const [form, setForm] = useState({
name: "",
email: "",
+ phone: "",
password: "",
confirm: "",
});
@@ -26,7 +28,13 @@ const Signup: React.FC = () => {
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault();
- if (!form.name || !form.email || !form.password || !form.confirm) {
+ if (
+ !form.name ||
+ !form.email ||
+ !form.phone ||
+ !form.password ||
+ !form.confirm
+ ) {
return setLocalError("All fields are required");
}
if (form.password !== form.confirm) {
@@ -36,6 +44,13 @@ const Signup: React.FC = () => {
return setLocalError("Password must be at least 8 characters");
}
+ // Basic phone validation
+ const phoneRegex =
+ /^[+]?[(]?[0-9]{1,4}[)]?[-\s.]?[(]?[0-9]{1,4}[)]?[-\s.]?[0-9]{1,9}$/;
+ if (!phoneRegex.test(form.phone)) {
+ return setLocalError("Please enter a valid phone number");
+ }
+
setLocalError("");
// Split name into first and last name
@@ -48,6 +63,7 @@ const Signup: React.FC = () => {
email: form.email,
first_name: firstName,
last_name: lastName || undefined,
+ phone: form.phone,
password: form.password,
role: "affiliate",
});
@@ -205,6 +221,24 @@ const Signup: React.FC = () => {
+
+
+
+
+
+ setForm({ ...form, phone: e.target.value })
+ }
+ className="w-full pl-11 pr-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-transparent transition-all outline-none"
+ />
+
+
+