-
-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathpassword-generator.html
More file actions
346 lines (308 loc) · 17.8 KB
/
password-generator.html
File metadata and controls
346 lines (308 loc) · 17.8 KB
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/png" href="images/logo.png">
<link rel="apple-touch-icon" href="images/logo.png">
<title>Strong Password Generator - Developer Toolkit | DevDunia</title>
<meta name="description" content="Generate secure, random passwords with customizable complexity and length. Free online password generator tool for developers.">
<script src="https://cdn.tailwindcss.com"></script>
<style>
body {
background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
}
.slider::-webkit-slider-thumb {
appearance: none;
height: 20px;
width: 20px;
border-radius: 50%;
background: #9333ea;
cursor: pointer;
}
.slider::-moz-range-thumb {
height: 20px;
width: 20px;
border-radius: 50%;
background: #9333ea;
cursor: pointer;
border: none;
}
</style>
</head>
<body class="h-screen lg:ml-72">
<!-- Background: Consistent Subtle Dark Gradient -->
<div class="fixed inset-0 -z-10 bg-gradient-to-br from-gray-900 via-slate-900 to-gray-900"></div>
<!-- Main Container -->
<div class="main-content">
<div class="relative z-10 container mx-auto px-4 pt-16 pb-24 sm:px-6 lg:px-8">
<!-- Page Header -->
<div class="text-center mb-12">
<h1 class="text-3xl sm:text-4xl font-bold mb-4 tracking-tight
text-transparent bg-clip-text bg-gradient-to-r from-purple-400 to-pink-500">
Strong Password Generator
</h1>
<p class="text-lg text-gray-400 max-w-2xl mx-auto">
Generate secure, random passwords with customizable complexity and length.
</p>
</div>
<!-- Tool Container -->
<div class="max-w-4xl mx-auto">
<div class="bg-slate-800/70 backdrop-blur-md rounded-lg shadow-lg border border-slate-700/60 p-6">
<!-- Password Display -->
<div class="mb-6">
<label for="password-output" class="block text-sm font-medium text-gray-300 mb-2">
Generated Password
</label>
<div class="relative">
<input
type="text"
id="password-output"
class="w-full px-4 py-3 bg-slate-700/50 border border-slate-600 rounded-lg text-gray-200 text-lg font-mono focus:outline-none focus:ring-2 focus:ring-purple-500 focus:border-transparent"
readonly
value="Click Generate to create a password"
>
<!-- Copy Button -->
<button id="copy-btn" class="absolute top-2 right-2 px-3 py-1 bg-slate-600 hover:bg-slate-700 text-white text-sm rounded transition-colors duration-200 flex items-center space-x-1">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v8a2 2 0 01-2 2h-2m-6-4l2 2m0 0l2-2m-2 2V10"></path>
</svg>
<span>Copy</span>
</button>
</div>
</div>
<!-- Settings Section -->
<div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-6">
<!-- Left Column -->
<div class="space-y-4">
<div>
<label for="password-length" class="block text-sm font-medium text-gray-300 mb-2">
Password Length: <span id="length-value" class="text-purple-400 font-medium">16</span>
</label>
<input
type="range"
id="password-length"
min="8"
max="64"
value="16"
class="w-full h-2 bg-slate-600 rounded-lg appearance-none cursor-pointer slider"
>
</div>
<div>
<label class="block text-sm font-medium text-gray-300 mb-3">Character Types</label>
<div class="space-y-2">
<label class="flex items-center space-x-3 cursor-pointer">
<input type="checkbox" id="uppercase" checked class="w-4 h-4 text-purple-600 bg-slate-700 border-slate-600 rounded focus:ring-purple-500">
<span class="text-gray-300">Uppercase Letters (A-Z)</span>
</label>
<label class="flex items-center space-x-3 cursor-pointer">
<input type="checkbox" id="lowercase" checked class="w-4 h-4 text-purple-600 bg-slate-700 border-slate-600 rounded focus:ring-purple-500">
<span class="text-gray-300">Lowercase Letters (a-z)</span>
</label>
<label class="flex items-center space-x-3 cursor-pointer">
<input type="checkbox" id="numbers" checked class="w-4 h-4 text-purple-600 bg-slate-700 border-slate-600 rounded focus:ring-purple-500">
<span class="text-gray-300">Numbers (0-9)</span>
</label>
<label class="flex items-center space-x-3 cursor-pointer">
<input type="checkbox" id="symbols" checked class="w-4 h-4 text-purple-600 bg-slate-700 border-slate-600 rounded focus:ring-purple-500">
<span class="text-gray-300">Symbols (!@#$%^&*)</span>
</label>
</div>
</div>
</div>
<!-- Right Column -->
<div class="space-y-4">
<div>
<label class="block text-sm font-medium text-gray-300 mb-3">Password Strength</label>
<div class="bg-slate-700/50 rounded-lg p-4">
<div class="flex items-center justify-between mb-2">
<span class="text-sm text-gray-400">Strength:</span>
<span id="strength-text" class="text-sm font-medium">Strong</span>
</div>
<div class="w-full bg-slate-600 rounded-full h-2">
<div id="strength-bar" class="bg-gradient-to-r from-red-500 via-yellow-500 to-green-500 h-2 rounded-full transition-all duration-300" style="width: 75%"></div>
</div>
<div class="mt-2 text-xs text-gray-400">
<span id="strength-details">Contains uppercase, lowercase, numbers, and symbols</span>
</div>
</div>
</div>
<div>
<label class="block text-sm font-medium text-gray-300 mb-2">Additional Options</label>
<div class="space-y-2">
<label class="flex items-center space-x-3 cursor-pointer">
<input type="checkbox" id="exclude-similar" class="w-4 h-4 text-purple-600 bg-slate-700 border-slate-600 rounded focus:ring-purple-500">
<span class="text-gray-300">Exclude similar characters (l, 1, I, O, 0)</span>
</label>
<label class="flex items-center space-x-3 cursor-pointer">
<input type="checkbox" id="exclude-ambiguous" class="w-4 h-4 text-purple-600 bg-slate-700 border-slate-600 rounded focus:ring-purple-500">
<span class="text-gray-300">Exclude ambiguous characters ({}, [], (), /, \, |)</span>
</label>
</div>
</div>
</div>
</div>
<!-- Action Buttons -->
<div class="flex flex-wrap gap-3 mb-6">
<button id="generate-btn" class="px-8 py-3 bg-purple-600 hover:bg-purple-700 text-white font-medium rounded-lg transition-colors duration-200 flex items-center space-x-2">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"></path>
</svg>
<span>Generate Password</span>
</button>
<button id="generate-multiple-btn" class="px-6 py-3 bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-lg transition-colors duration-200 flex items-center space-x-2">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"></path>
</svg>
<span>Generate Multiple</span>
</button>
</div>
<!-- Multiple Passwords Section -->
<div id="multiple-passwords" class="hidden">
<label class="block text-sm font-medium text-gray-300 mb-2">Multiple Passwords</label>
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3">
<div id="password1" class="bg-slate-700/50 border border-slate-600 rounded-lg p-3 font-mono text-sm text-gray-200"></div>
<div id="password2" class="bg-slate-700/50 border border-slate-600 rounded-lg p-3 font-mono text-sm text-gray-200"></div>
<div id="password3" class="bg-slate-700/50 border border-slate-600 rounded-lg p-3 font-mono text-sm text-gray-200"></div>
<div id="password4" class="bg-slate-700/50 border border-slate-600 rounded-lg p-3 font-mono text-sm text-gray-200"></div>
</div>
</div>
</div>
</div>
</div>
<!-- Footer include -->
<div id="footer"></div>
<script>
fetch("footer.html")
.then(response => response.text())
.then(data => {
document.getElementById("footer").innerHTML = data;
})
.catch(err => console.error("Failed to load footer:", err));
</script>
<script>
document.addEventListener('DOMContentLoaded', function() {
const passwordOutput = document.getElementById('password-output');
const copyBtn = document.getElementById('copy-btn');
const generateBtn = document.getElementById('generate-btn');
const generateMultipleBtn = document.getElementById('generate-multiple-btn');
const lengthSlider = document.getElementById('password-length');
const lengthValue = document.getElementById('length-value');
const strengthText = document.getElementById('strength-text');
const strengthBar = document.getElementById('strength-bar');
const strengthDetails = document.getElementById('strength-details');
const multiplePasswords = document.getElementById('multiple-passwords');
// Character sets
const chars = {
uppercase: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
lowercase: 'abcdefghijklmnopqrstuvwxyz',
numbers: '0123456789',
symbols: '!@#$%^&*()_+-=[]{}|;:,.<>?',
similar: 'l1IO0',
ambiguous: '{}[]()/\\|'
};
// Update length display
lengthSlider.addEventListener('input', function() {
lengthValue.textContent = this.value;
});
// Generate single password
generateBtn.addEventListener('click', function() {
const password = generatePassword();
passwordOutput.value = password;
updateStrengthIndicator(password);
hideMultiplePasswords();
});
// Generate multiple passwords
generateMultipleBtn.addEventListener('click', function() {
showMultiplePasswords();
document.getElementById('password1').textContent = generatePassword();
document.getElementById('password2').textContent = generatePassword();
document.getElementById('password3').textContent = generatePassword();
document.getElementById('password4').textContent = generatePassword();
});
// Copy password
copyBtn.addEventListener('click', function() {
passwordOutput.select();
document.execCommand('copy');
// Visual feedback
const originalText = copyBtn.innerHTML;
copyBtn.innerHTML = '<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path></svg><span>Copied!</span>';
copyBtn.classList.add('bg-green-600');
setTimeout(() => {
copyBtn.innerHTML = originalText;
copyBtn.classList.remove('bg-green-600');
}, 2000);
});
// Password generation function
function generatePassword() {
const length = parseInt(lengthSlider.value);
let availableChars = '';
let password = '';
// Build character set based on selected options
if (document.getElementById('uppercase').checked) availableChars += chars.uppercase;
if (document.getElementById('lowercase').checked) availableChars += chars.lowercase;
if (document.getElementById('numbers').checked) availableChars += chars.numbers;
if (document.getElementById('symbols').checked) availableChars += chars.symbols;
// Remove excluded characters
if (document.getElementById('exclude-similar').checked) {
availableChars = availableChars.split('').filter(char => !chars.similar.includes(char)).join('');
}
if (document.getElementById('exclude-ambiguous').checked) {
availableChars = availableChars.split('').filter(char => !chars.ambiguous.includes(char)).join('');
}
if (availableChars.length === 0) {
alert('Please select at least one character type!');
return '';
}
// Generate password
for (let i = 0; i < length; i++) {
password += availableChars.charAt(Math.floor(Math.random() * availableChars.length));
}
return password;
}
// Update strength indicator
function updateStrengthIndicator(password) {
let score = 0;
let details = [];
if (/[a-z]/.test(password)) { score += 1; details.push('lowercase'); }
if (/[A-Z]/.test(password)) { score += 1; details.push('uppercase'); }
if (/[0-9]/.test(password)) { score += 1; details.push('numbers'); }
if (/[^A-Za-z0-9]/.test(password)) { score += 1; details.push('symbols'); }
if (password.length >= 12) score += 1;
if (password.length >= 16) score += 1;
const strength = score <= 2 ? 'Weak' : score <= 4 ? 'Medium' : 'Strong';
const percentage = Math.min((score / 6) * 100, 100);
strengthText.textContent = strength;
strengthText.className = score <= 2 ? 'text-red-400' : score <= 4 ? 'text-yellow-400' : 'text-green-400';
strengthBar.style.width = percentage + '%';
strengthDetails.textContent = 'Contains: ' + details.join(', ');
}
// Show/hide multiple passwords
function showMultiplePasswords() {
multiplePasswords.classList.remove('hidden');
}
function hideMultiplePasswords() {
multiplePasswords.classList.add('hidden');
}
// Generate initial password
generateBtn.click();
});
</script>
</div>
</div>
<!-- Sidebar Scripts -->
<!-- Include Final Sidebar -->
<div id="sidebar-container"></div>
<script>
// Load final_sidebar.html content
fetch('final_sidebar.html')
.then(response => response.text())
.then(html => {
document.getElementById('sidebar-container').innerHTML = html;
})
.catch(error => {
console.error('Error loading sidebar:', error);
});
</script>
</body>
</html>