Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/schedule/2024Fall/2024Fall.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ogDescription: Explore the Fall 2024 meeting schedule for the UMass Lowell Cloud
---

:::danger
This schedule is outdated and refers to a past semester. Please check the [latest schedule](../docs/current-schedule) for current information.
This schedule is outdated and refers to a past semester. Please check the [latest schedule](../current-schedule) for current information.
:::


Expand Down
12 changes: 2 additions & 10 deletions src/components/Auth/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import React from "react";
import { useAuth } from "react-oidc-context";
import { Redirect, useLocation } from "@docusaurus/router";
import ReactLoading from 'react-loading';
import { isEnvLocalLoaded } from '../../utils/env';

import {
// AUTHENTICATED,
Expand All @@ -21,15 +20,8 @@ export function AuthCheck({ children }) {
let from = location.pathname;
const auth = useAuth();

// If .env.local is missing, skip all auth logic and just render children
if (!isEnvLocalLoaded()) {
return <>{children}</>;
}

// Defensive: Only split if OAUTH_REDIRECT_SIGN_OUT is defined
const signOutUris = process.env.OAUTH_REDIRECT_SIGN_OUT ? process.env.OAUTH_REDIRECT_SIGN_OUT.split(",") : ["", ""];
const [local_logout_uri, prod_logout_uri] = signOutUris;

const [local_logout_uri, prod_logout_uri] = process.env.OAUTH_REDIRECT_SIGN_OUT.split(",");

const signOutRedirect = () => {
const clientId = process.env.CLIENT_ID;
const logoutUri = process.env.ENV === "localhost"
Expand Down
14 changes: 5 additions & 9 deletions src/config/cognito-auth-config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
// src/config/cognito-auth-config.js

import { isEnvLocalLoaded, getEnvVar } from '../utils/env';

const cognitoAuthConfig = {
authority: getEnvVar('AUTHORITY'),
client_id: getEnvVar('CLIENT_ID'),
redirect_uri: getEnvVar('REDIRECT_URI'),
response_type: getEnvVar('OAUTH_REDIRECT_SIGN_RESPONSE_TYPE', 'code'),
scope: getEnvVar('SCOPE', 'email openid phone'),
// Add a flag for local mode
isLocalDev: !isEnvLocalLoaded(),
authority: process.env.AUTHORITY,
client_id: process.env.CLIENT_ID,
redirect_uri: process.env.REDIRECT_URI,
response_type: process.env.OAUTH_REDIRECT_SIGN_RESPONSE_TYPE,
scope: process.env.SCOPE,
};

export default cognitoAuthConfig;
Expand Down
12 changes: 0 additions & 12 deletions src/config/cognito-configure.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,8 @@
// src/config/cognito-config.js

import cognitoAuthConfig from "./cognito-auth-config";
import { isEnvLocalLoaded } from '../utils/env';

export function configure() {
// If .env.local is missing, fallback to local dev mode and skip config
if (!isEnvLocalLoaded()) {
return {
...cognitoAuthConfig,
// Optionally, set all sensitive/remote fields to undefined
authority: undefined,
client_id: undefined,
redirect_uri: undefined,
isLocalDev: true,
};
}
// Assuming you have two redirect URIs, and the first is for localhost and
// second is for production
const [localRedirectURI, prodRedirectURI] =
Expand Down
35 changes: 0 additions & 35 deletions src/utils/env.js

This file was deleted.

11 changes: 2 additions & 9 deletions src/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,9 @@ import {
LOGOUT_BUTTON,
LOGOUT_PATH,
} from "./constants";
import { isEnvLocalLoaded } from './env';

export function useNavbarItemsMobile() {
if (!isEnvLocalLoaded()) {
// If .env.local is missing, do not render auth-related navbar items
return useThemeConfig().navbar.items;
}
// const { route } = useAuthenticator((context) => [context.route]);
const auth = useAuth();

let authElement;
Expand Down Expand Up @@ -65,10 +61,7 @@ export function useNavbarItemsMobile() {
}

export function useNavbarItemsDesktop() {
if (!isEnvLocalLoaded()) {
// If .env.local is missing, do not render auth-related navbar items
return useThemeConfig().navbar.items;
}
// const { route } = useAuthenticator((context) => [context.route]);
const auth = useAuth();

let authElement;
Expand Down
Loading