Skip to content
Open
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
4 changes: 3 additions & 1 deletion Password Generator/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ body{
font-family:'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
background-color: #1F2937;
}

#password{
color: white;
}
.container{
margin-left: 20%;
margin-right: 10%;
Expand Down
6 changes: 6 additions & 0 deletions Password Generator/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
<h2 id="headline1">Generate a</h2>
<h2 id="headline2">random password</h2>
<p id="line">Never use an insecure password</p>

<!-- New input field for password length -->
<div><label for="password" id="password">Password Length</label><br>
<input type="number" placeholder="e.g 12" id="passlen"></div>


<button id="btn">Generate Password</button>
<hr />
<div class="password-container">
Expand Down
26 changes: 13 additions & 13 deletions Password Generator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,25 @@ let headline = document.getElementById("headline1");
let body = document.querySelector("body");
let line = document.querySelector("#line");
let hr = document.querySelector("hr");
let headline2 = document.querySelector("#headline2");
let password = document.querySelector("#password");

mode.addEventListener("change", () => {
if (mode.checked) {
headline.style.color = "#000000";
body.style.backgroundColor = "#ECFDF5"
line.style.color = "#6B7280"
hr.style.color = "#E8E7E9"
headline2.style.color = "#10B981"


body.style.backgroundColor = "#ECFDF5";
line.style.color = "#6B7280";
hr.style.color = "#E8E7E9";
headline2.style.color = "#10B981";
password.style.color = "#000000";
} else {
headline2.style.color = "#55F991"
headline2.style.color = "#55F991";
headline.style.color = "aliceblue";
body.style.backgroundColor = "#1F2937"
hr.style.color = "#273549"
body.style.backgroundColor = "#1F2937";
hr.style.color = "#273549";
password.style.color = "#E8E7E9";
}
});


const lowercaseChars = "abcdefghijklmnopqrstuvwxyz";
const uppercaseChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const numberChars = "0123456789";
Expand All @@ -40,10 +39,11 @@ const generatePassword = (length) => {
};

const displayPassword = () => {
let number = Number(document.getElementById("passlen").value);
let dPassword1 = document.querySelector(".Password1");
dPassword1.textContent = generatePassword(13);
dPassword1.textContent = generatePassword(number);
let dPassword2 = document.querySelector(".Password2");
dPassword2.textContent = generatePassword(12);
dPassword2.textContent = generatePassword(number);
};

document.getElementById("btn").addEventListener("click", displayPassword);