Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Midhun #52

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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
20 changes: 16 additions & 4 deletions backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,23 @@

# * * * APP * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

cred = credentials.Certificate(r'secrets/majoraudit-firebase-adminsdk-bc6kc-6e9544580c.json')
cred = credentials.Certificate(r'secrets/majoraudit-firebase-adminsdk-bc6kc-2898e677ae.json')
app = firebase_admin.initialize_app(cred)

db = firestore.client()
allowed_CORS_origins=['http://127.0.0.1:3000', 'http://127.0.0.1:3000/graduation', 'http://127.0.0.1:3000/courses', 'http://127.0.0.1:3000/onboard', 'http://127.0.0.1:5000']

allowed_CORS_origins=['http://127.0.0.1:3000', 'http://127.0.0.1:3000/graduation', 'http://127.0.0.1:3000/login', 'http://127.0.0.1:3000/courses', 'http://127.0.0.1:3000/onboard', 'http://127.0.0.1:3000']

class User:
def __init__(self, netID, onboard, name, degrees, studentCourses, language):
self.netID = netID
self.onboard = onboard
self.name = name
self.degrees = degrees
self.studentCourses = studentCourses
self.language = language


app = Flask(__name__, template_folder='templates')

CORS(app, supports_credentials=True, origins=allowed_CORS_origins)
Expand Down Expand Up @@ -146,7 +158,7 @@ def validate(ticket, service):

@app.route('/logout')
def logout():
service="127.0.0.1:5000/login"
service="127.0.0.1:3000/login"
response = make_response(redirect(f'https://secure.its.yale.edu/cas/logout'))
response.set_cookie('netid', '', expires=0, path='/')
return response
Expand All @@ -159,7 +171,7 @@ def getAuth():
if "NETID" in session:
document = db.collection("Users").document(session['NETID']).get()
onboard = document.to_dict().get("onboard")
return jsonify({"loggedIn": True, "onboard": onboard})
return jsonify({"loggedIn": False, "onboard": onboard})
else:
return jsonify({"loggedIn": False, "onboard": False})

Expand Down
2 changes: 1 addition & 1 deletion firebase.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"port": 9000
},
"hosting": {
"port": 3000
"port": 5000
},
"pubsub": {
"port": 8085
Expand Down
26 changes: 13 additions & 13 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,21 @@ function App(){
});
};

useEffect(() => {
checkAuth();
}, []);
// useEffect(() => {
// checkAuth();
// }, []);

useEffect(() => {
if(auth.loggedIn && auth.onboard){
initUser();
}
}, [auth]);
// useEffect(() => {
// if(auth.loggedIn && auth.onboard){
// initUser();
// }
// }, [auth]);

useEffect(() => {
if(auth.loggedIn && auth.onboard){
syncUser(user);
}
}, [user]);
// useEffect(() => {
// if(auth.loggedIn && auth.onboard){
// syncUser(user);
// }
// }, [user]);

const ProtectedRoute = (element: JSX.Element) => {
if(!auth.loggedIn){
Expand Down
Binary file added frontend/src/commons/images/majoraudit.mp4
Binary file not shown.
4 changes: 4 additions & 0 deletions frontend/src/declarations.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module '*.mp4' {
const src: string;
export default src;
}
8 changes: 8 additions & 0 deletions frontend/src/pages/Courses/utils/CoursesUtils.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// CoursesUtils.d.ts

// Declare functions, classes, or variables exported by CoursesUtils.ts
export function xCheckMajorsAndSet(user: User, newCourse: StudentCourse, setUser: Function): void;

export function yearTreeify(data: any): any;

// Add other type declarations as needed
8 changes: 8 additions & 0 deletions frontend/src/pages/Majors/metadata/Metadata.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// src/pages/metadata/Metadata.d.ts

// Assuming Metadata is a React component:
import * as React from 'react';

declare const Metadata: React.FC<any>;

export default Metadata;
8 changes: 8 additions & 0 deletions frontend/src/pages/Majors/requirements/Requirements.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// src/pages/requirements/Requirements.d.ts

// Assuming Requirements is a React component:
import * as React from 'react';

declare const Requirements: React.FC<any>;

export default Requirements;
Loading