diff --git a/src/pages/dashboard.jsx b/src/pages/dashboard.jsx index e3f489b5..bd79e0bd 100644 --- a/src/pages/dashboard.jsx +++ b/src/pages/dashboard.jsx @@ -32,7 +32,7 @@ export default function Dashboard() { const [loading, setLoading] = useState(false); const [showOnboarding, setShowOnboarding] = useState(false); const [showUpgradeModal, setShowUpgradeModal] = useState(false); - + const [role, setRole] = useState(false); const exampleObjectives = [ { completed: false, @@ -114,9 +114,21 @@ export default function Dashboard() { } }; + const fetchAccountDetails = async() => { + request(`${process.env.NEXT_PUBLIC_API_URL}/account`, 'GET', null) + .then((data) => { + + setRole(data.role); + }) + .catch((err) => { + console.log(err); + }); + } + fetchRecommendedChallenges(); fetchPopularChallenges(); + fetchAccountDetails(); request(`${process.env.NEXT_PUBLIC_API_URL}/activityFeed/`, 'GET', null).then(response => { console.log(response) setActivities(response.activityFeed); @@ -274,10 +286,13 @@ export default function Dashboard() { - + +
-

+ { role == "USER" && +
+

Sponsor Messaging

- -

+

+} +

Connect with CTFGuide

diff --git a/src/pages/forgot-password.jsx b/src/pages/forgot-password.jsx index a373d049..5dc98b87 100644 --- a/src/pages/forgot-password.jsx +++ b/src/pages/forgot-password.jsx @@ -4,7 +4,7 @@ import { ToastContainer, toast } from 'react-toastify'; import 'react-toastify/dist/ReactToastify.css'; import { useState, useEffect } from 'react'; import { useRouter } from 'next/router'; // Import useRouter - +import AuthFooter from '@/components/auth/AuthFooter' export default function Forgot() { const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); @@ -131,26 +131,12 @@ export default function Forgot() { style={{ fontFamily: 'Poppins, sans-serif' }} className="flex min-h-full flex-col justify-center py-12 sm:px-6 lg:px-8" > -
- - CTFGuide - -

- Forgot your password? -

-

- No worries - we'll get you back to your account in no time. -

-
+
+

Update your credentials

+ +
@@ -204,18 +192,23 @@ export default function Forgot() { type="password" onChange={(e) => setConfirmPassword(e.target.value)} required - className="block w-full appearance-none rounded-md border border-gray-300 px-3 py-2 text-white placeholder-gray-400 shadow-sm focus:border-blue-500 focus:outline-none focus:ring-blue-500 sm:text-sm" + className="block w-full appearance-none border border-gray-300 px-3 py-2 text-white placeholder-gray-400 shadow-sm focus:border-blue-500 focus:outline-none focus:ring-blue-500 sm:text-sm" />
- +
:
+
+ +

Account Recovery

+

No worries - we'll get you back to your account in no time.

+
@@ -228,7 +221,7 @@ export default function Forgot() { onChange={(e) => setEmail(e.target.value)} autoComplete="email" required - className="block w-full appearance-none rounded-md border border-gray-300 px-3 py-2 text-white placeholder-gray-400 shadow-sm focus:border-blue-500 focus:outline-none focus:ring-blue-500 sm:text-sm" + className="block w-full appearance-none border border-gray-300 px-3 py-2 text-white placeholder-gray-400 shadow-sm focus:border-blue-500 focus:outline-none focus:ring-blue-500 sm:text-sm" />
@@ -240,7 +233,7 @@ export default function Forgot() { @@ -250,22 +243,28 @@ export default function Forgot() {
} - -
-← Return to login? +
+ +
+ + + +

+ { + const fetchUserPoints = async () => { + try { + const endPoint = `${process.env.NEXT_PUBLIC_API_URL}/users/${user.username}/points`; + console.log('Fetching user points:', endPoint); + + const response = await request(endPoint, 'GET'); + if (response && response.totalPoints) { + setPoints(response.totalPoints); + console.log('User points:', response.totalPoints); + } + throw new Error('Failed to fetch user points'); + } catch (error) { + console.error('Failed to fetch user points:', error); + } + }; + + if (user && user.username) { + fetchUserPoints(); + } + }, [user]); + + const userData = { user, ownUser: true }; // Follower @@ -967,6 +994,13 @@ export default function Create() { )}

+ + {user && points && ( + + Points: {points} + + )} + {' '} {(user && user.location) || (