jlaksana / UML2Code

UML diagram creator designed for intro CS students
https://uml2code.vercel.app
2 stars 0 forks source link

Protect diagrams with a password #48

Closed jlaksana closed 1 year ago

jlaksana commented 1 year ago

Description Currently, all diagrams are public and editable by anyone. This is bad and users cannot be trusted not to edit other diagrams. So, we need to protect diagrams with a password. We will continue to not have user accounts in the app. We will have passwords for each diagram.

Acceptance Criteria When creating a new diagram, have the user set a password. Make this a new form after clicking "Create New". Implement hashing the password with a salt. Add this to the diagram schema. Implement cookies that stores a session token and protect all endpoints except for creating and getting diagrams. Modify diagram login to also take a password.

Additional Information

jlaksana commented 1 year ago

resources: https://faizanv.medium.com/authentication-for-your-react-and-express-application-w-json-web-tokens-923515826e0 https://stackoverflow.com/questions/43002444/make-axios-send-cookies-in-its-requests-automatically

jlaksana commented 1 year ago

will not implement refresh tokens since I chose 8h expiration times. on the frontend, put an axios interceptor that redirects to the login https://www.thedutchlab.com/insights/using-axios-interceptors-for-refreshing-your-api-token

jlaksana commented 1 year ago

frontend: https://github.com/jlaksana/UML2Code/commit/6b6094fea1a6ca2467fc14417e947615f028967f backend: https://github.com/jlaksana/UML2Code/commit/f9f4f5c14a96522c8b6c76d2d4f9b129574ff013