Skip to content
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
22 changes: 15 additions & 7 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
frontend:
- '*.html'
- '*.css'
- '*.js'
- 'js/**/*'
- 'assets/**/*'
- changed-files:
- any-glob-to-any-file:
- '*.html'
- '*.css'
- '*.js'
- 'js/**/*'
- 'assets/**/*'

backend:
- 'backend/**/*'
- changed-files:
- any-glob-to-any-file:
- 'backend/**/*'

workflows:
- '.github/workflows/**/*'
- changed-files:
- any-glob-to-any-file:
- '.github/workflows/**/*'
13 changes: 8 additions & 5 deletions register.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
document.addEventListener("DOMContentLoaded", () => {
console.log("register.js loaded");

const btn = document.getElementById("registerSubmitBtn");

if (!btn) {
Expand Down Expand Up @@ -30,6 +28,14 @@ document.addEventListener("DOMContentLoaded", () => {
messageBox.style.color = "red";
return;
}

// Password complexity: at least one uppercase, one lowercase, one number, and one special character
const complexityRegex = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[@$!%*?&])[A-Za-z\\d@$!%*?&]{8,}$/;
if (!complexityRegex.test(password)) {
messageBox.innerText = "Password must contain at least one uppercase letter, one lowercase letter, one number, and one special character!";
messageBox.style.color = "red";
return;
}
if (password !== confirmPassword) {
messageBox.innerText = "Passwords do not match!";
messageBox.style.color = "red";
Expand All @@ -55,8 +61,6 @@ document.addEventListener("DOMContentLoaded", () => {
throw new Error(data.detail || "Registration failed");
}

console.log("Success:", data);

localStorage.setItem("token", data.access_token);
localStorage.setItem("user", JSON.stringify(data.user));

Expand All @@ -74,4 +78,3 @@ document.addEventListener("DOMContentLoaded", () => {
}
});
});
// TODO: Prevent signup triggers if password complexity score is poor
Loading