Mai, Sofie & Wen | Project Authentication#333
Open
wwenzz wants to merge 72 commits intoTechnigo:masterfrom
Open
Mai, Sofie & Wen | Project Authentication#333wwenzz wants to merge 72 commits intoTechnigo:masterfrom
wwenzz wants to merge 72 commits intoTechnigo:masterfrom
Conversation
HIPPIEKICK
approved these changes
May 28, 2024
Contributor
HIPPIEKICK
left a comment
There was a problem hiding this comment.
Well working authentication with a cute frontend! Good job 🚀
Comment on lines
+16
to
+24
| username: { type: String, unique: true, required: true, minLength: 8 }, | ||
| email: { | ||
| type: String, | ||
| unique: true, | ||
| required: true, | ||
| match: /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/, | ||
| }, | ||
| password: { type: String, required: true }, | ||
| accessToken: { type: String, default: () => bcrypt.genSaltSync() }, |
Contributor
There was a problem hiding this comment.
Would be nice if all properties were formatted like the email one 😄
Comment on lines
+63
to
+84
| app.post("/signup", async (req, res) => { | ||
| try { | ||
| const { username, email, password } = req.body; | ||
| const user = new User({ | ||
| username, | ||
| email, | ||
| password: bcrypt.hashSync(password, 10), | ||
| }); | ||
| await user.save(); | ||
| res.status(201).json({ message: "Sign up successfully", success: true }); | ||
| } catch (error) { | ||
| console.log(error.message); | ||
| res.status(400).json({ | ||
| message: "Could not sign up.", | ||
| success: false, | ||
| error: error.message, | ||
| }); | ||
| } | ||
| }); | ||
|
|
||
| // Log-in | ||
| app.post("/login", async (req, res) => { |
Contributor
There was a problem hiding this comment.
Usually endpoints are named in plural nouns, after what they return or in this case create. So a name suggestion is: POST /users and POST /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.
Netlify link
Frontend: https://team-peace-auth.netlify.app
Backend: https://project-auth-lh3p.onrender.com
Collaborators
[maikanetaka, SofieFerrari]