Skip to content

Commit

Permalink
Merge pull request #46 from RonitBaranwal/password-crediablility-29
Browse files Browse the repository at this point in the history
password-Crediability
  • Loading branch information
Kritika30032002 authored Oct 4, 2023
2 parents 4ba5845 + 394f899 commit db5b2db
Show file tree
Hide file tree
Showing 4 changed files with 5,866 additions and 56 deletions.
14 changes: 14 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,20 @@ app.get("/login",function(req,res){
app.get("/about",function(req,res){
res.render("about");
});
app.post("/register", function (req, res) {
const { username, password } = req.body;

// Server-side password validation
const regex = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/;
if (!regex.test(password)) {
return res.status(400).render("register", { error: "Invalid password" });
}

// Continue with registration logic
// ... (create user account, save to database, etc.)

res.status(200).send("Registration successful");
});
app.get("/register",function(req,res){
res.render("register");
});
Expand Down
Loading

0 comments on commit db5b2db

Please sign in to comment.