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

Remove stale cookies from login page #78

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

WishingWell13
Copy link
Contributor

@WishingWell13 WishingWell13 commented Feb 2, 2025

Info

Closes #79 (If there is no issue for this pull request yet, please create one or
delete this line if the pull request is for a very minor tweak).

Description

What changes did you make? List all distinct problems that this PR addresses. Explain any relevant
motivation or context.

Bug fixes regarding cookies and the login page

Changes

  • clear the user cookie when login fails
  • redirect login to / when you're already logged in

Type of Change

  • Patch (non-breaking change/bugfix)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to not work as
    expected)
  • Documentation (A change to a README/description)
  • Continuous Integration/DevOps Change (Related to deployment steps, continuous integration
    workflows, linting, etc.)
  • Other: (Fill In)

If you've selected Patch, Minor, or Major as your change type, make sure to bump the version before merging in package.json!

Testing

I have tested that my changes fully resolve the linked issue ...

  • locally.
  • on the testing API/testing database.
  • with appropriate Postman routes. Screenshots are included below.

Checklist

  • I have performed a self-review of my own code.
  • I have followed the style guidelines of this project.
  • I have appropriately edited the API version in the package.json file.
  • My changes produce no new warnings.

Screenshots

Please include a screenshot of your Postman testing passing successfully.

image

Copy link

vercel bot commented Feb 2, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hackathon-portal ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 4, 2025 4:44am

Copy link

github-actions bot commented Feb 2, 2025

Thanks for contributing!
If you've made changes to the API's functionality, please make sure to bump the package
version—see this guide to semantic versioning for details—and
document those changes as appropriate.

Copy link
Contributor

@angela139 angela139 left a comment

Choose a reason for hiding this comment

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

Looks pretty good to me! Just added some comments to clean up the code a bit

client/src/app/login/login.ts Outdated Show resolved Hide resolved
client/src/app/login/page.tsx Outdated Show resolved Hide resolved
client/src/app/login/page.tsx Outdated Show resolved Hide resolved
client/src/app/login/login.ts Outdated Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

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

you can delete this, we switched to using a route handler instead

@@ -15,6 +15,7 @@ import { getErrorMessage } from '../utils';

export const login = async (email: string, password: string): Promise<LoginResponse> => {
const requestUrl = `${config.api.baseUrl}${config.api.endpoints.auth.login}`;
console.log('requestUrl', requestUrl);
Copy link
Member

Choose a reason for hiding this comment

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

remove 🙏

@@ -1,6 +1,7 @@
## Setup

1. Copy `.env.example` to `.env` and fill in the values
1. If you are on ACM @ UCSD Dev Team, fields are available in our google drive for step 1 and 2
Copy link
Member

Choose a reason for hiding this comment

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

can you undo this change (so there are no changes to the server/ folder), otherwise I think merging your PR might take down both portals while the backend action runs

@@ -12,7 +12,7 @@ export default async function Home() {

if (!accessToken) {
console.log('Dashboard broke: access token undefined');
redirect('/login');
redirect('/api/logout');
Copy link
Member

Choose a reason for hiding this comment

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

you might also need to update the application and profile edit pages

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Frontend: Clear Login Cookies
4 participants