forked from mansiruhil13/Bobble-AI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
up.html
134 lines (116 loc) · 5.17 KB
/
up.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
130
131
132
133
134
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sign Up</title>
<link rel="stylesheet" href="src/css/up.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css" integrity="sha512-Kc323vGBEqzTmouAECnVceyQqyqdsSiqLQISBL29aUW4U/M7pSPA/gEUZQqv1cwx4OnYxTxve5UMg5GT6L4JJg==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<style>
.toggle-password {
cursor: pointer;
position: absolute;
right: 10px;
top: 35px;
}
.form-group {
position: relative;
}
.password-strength {
margin-top: 10px;
font-size: 0.9em;
}
.password-strength span {
display: inline-block;
width: 100px;
height: 10px;
background-color: #ddd;
margin-right: 5px;
}
.password-strength .weak {
background-color: red;
}
.password-strength .medium {
background-color: orange;
}
.password-strength .strong {
background-color: green;
}
</style>
</head>
<body>
<div class="signup-container">
<h1>Create Your Account</h1>
<form id="signupForm">
<div class="form-group">
<label for="username">Username</label>
<input type="text" id="username" name="username" required>
</div>
<div class="form-group">
<label for="email">Email</label>
<input type="email" id="email" name="email" required>
</div>
<div class="form-group">
<label for="password">Password</label>
<input type="password" id="password" name="password" required oninput="checkPasswordStrength()">
<i class="fas fa-eye toggle-password" id="togglePassword" onclick="togglePassword('password', this)"></i>
<div class="password-strength" id="password-strength">
<span id="strength-weak"></span>
<span id="strength-medium"></span>
<span id="strength-strong"></span>
</div>
</div>
<div class="form-group">
<label for="confirm-password">Confirm Password</label>
<input type="password" id="confirm-password" name="confirm-password" required>
<i class="fas fa-eye toggle-password" id="toggleConfirmPassword" onclick="togglePassword('confirm-password', this)"></i>
</div>
<button type="submit">Sign Up</button>
</form>
<p>Already have an account? <a href="login.html">Log In</a></p>
</div>
<script>
document.getElementById('signupForm').addEventListener('submit', function(event) {
event.preventDefault();
// Dummy signup logic for demo purposes
const username = document.getElementById('username').value;
const email = document.getElementById('email').value;
const password = document.getElementById('password').value;
// Store the signup data
localStorage.setItem('username', username);
localStorage.setItem('email', email);
localStorage.setItem('password', password);
localStorage.setItem('isLoggedIn', 'true');
alert('Signup successful!');
window.location.href = 'ambtracker.html'; // Redirect to tracker page
});
function togglePassword(fieldId, icon) {
const field = document.getElementById(fieldId);
const isPassword = field.type === 'password';
// Toggle between 'password' and 'text'
field.type = isPassword ? 'text' : 'password';
// Change the icon class between eye and eye-slash
icon.classList.toggle('fa-eye-slash', isPassword);
icon.classList.toggle('fa-eye', !isPassword);
}
function checkPasswordStrength() {
const password = document.getElementById('password').value;
const strengthWeak = document.getElementById('strength-weak');
const strengthMedium = document.getElementById('strength-medium');
const strengthStrong = document.getElementById('strength-strong');
let strength = 0;
if (password.length >= 8) strength++;
if (password.match(/[A-Z]/)) strength++;
if (password.match(/[a-z]/)) strength++;
if (password.match(/[0-9]/)) strength++;
if (password.match(/[^a-zA-Z0-9]/)) strength++;
strengthWeak.className = '';
strengthMedium.className = '';
strengthStrong.className = '';
if (strength >= 1) strengthWeak.className = 'weak';
if (strength >= 3) strengthMedium.className = 'medium';
if (strength >= 5) strengthStrong.className = 'strong';
}
</script>
</body>
</html>