diff --git a/RestroHub-FrontEnd/src/index.jsx b/RestroHub-FrontEnd/src/index.jsx
index 2f43898..43912a0 100644
--- a/RestroHub-FrontEnd/src/index.jsx
+++ b/RestroHub-FrontEnd/src/index.jsx
@@ -1,5 +1,6 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
+import { GoogleOAuthProvider } from '@react-oauth/google';
import App from './App.jsx';
// ============================================
@@ -10,6 +11,8 @@ const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
-
+
+
+
);
diff --git a/RestroHub-FrontEnd/src/pages/public/ForgotPassword.jsx b/RestroHub-FrontEnd/src/pages/public/ForgotPassword.jsx
index dae57ed..74549aa 100644
--- a/RestroHub-FrontEnd/src/pages/public/ForgotPassword.jsx
+++ b/RestroHub-FrontEnd/src/pages/public/ForgotPassword.jsx
@@ -1,20 +1,312 @@
-import React from 'react';
-import { Link } from 'react-router-dom';
+import { useState } from "react";
+import { Link } from "react-router-dom";
+import { useFormik } from "formik";
+import * as Yup from "yup";
+import toast from "react-hot-toast";
+import api from "@services/common/api";
+import { useTheme } from "@context/ThemeContext";
+
+const validationSchema = Yup.object({
+ email: Yup.string()
+ .transform((value) => value?.trim())
+ .email("Enter a valid email address")
+ .required("Email is required"),
+});
+
+const EmailIcon = () => (
+
+);
+
+const SpinnerIcon = () => (
+
+);
+
+const Illustration = () => (
+
+);
const ForgotPassword = () => {
+ const { isDark, toggle } = useTheme();
+ const [isLoading, setIsLoading] = useState(false);
+ const [submittedEmail, setSubmittedEmail] = useState("");
+ const [submitError, setSubmitError] = useState("");
+
+ const formik = useFormik({
+ initialValues: { email: "" },
+ validationSchema,
+ onSubmit: async ({ email }) => {
+ setIsLoading(true);
+ setSubmitError("");
+ const normalizedEmail = email.trim();
+
+ try {
+ const res = await api.post("/public/api/v1/auth/forgot-password", {
+ email: normalizedEmail,
+ });
+
+ if (res.data?.success === false) {
+ throw new Error(res.data?.message || "Unable to send reset instructions.");
+ }
+
+ const message =
+ res.data?.message ||
+ "Password reset instructions have been sent to your email.";
+
+ setSubmittedEmail(normalizedEmail);
+ toast.success(message);
+ } catch (err) {
+ const message =
+ err.response?.data?.message ||
+ err.message ||
+ "Unable to send reset instructions. Please try again.";
+
+ setSubmitError(message);
+ toast.error(
+ message
+ );
+ } finally {
+ setIsLoading(false);
+ }
+ },
+ });
+
+ const inputClass = (field) =>
+ `w-full rounded-lg border ${
+ formik.touched[field] && formik.errors[field]
+ ? "border-red-500 focus:ring-red-500"
+ : "border-gray-300 focus:ring-blue-500 dark:border-gray-600"
+ } bg-transparent py-4 pl-6 pr-12 text-gray-800 placeholder-gray-400 outline-none transition focus:border-transparent focus:ring-2 dark:bg-gray-800 dark:text-white dark:placeholder-gray-500`;
+
return (
-
-
-
Forgot Password?
-
- The password recovery feature is currently under development. Please contact support or try again later!
-
-
- Back to Login
-
+
+
+
+
+
+
+
+ Restroly
+
+
+
+
+ Reset your password and get back to managing your restaurant.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Restroly
+
+
+
+
+ Forgot your password?
+
+
+ Reset Password
+
+
+ Enter your registered email address and we will send password
+ reset instructions.
+
+
+ {submittedEmail ? (
+
+
Check your inbox
+
+ If an account exists for {submittedEmail}, reset
+ instructions will arrive shortly.
+
+
+
+ ) : (
+
+ )}
+
+
+ Remember your password?{" "}
+
+ Sign In
+
+
+
+
+
);