-
Notifications
You must be signed in to change notification settings - Fork 26
migrate from local storage to cookies for jwt token #1875
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
base: dev
Are you sure you want to change the base?
Conversation
src/Components/Navbar/AdminNavbar.js
Outdated
| function handleLogout() { | ||
| setAuthenticated(false); | ||
| cookies.remove('jwtToken'); | ||
| window.localStorage.removeItem('jwtToken'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove local storage line
| setAuthenticated(false); | ||
| setUser({}); | ||
| cookies.remove('jwtToken'); | ||
| window.localStorage.removeItem('jwtToken'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove local storage line
src/Pages/Login/Login.js
Outdated
| if (!loginStatus.error) { | ||
| setAuthenticated(true); | ||
| window.localStorage.setItem('jwtToken', loginStatus.token); | ||
| cookies.set('jwtToken', loginStatus.token); // expire cookie after 1 week |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be more settings we add here, like https only if we are in prod and same site secure
src/Pages/Login/Login.js
Outdated
| if (!loginStatus.error) { | ||
| setAuthenticated(true); | ||
| window.localStorage.setItem('jwtToken', loginStatus.token); | ||
| cookies.set('jwtToken', loginStatus.token); // expire cookie after 1 week |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be more settings we add here, like https only if we are in prod and same site secure
* created button for expiration w/ no logic rn * fixed conflict * set expiration * frontend core-v4 no longer fails with expiration button * enabed led sign in config.json * added sign_message class * changed 'cancel' button to 'hide' * made expiration button disappear when pressed and set expiration to null when updated without expiration * polishing ui of expiration inputs * made the expiration button ui look good on pc and mobile :D - char & tiffany * added condition for expiration that is in the past * i was in room 2 wbu * made led sign page send expiration date in utc * and thats the internship * lint * remove src/Pages/LedSign/sign_message.py * undo button classname change * separate variable * why not await * npx mocha test/api/LedSign.js --------- Co-authored-by: Tyffoni <[email protected]> Co-authored-by: evan <[email protected]>
* Added door code to profile View * Update Profile.js
* printer now rejects expired sessions * fix lint
* combine decodeTokenFromBodyOrQuery into decodeToken
* fixed misreference
* optimize logic for member access level
* fixed bug with decodeToken
* refactor decodeToken to handle unauthorized, forbidden, ok
* global use of decodeToken only
* tests pass, lint wont
* all green (?)
* remove commented out code, undo stray diff
* how safe are the user related apis
* specify access level for some apis
* const { membershipState } = require('../../../src/Enums.js');
---------
Co-authored-by: evan <[email protected]>
adarsh sux he typed that comment
* Add edit alias functionality for OfficeAccessCard (#1900) - Implemented a new endpoint to edit card aliases, including validation for input. - Updated the OfficeAccessCard utility to support alias editing. - Enhanced the CardReader component to allow users to edit card aliases directly in the UI. - Added corresponding tests to ensure proper functionality and error handling for the new feature. - Introduced a new audit log action for alias edits. * fixed lint issues * fixed issues with edit alias * fixed input re-sizing * fix token decoding for office cards * fix failing test * separate frontend changes * Add edit alias functionality for OfficeAccessCard (#1900) - Implemented a new endpoint to edit card aliases, including validation for input. - Updated the OfficeAccessCard utility to support alias editing. - Enhanced the CardReader component to allow users to edit card aliases directly in the UI. - Added corresponding tests to ensure proper functionality and error handling for the new feature. - Introduced a new audit log action for alias edits. * fixed lint issues * fixed issues with edit alias * fixed input re-sizing * fix token decoding for office cards * fix failing test * separate frontend changes * modify required checks for /edit * addressed requested changes * try to fix failing test * try to fix that failing test one more time * remove this test cuz it wont work * OfficeAccessCard editing - UI changes (#1935) * Add edit alias functionality for OfficeAccessCard (#1900) - Implemented a new endpoint to edit card aliases, including validation for input. - Updated the OfficeAccessCard utility to support alias editing. - Enhanced the CardReader component to allow users to edit card aliases directly in the UI. - Added corresponding tests to ensure proper functionality and error handling for the new feature. - Introduced a new audit log action for alias edits. * fixed lint issues * fixed issues with edit alias * fixed input re-sizing * fix token decoding for office cards * fix failing test * card reader frontend * rebase * undo diff * fixed requested changes * fixed requested changes --------- Co-authored-by: DavidN016 <[email protected]> --------- Co-authored-by: DavidN016 <[email protected]> Co-authored-by: adarshm11 <[email protected]> Co-authored-by: adarsh <[email protected]>
…nt/Clark into Adarsh/jwt-cookies
addresses issue #1788
now we don't have local storage of jwtToken, only cookies!!!