diff --git a/app-backend/src/controllers/auth.controller.js b/app-backend/src/controllers/auth.controller.js index 06899b471..628e24df7 100644 --- a/app-backend/src/controllers/auth.controller.js +++ b/app-backend/src/controllers/auth.controller.js @@ -155,19 +155,11 @@ export const login = async (req, res) => { user.otpExpiresAt = expiry; await user.save(); - let emailSent = false; - try { - await sendOTP(user.email, otp, user.name); - emailSent = true; - console.log(`✅ OTP email sent successfully to ${user.email}`); - } catch (emailError) { - console.error('⚠️ Email sending failed, but OTP is saved to database'); - console.error(' OTP Code:', otp); - console.error(' Users can still verify using the OTP via /api/v1/auth/verify-otp endpoint'); - console.error(' Email error:', emailError.message); - } + console.log("DEV_MODE otp: ", otp) + // sendOTP(email,otp); - await req.audit.log(user._id, ACTIONS.LOGIN_SUCCESS, { step: "OTP_SENT", emailSent }); + + await req.audit.log(user._id, ACTIONS.LOGIN_SUCCESS, { step: "OTP_SENT" }); if (emailSent) { res.status(200).json({ message: 'OTP sent to your email' }); diff --git a/app-frontend/employer-panel/src/App.js b/app-frontend/employer-panel/src/App.js index e59df85dd..77cd40ede 100644 --- a/app-frontend/employer-panel/src/App.js +++ b/app-frontend/employer-panel/src/App.js @@ -6,6 +6,10 @@ import EmployerDashboard from './pages/EmployerDashboard'; import CreateShift from './pages/createShift'; import ManageShift from './pages/ManageShift'; import GuardProfiles from './pages/GuardProfile'; + +//guard profile page +import GuardProfilePage from './pages/GuardProfilePage'; + import SubmissionConfirmation from './pages/SubmissionConfirmation'; import CompanyProfile from './pages/CompanyProfile'; import EmailSettings from './pages/EmailSettings'; @@ -53,7 +57,27 @@ function App() { return ( - +
+
+
+ + } /> + } /> + } /> {/* ✅ new 2FA route */} + } /> + } /> + } /> + } /> + + } /> + + } /> + } /> + } /> + +
+
); } diff --git a/app-frontend/employer-panel/src/pages/GuardProfilePage.jsx b/app-frontend/employer-panel/src/pages/GuardProfilePage.jsx new file mode 100644 index 000000000..b30deddbd --- /dev/null +++ b/app-frontend/employer-panel/src/pages/GuardProfilePage.jsx @@ -0,0 +1,36 @@ +import { useEffect, useState } from "react"; +import { useParams } from "react-router-dom"; +import http from "../lib/http"; + +export default function GuardProfilePage() { + const { guardId } = useParams(); + const [data, setData] = useState(null); + const [loading, setLoading] = useState(true); + const [error, setError] = useState(null); + + useEffect(() => { + async function fetchData() { + try { + setLoading(true); + const res = await http.get(`/guards/${guardId}/profile`); + setData(res.data); + } catch (err) { + setError("Failed to load guard profile"); + } finally { + setLoading(false); + } + } + + if (guardId) fetchData(); + }, [guardId]); + + if (loading) return
Loading…
; + if (error) return
{error}
; + + return ( +
+

Guard Profile

+
{JSON.stringify(data, null, 2)}
+
+ ); +}