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

password visible #723

Closed
wants to merge 1 commit into from
Closed
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
17 changes: 17 additions & 0 deletions js/password.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
document.addEventListener("DOMContentLoaded", () => {
const passwordInput = document.getElementById("password");
const togglePasswordIcon = document.getElementById("toggle-password");
const icon = togglePasswordIcon.querySelector("i");

togglePasswordIcon.addEventListener("click", () => {
if (passwordInput.type === "password") {
passwordInput.type = "text";
icon.classList.remove("fa-eye");
icon.classList.add("fa-eye-slash");
} else {
passwordInput.type = "password";
icon.classList.remove("fa-eye-slash");
icon.classList.add("fa-eye");
}
});
});
29 changes: 10 additions & 19 deletions login.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<script src="https://www.gstatic.com/firebasejs/9.0.0/firebase-auth-compat.js"></script>
<script src="https://www.gstatic.com/firebasejs/9.0.0/firebase-database-compat.js"></script>
<link rel="stylesheet" href="login1.css">
<script src="./js/password.js"></script>
<link href='https://unpkg.com/[email protected]/css/boxicons.min.css' rel='stylesheet'>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"
integrity="sha512-iecdLmaskl7CVkqkXNQ/ZH/XLlvWZOJyj7Yy7tcenmpD1ypASozpmT/E0iPtmFIB46ZmdtAc9eNBvH0H/ZpiBw=="
Expand Down Expand Up @@ -78,13 +79,13 @@ <h1>LOGIN</h1>
<label for="username">Username</label>
<input type="text" name="Username" id="username" placeholder="Username">
</div>
<div class="textfield">
<label for="password">Password</label>
<input type="password" id="password" name="password" placeholder="Enter Password">
<span id="login-hide">
<i class='icon bx bxs-hide' style="font-size: 27px;"></i>
</span>
</div>
<div class="textfield">
<label for="password">Password</label>
<input type="password" id="password" name="password" placeholder="Enter Password">
<span id="toggle-password" class="icon">
<i class="fa fa-eye" style="font-size: 27px;"></i>
</span>
</div>
<button class="btn-login" onclick="validateLogin()">Login</button>
<h3>
<center>OR</center>
Expand Down Expand Up @@ -128,18 +129,8 @@ <h3>
const auth = firebase.auth();

// Password visibility toggle
const passwordInput = document.getElementById("password");
const hideLogo = document.getElementById("login-hide");
hideLogo.addEventListener("click", function () {
const passwordField = this.querySelector("i");
if (passwordInput.getAttribute("type") == "text") {
passwordInput.setAttribute("type", "password");
passwordField.classList.replace("bxs-show", "bxs-hide");
} else {
passwordInput.setAttribute("type", "text");
passwordField.classList.replace("bxs-hide", "bxs-show");
}
});



// Close button redirect
const closeBtn = document.querySelector('.close-btn');
Expand Down
25 changes: 15 additions & 10 deletions login1.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;700&display=swap');
@import url("https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;700&display=swap");

body {
margin: 0;
font-family: 'Noto Sans', sans-serif;
font-family: "Noto Sans", sans-serif;
}

body * {
Expand Down Expand Up @@ -30,7 +30,7 @@ body * {
flex-direction: column;
}

.left-login>h1 {
.left-login > h1 {
color: white;
font-size: 2.5vw;
}
Expand Down Expand Up @@ -59,7 +59,7 @@ body * {
background-color: white;
}

.card-login>h1 {
.card-login > h1 {
/* color: #8A2525; */
color: rgb(84, 50, 208);
font-weight: 800;
Expand All @@ -82,26 +82,26 @@ body * {
left: 84.9%;
}

.textfield>input {
.textfield > input {
width: 100%;
border: none;
border-radius: 10px;
padding: 15px;
background: #E6E6FA;
background: #e6e6fa;
color: #030707de;
font-size: 12pt;
box-shadow: 0px 3px 10px #00000056;
outline: none;
box-sizing: border-box;
}

.textfield>label {
.textfield > label {
color: black;
margin-bottom: 10px;
font-weight: bold;
}

.textfield>input::placeholder {
.textfield > input::placeholder {
color: #000000;
}

Expand Down Expand Up @@ -156,8 +156,13 @@ body * {
color: white;
}

.icon .fa-eye {
display: inline;
}


.icon .fa-eye-slash {
display: inline;
}

@media only screen and (max-width: 950px) {
.card-login {
Expand All @@ -170,7 +175,7 @@ body * {
flex-direction: column;
}

.left-login>h1 {
.left-login > h1 {
display: none;
}

Expand Down
Loading