added complete authentication layer with registration, login and pers…#9
Merged
Conversation
…istence of users across sessions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…istence of users across sessions
This pull request introduces user authentication to the frontend, implements login and registration pages, and updates the backend and development environment to use PostgreSQL instead of H2. It also refactors navigation and page layouts to support authenticated user flows and improves security by hiding password hashes in API responses.
Frontend: User Authentication and Navigation
AuthContextfor managing user state and authentication logic, including login, registration, and logout methods (frontend/src/context/AuthContext.jsx).LoginPageandRegisterPagecomponents for user sign-in and registration (frontend/src/pages/LoginPage.jsx,frontend/src/pages/RegisterPage.jsx) [1] [2].App.jsxto provide authentication context, protect challenge routes, and add routes for login/register (frontend/src/App.jsx).frontend/src/api/axios.js).NavBarcomponent that displays user info and logout, and integrates it into all main pages (frontend/src/components/NavBar.jsx,frontend/src/pages/ChallengeListPage.jsx,frontend/src/pages/ChallengePage.jsx,frontend/src/pages/AboutPage.jsx) [1] [2] [3] [4].Backend and Environment: PostgreSQL Migration
src/main/resources/application.properties).docker-compose.ymlwith persistent storage, health checks, and connects the backend to it [1] [2].src/test/resources/application.properties)..vscode/settings.json).Security Improvements
@JsonProperty(access = WRITE_ONLY)in theAppUserentity (src/main/java/no/hvl/schemalab/model/AppUser.java).These changes collectively enable secure user authentication, improve developer experience, and prepare the app for production use with a real database.