Skip to content

Commit

Permalink
Merge pull request #336 from Sankar-1110/main
Browse files Browse the repository at this point in the history
Added password visibility
  • Loading branch information
PriyaGhosal authored Oct 9, 2024
2 parents aeefcc1 + cf70090 commit e37f2a1
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 4 deletions.
20 changes: 20 additions & 0 deletions assets/css/signin.css
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,26 @@ p {
border-radius: 4px;
box-sizing: border-box;
}
.password{
border: 1px solid #ccc;
border-radius: 4px;
display: flex;
justify-content: space-between;
align-items: center;
padding-right: 12px;

}

.password input{
width: 80%;
padding: 10px;
box-sizing: border-box;
border: none;
}
.password input:focus{
outline: none;
}


.signin-btn {
width: 100%;
Expand Down
23 changes: 21 additions & 2 deletions signin.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<title>SkillWise - Sign In</title>
<link rel="stylesheet" href="assets/css/signin.css">
<link rel="shortcut icon" href="./favicon.svg" type="image/svg+xml">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css"/>
</head>
<body>
<div class="container">
Expand All @@ -27,12 +28,30 @@ <h1>Welcome to <span class="brand">SkillWise</span></h1>
</div>
<div class="input-group">
<label for="password">Password</label>
<input type="password" id="password" name="password" placeholder="Enter your password" required>
</div>
<div class="password">
<input type="password" id="password" name="password" placeholder="Enter your password" required>
<i class="fa-solid fa-eye-slash" id="togglePassword"></i>
</div>
</div>
<button type="submit" class="signin-btn">Sign In</button>
<p class="signup-link">Don't have an account? <a href="./signup.html">Sign up here</a></p>
</form>
</div>
</div>
<script src="https://kit.fontawesome.com/a076d05399.js"></script>
<script >
const togglePassword = document.querySelector("#togglePassword");
const passwordInput = document.querySelector("#password");

togglePassword.addEventListener("click", function () {
const type = passwordInput.getAttribute("type") === "password" ? "text": "password";
passwordInput.setAttribute("type", type);

this.classList.toggle("fa-eye-slash");
this.classList.toggle("fa-eye");
});

</script>

</body>
</html>
21 changes: 19 additions & 2 deletions signup.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<title>SkillWise - Sign up</title>
<link rel="stylesheet" href="assets/css/signin.css">
<link rel="shortcut icon" href="./favicon.svg" type="image/svg+xml">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css"/>
</head>
<body>
<div class="container">
Expand All @@ -31,12 +32,28 @@ <h1>Welcome to <span class="brand">SkillWise</span></h1>
</div>
<div class="input-group">
<label for="password">Password</label>
<input type="password" id="password" name="password" placeholder="Enter your password" required>
</div>
<div class="password">
<input type="password" id="password" name="password" placeholder="Enter your password" required>
<i class="fa-solid fa-eye-slash" id="togglePassword"></i>
</div> </div>
<button type="submit" class="signin-btn">Sign In</button>
<p class="signup-link">Already have an account? <a href="./signin.html">Sign in here</a></p>
</form>
</div>
</div>
<script src="https://kit.fontawesome.com/a076d05399.js"></script>
<script >
const togglePassword = document.querySelector("#togglePassword");
const passwordInput = document.querySelector("#password");

togglePassword.addEventListener("click", function () {
const type = passwordInput.getAttribute("type") === "password" ? "text": "password";
passwordInput.setAttribute("type", type);

this.classList.toggle("fa-eye-slash");
this.classList.toggle("fa-eye");
});

</script>
</body>
</html>

0 comments on commit e37f2a1

Please sign in to comment.