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

feat: Add credential submission and tracking #79

Merged
merged 10 commits into from
Oct 30, 2024

Conversation

aidanprior
Copy link
Collaborator

@aidanprior aidanprior commented Oct 30, 2024

Linked issue/ticket

#29

Description

Connects the credential entry fields on the profile page to the backend.
The database now tracks AWS credentials in the users table.
The frontend tracks user information including AWS credentials in localstorage
This allows session managment.

Routing also now works by restricting access to information that requires a login, or credentials set

Reproduction steps

You will need to run npm run docker-remove-all so that the users table can be rebuilt with the aws credential columns

Start up the app, and try to navigate to the homepage, events dashboard, or profile. You will be told you need to login first.
Since you deleted the database volume, you'll need to sign up as a new user, and then log in.
Try to access the events dashboard. You will be told you need to enter your AWS credentials.
Back on the profile page, enter your AWS credentials. After dismissing the popup, you can now view events on the dashboard and charts on the homepage.

If you close your browser and reopen, you should be able to click login, and it will automatically log you in with your stored user session data.

If you want to change your AWS credentials at any time, you can in the profile page.

Checklist

  • I've followed the Contributing guidelines
  • I've titled my PR according to the Conventional Commits spec
  • I've added tests that fail without this PR but pass with it
  • I've linted, tested, and commented my code
  • I've updated documentation (if appropriate)

@aidanprior aidanprior added the bug Something isn't working label Oct 30, 2024
# Conflicts:
#	client/src/App.tsx
#	client/src/components/Navbar.tsx
#	client/src/pages/Home.tsx
#	client/src/pages/Login.tsx
#	client/src/pages/Profile.tsx
#	client/src/types.ts
.catch((error) => console.warn('Could not fetch events: ', error));
.catch((error) => {
if (error === '403: Forbidden')
setError('Please enter AWS Credentials to view events');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.

@@ -1,21 +1,18 @@
import React, { lazy, useState } from 'react';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm the lazy loading didnt turn out to be a home run. I wonder how many other issues were stemming from it. Maybe there's a better use case for it in larger applications.

RETURNING *;
`,
[
res.locals.awsCredentials.aws_access_key,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome.

Copy link
Contributor

@SamLarivs SamLarivs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job, Aidan. Idk how any of this would have happened without your brain.

@SamLarivs SamLarivs merged commit 093c07b into dev Oct 30, 2024
3 checks passed
@aidanprior aidanprior deleted the aidanprior/credentialsToBackend branch October 31, 2024 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants