Skip to content
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

Validación de contraseña #123

Merged
merged 3 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 0 additions & 108 deletions statsservice/model/stats-getter.js

This file was deleted.

7 changes: 7 additions & 0 deletions users/userservice/user-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ app.post("/adduser", async (req, res) => {

const username = req.body.username;

const passwordRegex = /^(?=.*[A-Z])(?=.*\d).{8,}$/;
if (!passwordRegex.test(password)) {
return res.status(401).json({
error: "Password must be at least 8 characters long, contain at least one uppercase letter, and at least one number.",
});
}

// Check if the username already exists
const existingUser = await User.findOne({ username: username });
if (existingUser) {
Expand Down
Loading