-
Notifications
You must be signed in to change notification settings - Fork 0
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
Antti | kirjautuminen ja rekistöröityminen sekä authentication #23
Merged
Merged
Changes from 22 commits
Commits
Show all changes
129 commits
Select commit
Hold shift + click to select a range
7defc17
Copied pages/login.tsx file from old login branch
anttiasmala f028cfb
Fixed imports and deleted unnecessary stuff
anttiasmala 3d680e1
Fixed some frontend code in login.tsx
anttiasmala 7a987a7
Fixed name attributes in Inputs
anttiasmala ed507b4
Installed lucia and oslo packages
anttiasmala 44da0e4
Installed @lucia-auth/adapter-prisma package
anttiasmala 0e50733
Updated favicon.ico with working icon
anttiasmala 43d3108
Added Sessions to schema.prisma
anttiasmala 7aa985d
Changed default password for development only
anttiasmala 59b6a17
Rewriting register.tsx. Currently added some debugging console.logs
anttiasmala 7aadfbc
Copied an example of middleware from lucia-auth's website. Reference:…
anttiasmala c0cb21a
Copied an example of auth from lucia-auth's website: References: http…
anttiasmala 9d494c1
Created a new folder pages/api/auth and added register.ts file there …
anttiasmala 4f580c3
Added checks if values given in registering are valid or not
anttiasmala e7f4640
Created a file for URLs to images that have been taken from internet …
anttiasmala de68abf
Created a custom header check so backend can call backend APIs withou…
anttiasmala 0787a77
Created a simple request for registering. Added default values for fi…
anttiasmala e61837f
Commented isEmailValid function out for now
anttiasmala 6f33e73
Made the CUSTOM_HEADER variable exportable so it does not need to be …
anttiasmala a73c274
Removed old createUser function and made userCreatedSuccesfully funct…
anttiasmala 5eed346
Added a simple text that will tell if it is in production or not
anttiasmala 21d9f98
Added functions for checking that given values are valid. Added reque…
anttiasmala 6913f2e
ESLint fixes
anttiasmala 2b9c5fd
Updated .env.example file
anttiasmala 3a4ac71
Removed paragraph that tells if is in production or development stage
anttiasmala 6271496
Created a type when creating session into database
anttiasmala 15f0d57
Changed sessionId to id, added userId, createdAt and updatedAt. Made …
anttiasmala 050eb73
Removed globalThis.crypto variable. Added DatabaseSessionAttributes t…
anttiasmala e9f014f
Added a function to create a session when user registers and made it …
anttiasmala 882ec6f
Created a new file utils.ts to backend to have all isEmailValid etc f…
anttiasmala add75ca
Created login file into /api/auth. Added some basic code into it
anttiasmala c871d5b
Moved isPasswordValid etc into backend/utils
anttiasmala 143e7ba
Made a new type for user when logging in
anttiasmala 5a8a25e
Made functions in backend/utils.ts to return false instead of throwin…
anttiasmala 76e6afb
Changed the way how errors were handled
anttiasmala 2fe00c4
Created a function base for session handler
anttiasmala e742dfa
Changed default email and password values for development only
anttiasmala b12f3e9
Due to modification to isEmailValid etc functions had to change them …
anttiasmala 94ab476
Took exact values from req.body to make code a lot easier to read
anttiasmala 6c1ea14
Removed errorFound function. Replaced it with backend's handleError f…
anttiasmala 61bf1d7
Moved hashPassword from /api/users/index.ts to -> backend/utils.ts to…
anttiasmala b2d2950
Removed isEmailValid function due to check is done in backend. Remove…
anttiasmala 39b279a
Created a new function for creating user
anttiasmala b2af52d
Added a check if given userDetails are valid
anttiasmala 430ceb8
ESLint fixes
anttiasmala ddef858
Changed the way how email and password variables are declared
anttiasmala 0195118
Removed couple values in .env.example. Not used right now. In /api/au…
anttiasmala f26dded
Removed an import that was not used in /api/auth/register.ts
anttiasmala 5fae57c
Merge branch 'main' into antti/register
anttiasmala 594dbf3
Removed CUSTOM_HEADER in middleware.ts
anttiasmala 356244a
Made createUser function in backend exportable. Fixed the import in /…
anttiasmala b7d3469
Made isEmailValid function to return false instead throwing an error
anttiasmala 3d58c21
Merged main branch into antti/register
anttiasmala 765d283
Fixed regexes imports and removed HttpError due to no usage
anttiasmala 2ab6d2a
Added a simple checker that checks if the error is known
anttiasmala e19df78
handleError file's handleUserError now returns a string. Added a new …
anttiasmala bf30cfd
Added eye_open.svg and eye_slash.svg. Converted them to .tsx files by…
anttiasmala 7a7000d
Added eye icon behind password which will show the password. Added fu…
anttiasmala f6613eb
Added firstName and lastName that should not be taken when user tries…
anttiasmala 755d369
Changed UserLoginDetails type
anttiasmala d68195e
Merged main branch into antti/login
anttiasmala 734fa10
Created a prototype of cookie validation
anttiasmala a91e5ff
Fixed a few errors. Fixed session creation
anttiasmala cb7b3e4
Merged antti/register into antti/login
anttiasmala 91d633c
Changed Login function name to Register
anttiasmala 50a4100
Added a check to see if user is logged in. Removed return from the ro…
anttiasmala 7b051aa
Changed LuciaUser to User and added session to express in two days fo…
anttiasmala c8ef5d4
Added a session checker into index.tsx
anttiasmala 8cbdff2
Created a logout function
anttiasmala 2500743
Created a new SVG user and converted it to .tsx file"
anttiasmala 8cd8c4f
Added credits for the images
anttiasmala fad4a56
Added credits for the SVG image and converted a .tsx file of it
anttiasmala d5445dc
Added a prototype of small info box when clicking user icon
anttiasmala 5ddda6a
Added a prototype of logout button
anttiasmala 5467447
Installed the needed packages on my laptop
anttiasmala be218f1
Added error related useStates
anttiasmala 8561fc7
Renamed handleUserError to handleRegisterError
anttiasmala 8075932
Created a new file isValidFunctions.ts to shared folder to be able to…
anttiasmala 1eb0088
Created useState to determite if the user details should be shown. Ad…
anttiasmala c9d21be
Moved error text block a bit more up so it will not resize the whole …
anttiasmala 70901ba
Created a function for login errors and added login error to known fr…
anttiasmala 74a2953
Added an eye that will reval the password. Copied it from register.tsx
anttiasmala 908f6d4
Made adapter variable exportable
anttiasmala 1530a3a
Changed UserLoginDetails type
anttiasmala 7de5002
Created a useState for rememberMe checkbox and added functionality fo…
anttiasmala b3e9573
Created a new function luciaLongSession and changed default lucia to …
anttiasmala f9f28c7
Changed 'regular' session to be 2 weeks. Remember me wil be 30 days
anttiasmala 23a46da
Added frontend styling
anttiasmala b285acf
Created a local component for user detail modal. Might change it in t…
anttiasmala 4c9563d
Created a function called handleLogout and added it to UserDetailsMod…
anttiasmala ae6f4b9
Removed the extra sign out button
anttiasmala c0876b1
Added hoverOnlyWhenSupported to be true to make hover elements work a…
anttiasmala 412c37f
Added some functionality to classname rendering. Created a new parame…
anttiasmala 99b8d7d
Removed development placeholder values
anttiasmala 513cb3a
Removed development placeholder values
anttiasmala 5bce277
ESLint fixes
anttiasmala 60688a6
Added secure value to /api/login.ts's Lucia class constructor
anttiasmala 0c44e77
Created a migration of Session Model
anttiasmala abcb4a6
Removed unnecessary lines in .env.example
anttiasmala c1678cf
Moved handleLogout function from Home function to UserDetailModal fun…
anttiasmala 00b11da
Changed the way how frontend error texts are set
anttiasmala 300226e
Combined login and register errors and fixed the imports
anttiasmala 994ca51
Moved luciaLongSession to .auth file
anttiasmala 5d5d95e
Changed shortLuciaSession to be 1 hour instead of 14 days
anttiasmala a1c770b
Created a new file getServerSideProps
anttiasmala a7861a1
Changes to backend/auth.ts file
anttiasmala 1d87410
Debugging
anttiasmala c74d47a
Added export types
anttiasmala 0766e18
Imported User as LuciaUser from lucia module
anttiasmala d5a4543
Removed as statement in pages/register.tsx
anttiasmala 7d85f3f
Added a new variable SvgEye to determine which SVG icon will be shown…
anttiasmala 58133a1
Edited getServerSideProps in login.tsx to not get the return an objec…
anttiasmala d8e4758
Removed commented getServerSideProps function
anttiasmala 2bf0766
Made code easier to read
anttiasmala 318e45c
Removed customDestination parameter. Removed an as statement
anttiasmala 1c4c157
ESLint fixes
anttiasmala 22ac78b
Rewrote isValidFunctions.ts isEmailValid function
anttiasmala 508d84a
Added a check to only return the gifts the requester has an access to…
anttiasmala 9c973ac
Added a check to only return the gifts, allow updating the gift and d…
anttiasmala efc9171
Removed debugging console.logs
anttiasmala 1f6afac
Re-positioned Gift, User, Session export
anttiasmala db064d0
Reverting the removal of userId in Session model inside schema.prisma…
anttiasmala ef0882f
Added DatabaseSessionAttributes to have string value called userUUID
anttiasmala 724178a
Changed variable userCreationRequest to be userData. Replaced the con…
anttiasmala 7e9373b
Replaced AND statments with a better solution
anttiasmala 135dfe5
Replaced connects with a better solution
anttiasmala 7e4a63a
Fixed handleDELETE to not use AND statement in pages/api/gifts/[uuid]…
anttiasmala bb966a5
Fixed import/newline-after-import error
anttiasmala 57a8e30
Fixed handleGET to not use AND statement in /pages/api/gifts/[uuid].ts
anttiasmala File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
DATABASE_URL="postgresql://databaseusername:databasepassword@localhost:5432/mydb?schema=public" # README.md's section "Setting the environment variables" will help with this | ||
POSTGRES_USERNAME="databaseusername" # Postgres database's username. It is same as DATABASE_URL's databaseusername | ||
POSTGRES_PASSWORD="databasepassword" # Postgres database's password. It is same as DATABASE_URL's databasepassword |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
Muistaakseni Prismassa
AND
on oletuksenawhere
lausekkeessa, joten kokeilepa toimisiko tämä vähän yksinkertaisempi muoto: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.
Näytti toimivan kun kokeilin! Hyvä löyty, selkeyttää huomattavasti koodia! Kiitos! :)
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.
Meikä on painanut hiukan liian kovalla kaasulla, kun tämäkin näköjään on jäänyt korjaamatta 😅
Tämä on siis korjattu ja kokeiltu, että toimii, vielä en pushannut sitä 👍
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.
Pushaa vain niin saadaan korjaus mukaan 👍