forked from PriyaGhosal/SkillWise
-
Notifications
You must be signed in to change notification settings - Fork 0
/
signin.html
112 lines (90 loc) · 3.96 KB
/
signin.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<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 style="overflow: hidden;">
<header>
<nav class="navbar">
<a href="./index.html" class="logo">SkillWise</a>
<ul style="margin-right: 2rem;">
<li>
<a href="./index.html" class="nav-link" style="margin-right: 0.5rem;">Home</a>
<i class="fa-solid fa-house"></i>
</li>
</ul>
</nav>
</header>
<div class="container">
<div class="form-container">
<!-- Add SkillWise Icon/Logo -->
<img src="assets/images/Skillwise_logo.jpg" alt="SkillWise Logo" class="logo">
<h1>Welcome to <span class="brand">SkillWise</span></h1>
<p><strong>Sign in</strong> to access your learning dashboard</p>
<form action="#" method="POST">
<div class="input-group">
<label for="username">Username</label>
<input type="text" id="username" name="username" placeholder="Enter your username" required>
</div>
<div class="input-group">
<label for="email">Email</label>
<input type="email" id="email" name="email" placeholder="Enter your email" required>
</div>
<div class="input-group">
<label for="password">Password</label>
<div class="password">
<input type="password" id="password" name="password" placeholder="Enter your password">
<i class="fa-solid fa-eye-slash" id="togglePassword"></i>
</div>
</div>
<!-- <div class="strength-bar">
<div id="strengthBar" class="strength-bar-inner"></div>
</div>
<p class="suggestion">
<small>Use special characters and numbers for a strong password</small>
</p> -->
<button type="submit" class="signin-btn" id="submit">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");
const submitBtn = document.querySelector("#submit");
const emailInput = document.querySelector("#email");
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");
});
submitBtn.addEventListener("click", (e) => {
e.preventDefault();
const email = emailInput.value;
const emailError = document.getElementById("emailError");
const emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/;
if (!emailPattern.test(email)) {
if (!emailError) {
const errorMsg = document.createElement("p");
errorMsg.id = "emailError";
errorMsg.style.color = "red";
errorMsg.textContent = "Email is incorrect. Please enter a valid email address.";
emailInput.parentElement.appendChild(errorMsg);
}
} else {
if (emailError) {
emailError.remove();
}
e.target.closest("form").submit();
}
});
</script>
</body>
</html>