forked from PriyaGhosal/SkillWise
-
Notifications
You must be signed in to change notification settings - Fork 0
/
signup.html
129 lines (115 loc) · 5.21 KB
/
signup.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<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>
<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-Up</strong> to Create your personal learning dashboard Account</p>
<form action="#" method="POST">
<div class="input-group">
<label for="username">Full Name</label>
<input type="text" id="fullname" name="fullname" placeholder="Create your username" required required pattern="[a-zA-Z ]+" oninvalid="this.setCustomValidity('Numbers and Symbols are not allowed')"
oninput="this.setCustomValidity('')">
</div>
<div class="input-group">
<label for="username">Username</label>
<input type="text" id="username" name="username" placeholder="Create 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" oninput="checkPasswordStrength()" required>
<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 id="strength_msg">Use special characters and numbers for a strong password</small>
</p>
<button type="submit" class="signin-btn">Sign Up</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");
});
function checkPasswordStrength() {
const password = document.getElementById('password').value;
const strengthBar = document.getElementById('strengthBar');
const strength_text = document.getElementById('strength_msg');
let strength = 0;
if (password.length >= 8) strength += 1;
if (/[A-Z]/.test(password)) strength += 1;
if (/[a-z]/.test(password)) strength += 1;
if (/[0-9]/.test(password)) strength += 1;
if (/[\W]/.test(password)) strength += 1;
switch (strength) {
case 1:
strengthBar.style.width = '20%';
strengthBar.style.backgroundColor = 'red';
strength_text.textContent = "Password Strength : Very Weak";
break;
case 2:
strengthBar.style.width = '40%';
strengthBar.style.backgroundColor = 'orange';
strength_text.textContent = "Password Strength : Weak";
break;
case 3:
strengthBar.style.width = '60%';
strengthBar.style.backgroundColor = 'yellow';
strength_text.textContent = "Password Strength : Moderate";
break;
case 4:
strengthBar.style.width = '80%';
strengthBar.style.backgroundColor = 'lightgreen';
strength_text.textContent = "Password Strength : Good";
break;
case 5:
strengthBar.style.width = '100%';
strengthBar.style.backgroundColor = 'green';
strength_text.textContent = "Password Strength : Strong";
break;
default:
strengthBar.style.width = '0%';
strength_text.textContent ="Use special characters and numbers for a strong password";
break;
}
}
</script>
</body>
</html>