Skip to content

Commit 7752e13

Browse files
Updated the dev-login functionality to restrict access and improved server-side rendering with authentication checks. (#834)
* feat: integrate Job Boardly RSS feed with authentication-protected job board Add a complete job board integration that fetches jobs from Job Boardly's RSS feed and displays them behind authentication. Features: - RSS feed parser for Job Boardly jobs (title, company, location, type, salary, etc.) - Protected job listing page (/jobs) - requires GitHub OAuth login - Job detail page with full descriptions and apply links - Search and filter functionality (by keyword, category, job type) - VWC Alumni badge for users with course enrollments - Links to resume translator and courses for job seekers - API endpoint for fetching jobs programmatically - Dev access bypass for local testing without OAuth setup Navigation: - Added "Jobs" link to main menu (with "new" badge) - Added "Browse Jobs" to dashboard quick links Technical Changes: - Install rss-parser and xml2js packages - Create jobboardly utility library in src/lib/ - Server-side rendering with authentication checks via NextAuth - Fixed Next.js 15 webpack config compatibility issue (removed usedExports) - Dev-only bypass mode for testing without GitHub OAuth credentials Access Control: - Production: Only Vets-Who-Code GitHub org members + admin - Development: Any GitHub user (for testing) - Job board pages redirect to /login if unauthenticated * fix: restrict dev login to development environment only - Add server-side redirect in dev-login page when not in development - Hide dev-login buttons in production using NODE_ENV check - Fix incorrect /dev-login links in course pages (now point to /login) - Updated files: - courses/index.tsx: Conditionally render dev-login button - courses/ai-engineering.tsx: Fixed login link - courses/data-engineering.tsx: Fixed login link - courses/software-engineering.tsx: Fixed login link - resume-translator.tsx: Conditionally render dev-login button - dev-login.tsx: Added production redirect
1 parent e9c2075 commit 7752e13

File tree

6 files changed

+42
-26
lines changed

6 files changed

+42
-26
lines changed

src/pages/courses/ai-engineering.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ const AIEngineeringCourse: PageWithLayout = () => {
143143
Please sign in to access the AI Engineering vertical.
144144
</p>
145145
<Link
146-
href="/dev-login"
146+
href="/login"
147147
className="tw-inline-flex tw-items-center tw-rounded-md tw-bg-success tw-px-6 tw-py-3 tw-font-semibold tw-text-white tw-transition-colors hover:tw-bg-success/90"
148148
>
149149
Sign In

src/pages/courses/data-engineering.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ const DataEngineeringCourse: PageWithLayout = () => {
143143
Please sign in to access the Data Engineering vertical.
144144
</p>
145145
<Link
146-
href="/dev-login"
146+
href="/login"
147147
className="tw-inline-flex tw-items-center tw-rounded-md tw-bg-secondary tw-px-6 tw-py-3 tw-font-semibold tw-text-white tw-transition-colors hover:tw-bg-secondary/90"
148148
>
149149
Sign In

src/pages/courses/index.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,15 @@ const CoursesIndex: PageWithLayout = () => {
137137
<i className="fas fa-sign-in-alt tw-mr-2" />
138138
Sign In to Access Courses
139139
</Link>
140-
<Link
141-
href="/dev-login"
142-
className="tw-inline-flex tw-items-center tw-rounded-md tw-bg-gray-600 tw-px-8 tw-py-3 tw-font-semibold tw-text-white tw-transition-colors hover:tw-bg-gray-500"
143-
>
144-
<i className="fas fa-code tw-mr-2" />
145-
Dev Login (Testing)
146-
</Link>
140+
{process.env.NODE_ENV === "development" && (
141+
<Link
142+
href="/dev-login"
143+
className="tw-inline-flex tw-items-center tw-rounded-md tw-bg-gray-600 tw-px-8 tw-py-3 tw-font-semibold tw-text-white tw-transition-colors hover:tw-bg-gray-500"
144+
>
145+
<i className="fas fa-code tw-mr-2" />
146+
Dev Login (Testing)
147+
</Link>
148+
)}
147149
</div>
148150
<div className="tw-text-gray-600">
149151
<p>Want to explore course topics first?</p>

src/pages/courses/software-engineering.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ const SoftwareEngineeringCourse: PageWithLayout = () => {
143143
Please sign in to access the Software Engineering vertical.
144144
</p>
145145
<Link
146-
href="/dev-login"
146+
href="/login"
147147
className="tw-inline-flex tw-items-center tw-rounded-md tw-bg-primary tw-px-6 tw-py-3 tw-font-semibold tw-text-white tw-transition-colors hover:tw-bg-primary/90"
148148
>
149149
Sign In

src/pages/dev-login.tsx

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { useState } from "react";
22
import { useRouter } from "next/router";
33
import Link from "next/link";
44
import Layout from "@layout/layout-01";
5-
import type { GetStaticProps, NextPage } from "next";
5+
import type { GetServerSideProps, NextPage } from "next";
66

77
interface DevLoginProps {
88
layout?: {
@@ -88,14 +88,26 @@ const DevLogin: PageWithLayout = () => {
8888

8989
DevLogin.Layout = Layout;
9090

91-
export const getStaticProps: GetStaticProps<DevLoginProps> = () => ({
92-
props: {
93-
layout: {
94-
headerShadow: true,
95-
headerFluid: false,
96-
footerMode: "light",
91+
export const getServerSideProps: GetServerSideProps<DevLoginProps> = async () => {
92+
// Redirect to home page if not in development
93+
if (process.env.NODE_ENV !== "development") {
94+
return {
95+
redirect: {
96+
destination: "/",
97+
permanent: false,
98+
},
99+
};
100+
}
101+
102+
return {
103+
props: {
104+
layout: {
105+
headerShadow: true,
106+
headerFluid: false,
107+
footerMode: "light",
108+
},
97109
},
98-
},
99-
});
110+
};
111+
};
100112

101113
export default DevLogin;

src/pages/resume-translator.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,15 @@ const ResumeTranslatorPage: PageWithLayout = () => {
154154
<i className="fas fa-sign-in-alt tw-mr-2" />
155155
Sign In (Veterans Only)
156156
</Link>
157-
<Link
158-
href="/dev-login"
159-
className="tw-inline-flex tw-items-center tw-rounded-md tw-bg-gray-600 tw-px-8 tw-py-3 tw-font-semibold tw-text-white tw-transition-colors hover:tw-bg-gray-500"
160-
>
161-
<i className="fas fa-code tw-mr-2" />
162-
Dev Login (Testing)
163-
</Link>
157+
{process.env.NODE_ENV === "development" && (
158+
<Link
159+
href="/dev-login"
160+
className="tw-inline-flex tw-items-center tw-rounded-md tw-bg-gray-600 tw-px-8 tw-py-3 tw-font-semibold tw-text-white tw-transition-colors hover:tw-bg-gray-500"
161+
>
162+
<i className="fas fa-code tw-mr-2" />
163+
Dev Login (Testing)
164+
</Link>
165+
)}
164166
</div>
165167
<div className="tw-text-gray-600">
166168
<p className="tw-font-semibold">Not a member yet?</p>

0 commit comments

Comments
 (0)