Skip to content

Commit 385deb4

Browse files
Merge pull request #72 from C4aZy/feature/password-forge-game
Add Password Forge web game functionality
2 parents 76352ca + 3ef2f07 commit 385deb4

1 file changed

Lines changed: 101 additions & 0 deletions

File tree

web-app/js/projects.js

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ function getProjectHTML(projectName) {
2121
'morse-code': getMorseCodeHTML(),
2222
'tower-of-hanoi': getTowerOfHanoiHTML(),
2323
'snake-game': getsnakeGameHTML(),
24+
'password-forge': getPasswordForgeHTML(),
2425
};
2526

2627
return projects[projectName] || '<h2>Project Coming Soon!</h2>';
@@ -4840,3 +4841,103 @@ function initSnakeGame() {
48404841
}
48414842

48424843
// Call initSnakeGame() after you inject getsnakeGameHTML() into your page.
4844+
// ============================================
4845+
// PASSWORD FORGE
4846+
// ============================================
4847+
4848+
function getPasswordForgeHTML() {
4849+
return `
4850+
<div class="project-content">
4851+
<h2>🔐 Password Forge</h2>
4852+
4853+
<div class="game-container">
4854+
<p class="game-text">
4855+
Create a password that satisfies all firewall rules!
4856+
</p>
4857+
4858+
<input
4859+
type="text"
4860+
id="passwordInput"
4861+
placeholder="Enter password..."
4862+
class="password-input"
4863+
>
4864+
4865+
<button id="checkPasswordBtn" class="btn-check">
4866+
Check Password
4867+
</button>
4868+
4869+
<div id="rulesContainer" class="rules-container">
4870+
<p>❌ Must contain at least 8 characters</p>
4871+
<p>❌ Must contain a number</p>
4872+
<p>❌ Must contain an uppercase letter</p>
4873+
<p>❌ Must contain a special character</p>
4874+
</div>
4875+
4876+
<div id="passwordResult" class="result-message"></div>
4877+
</div>
4878+
</div>
4879+
4880+
<style>
4881+
.game-container {
4882+
text-align: center;
4883+
padding: 2rem;
4884+
}
4885+
4886+
.password-input {
4887+
width: 80%;
4888+
padding: 1rem;
4889+
border-radius: 10px;
4890+
border: 2px solid var(--border-color);
4891+
margin-top: 1rem;
4892+
font-size: 1rem;
4893+
}
4894+
4895+
.btn-check {
4896+
margin-top: 1rem;
4897+
padding: 0.8rem 1.5rem;
4898+
border: none;
4899+
border-radius: 10px;
4900+
background: var(--primary-color);
4901+
color: white;
4902+
cursor: pointer;
4903+
font-size: 1rem;
4904+
}
4905+
4906+
.btn-check:hover {
4907+
transform: scale(1.05);
4908+
}
4909+
4910+
.rules-container {
4911+
margin-top: 1.5rem;
4912+
text-align: left;
4913+
display: inline-block;
4914+
}
4915+
4916+
.result-message {
4917+
margin-top: 1.5rem;
4918+
font-size: 1.2rem;
4919+
font-weight: bold;
4920+
}
4921+
</style>
4922+
`;
4923+
}
4924+
4925+
function initPasswordForge() {
4926+
const checkBtn = document.getElementById('checkPasswordBtn');
4927+
4928+
checkBtn.addEventListener('click', () => {
4929+
const password = document.getElementById('passwordInput').value;
4930+
const result = document.getElementById('passwordResult');
4931+
4932+
const hasLength = password.length >= 8;
4933+
const hasNumber = /\d/.test(password);
4934+
const hasUpper = /[A-Z]/.test(password);
4935+
const hasSpecial = /[!@#$%^&*]/.test(password);
4936+
4937+
if (hasLength && hasNumber && hasUpper && hasSpecial) {
4938+
result.textContent = "✅ Strong Password!";
4939+
} else {
4940+
result.textContent = "❌ Password does not meet all rules!";
4941+
}
4942+
});
4943+
}

0 commit comments

Comments
 (0)