Spaces:
Running
Running
Build a Password generator - Initial Deployment
Browse files- README.md +7 -5
- index.html +281 -19
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: password-generator
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: green
|
| 5 |
+
colorTo: gray
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,281 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>SecurePass Generator</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 9 |
+
<style>
|
| 10 |
+
.password-strength-bar {
|
| 11 |
+
height: 8px;
|
| 12 |
+
transition: all 0.3s ease;
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
@keyframes pulse {
|
| 16 |
+
0% { transform: scale(1); }
|
| 17 |
+
50% { transform: scale(1.05); }
|
| 18 |
+
100% { transform: scale(1); }
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
.glow {
|
| 22 |
+
box-shadow: 0 0 15px rgba(59, 130, 246, 0.6);
|
| 23 |
+
animation: pulse 2s infinite;
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
.copy-btn:hover i {
|
| 27 |
+
transform: rotate(-30deg);
|
| 28 |
+
transition: transform 0.3s ease;
|
| 29 |
+
}
|
| 30 |
+
</style>
|
| 31 |
+
</head>
|
| 32 |
+
<body class="bg-gray-900 min-h-screen flex flex-col items-center justify-center p-4">
|
| 33 |
+
<div class="max-w-md w-full bg-gray-800 rounded-xl shadow-2xl overflow-hidden border border-gray-700">
|
| 34 |
+
<div class="p-6">
|
| 35 |
+
<div class="flex items-center justify-between mb-6">
|
| 36 |
+
<h1 class="text-2xl font-bold text-white flex items-center">
|
| 37 |
+
<i class="fas fa-lock text-blue-400 mr-3"></i>
|
| 38 |
+
SecurePass Generator
|
| 39 |
+
</h1>
|
| 40 |
+
<span class="bg-blue-900 text-blue-200 px-3 py-1 rounded-full text-xs font-semibold">beta</span>
|
| 41 |
+
</div>
|
| 42 |
+
|
| 43 |
+
<div class="relative mb-6">
|
| 44 |
+
<div class="flex items-stretch">
|
| 45 |
+
<input
|
| 46 |
+
id="password-output"
|
| 47 |
+
type="text"
|
| 48 |
+
readonly
|
| 49 |
+
class="w-full px-4 py-3 rounded-l-lg bg-gray-700 text-white font-mono focus:outline-none focus:ring-2 focus:ring-blue-500 truncate"
|
| 50 |
+
placeholder="Your password will appear here"
|
| 51 |
+
>
|
| 52 |
+
<button
|
| 53 |
+
id="copy-btn"
|
| 54 |
+
class="copy-btn bg-blue-600 hover:bg-blue-500 px-4 rounded-r-lg transition-all duration-200 flex items-center justify-center"
|
| 55 |
+
title="Copy to clipboard"
|
| 56 |
+
>
|
| 57 |
+
<i class="fas fa-copy text-white"></i>
|
| 58 |
+
</button>
|
| 59 |
+
</div>
|
| 60 |
+
|
| 61 |
+
<div class="flex items-center mt-2">
|
| 62 |
+
<div id="password-strength-bar" class="password-strength-bar w-full rounded-full bg-gray-600"></div>
|
| 63 |
+
<span id="password-strength-text" class="ml-3 text-xs font-semibold text-gray-400">Weak</span>
|
| 64 |
+
</div>
|
| 65 |
+
</div>
|
| 66 |
+
|
| 67 |
+
<div class="space-y-4">
|
| 68 |
+
<div class="flex items-center justify-between">
|
| 69 |
+
<label for="password-length" class="text-gray-300 font-medium">Length</label>
|
| 70 |
+
<div class="flex items-center">
|
| 71 |
+
<input
|
| 72 |
+
type="range"
|
| 73 |
+
id="password-length"
|
| 74 |
+
min="6"
|
| 75 |
+
max="32"
|
| 76 |
+
value="12"
|
| 77 |
+
class="w-32 mr-4 accent-blue-500"
|
| 78 |
+
>
|
| 79 |
+
<span id="length-value" class="w-8 text-right font-mono font-bold text-white">12</span>
|
| 80 |
+
</div>
|
| 81 |
+
</div>
|
| 82 |
+
|
| 83 |
+
<div class="flex items-center justify-between">
|
| 84 |
+
<label for="uppercase" class="text-gray-300 font-medium">Uppercase (ABC)</label>
|
| 85 |
+
<div class="relative inline-block w-10 mr-2 align-middle select-none">
|
| 86 |
+
<input
|
| 87 |
+
type="checkbox"
|
| 88 |
+
id="uppercase"
|
| 89 |
+
checked
|
| 90 |
+
class="toggle-checkbox absolute block w-6 h-6 rounded-full bg-white border-4 appearance-none cursor-pointer"
|
| 91 |
+
>
|
| 92 |
+
<label for="uppercase" class="toggle-label block overflow-hidden h-6 rounded-full bg-gray-300 cursor-pointer"></label>
|
| 93 |
+
</div>
|
| 94 |
+
</div>
|
| 95 |
+
|
| 96 |
+
<div class="flex items-center justify-between">
|
| 97 |
+
<label for="lowercase" class="text-gray-300 font-medium">Lowercase (abc)</label>
|
| 98 |
+
<div class="relative inline-block w-10 mr-2 align-middle select-none">
|
| 99 |
+
<input
|
| 100 |
+
type="checkbox"
|
| 101 |
+
id="lowercase"
|
| 102 |
+
checked
|
| 103 |
+
class="toggle-checkbox absolute block w-6 h-6 rounded-full bg-white border-4 appearance-none cursor-pointer"
|
| 104 |
+
>
|
| 105 |
+
<label for="lowercase" class="toggle-label block overflow-hidden h-6 rounded-full bg-gray-300 cursor-pointer"></label>
|
| 106 |
+
</div>
|
| 107 |
+
</div>
|
| 108 |
+
|
| 109 |
+
<div class="flex items-center justify-between">
|
| 110 |
+
<label for="numbers" class="text-gray-300 font-medium">Numbers (123)</label>
|
| 111 |
+
<div class="relative inline-block w-10 mr-2 align-middle select-none">
|
| 112 |
+
<input
|
| 113 |
+
type="checkbox"
|
| 114 |
+
id="numbers"
|
| 115 |
+
checked
|
| 116 |
+
class="toggle-checkbox absolute block w-6 h-6 rounded-full bg-white border-4 appearance-none cursor-pointer"
|
| 117 |
+
>
|
| 118 |
+
<label for="numbers" class="toggle-label block overflow-hidden h-6 rounded-full bg-gray-300 cursor-pointer"></label>
|
| 119 |
+
</div>
|
| 120 |
+
</div>
|
| 121 |
+
|
| 122 |
+
<div class="flex items-center justify-between">
|
| 123 |
+
<label for="symbols" class="text-gray-300 font-medium">Symbols (!@#)</label>
|
| 124 |
+
<div class="relative inline-block w-10 mr-2 align-middle select-none">
|
| 125 |
+
<input
|
| 126 |
+
type="checkbox"
|
| 127 |
+
id="symbols"
|
| 128 |
+
class="toggle-checkbox absolute block w-6 h-6 rounded-full bg-white border-4 appearance-none cursor-pointer"
|
| 129 |
+
>
|
| 130 |
+
<label for="symbols" class="toggle-label block overflow-hidden h-6 rounded-full bg-gray-300 cursor-pointer"></label>
|
| 131 |
+
</div>
|
| 132 |
+
</div>
|
| 133 |
+
</div>
|
| 134 |
+
|
| 135 |
+
<button
|
| 136 |
+
id="generate-btn"
|
| 137 |
+
class="w-full mt-8 bg-blue-600 hover:bg-blue-500 text-white py-3 px-4 rounded-lg font-bold transition-all duration-200 flex items-center justify-center glow"
|
| 138 |
+
>
|
| 139 |
+
<i class="fas fa-key mr-2"></i>
|
| 140 |
+
Generate Password
|
| 141 |
+
</button>
|
| 142 |
+
|
| 143 |
+
<div class="mt-6 flex justify-between items-center">
|
| 144 |
+
<span class="text-xs text-gray-400">
|
| 145 |
+
Passwords are generated in your browser and never stored
|
| 146 |
+
</span>
|
| 147 |
+
<button id="history-btn" class="text-blue-400 hover:text-blue-300 text-sm font-medium">
|
| 148 |
+
<i class="fas fa-history mr-1"></i>
|
| 149 |
+
History
|
| 150 |
+
</button>
|
| 151 |
+
</div>
|
| 152 |
+
</div>
|
| 153 |
+
|
| 154 |
+
<div id="history-panel" class="hidden bg-gray-700 border-t border-gray-600 max-h-60 overflow-y-auto">
|
| 155 |
+
<div class="p-4">
|
| 156 |
+
<div class="flex items-center justify-between mb-3">
|
| 157 |
+
<h3 class="text-white font-medium">Password History</h3>
|
| 158 |
+
<button id="clear-history" class="text-red-400 hover:text-red-300 text-sm">
|
| 159 |
+
<i class="fas fa-trash mr-1"></i>
|
| 160 |
+
Clear
|
| 161 |
+
</button>
|
| 162 |
+
</div>
|
| 163 |
+
<ul id="history-list" class="space-y-2">
|
| 164 |
+
<!-- History items will be added here -->
|
| 165 |
+
</ul>
|
| 166 |
+
</div>
|
| 167 |
+
</div>
|
| 168 |
+
</div>
|
| 169 |
+
|
| 170 |
+
<script>
|
| 171 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 172 |
+
// DOM Elements
|
| 173 |
+
const passwordOutput = document.getElementById('password-output');
|
| 174 |
+
const generateBtn = document.getElementById('generate-btn');
|
| 175 |
+
const copyBtn = document.getElementById('copy-btn');
|
| 176 |
+
const passwordLength = document.getElementById('password-length');
|
| 177 |
+
const lengthValue = document.getElementById('length-value');
|
| 178 |
+
const uppercaseCB = document.getElementById('uppercase');
|
| 179 |
+
const lowercaseCB = document.getElementById('lowercase');
|
| 180 |
+
const numbersCB = document.getElementById('numbers');
|
| 181 |
+
const symbolsCB = document.getElementById('symbols');
|
| 182 |
+
const passwordStrengthBar = document.getElementById('password-strength-bar');
|
| 183 |
+
const passwordStrengthText = document.getElementById('password-strength-text');
|
| 184 |
+
const historyBtn = document.getElementById('history-btn');
|
| 185 |
+
const historyPanel = document.getElementById('history-panel');
|
| 186 |
+
const historyList = document.getElementById('history-list');
|
| 187 |
+
const clearHistoryBtn = document.getElementById('clear-history');
|
| 188 |
+
|
| 189 |
+
// Character sets
|
| 190 |
+
const characterSets = {
|
| 191 |
+
uppercase: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
| 192 |
+
lowercase: 'abcdefghijklmnopqrstuvwxyz',
|
| 193 |
+
numbers: '0123456789',
|
| 194 |
+
symbols: '!@#$%^&*()_+~`|}{[]:;?><,./-='
|
| 195 |
+
};
|
| 196 |
+
|
| 197 |
+
// Password history array
|
| 198 |
+
let passwordHistory = JSON.parse(localStorage.getItem('passwordHistory')) || [];
|
| 199 |
+
|
| 200 |
+
// Update length value display
|
| 201 |
+
passwordLength.addEventListener('input', function() {
|
| 202 |
+
lengthValue.textContent = this.value;
|
| 203 |
+
});
|
| 204 |
+
|
| 205 |
+
// Generate password function
|
| 206 |
+
function generatePassword() {
|
| 207 |
+
const length = parseInt(passwordLength.value);
|
| 208 |
+
const hasUppercase = uppercaseCB.checked;
|
| 209 |
+
const hasLowercase = lowercaseCB.checked;
|
| 210 |
+
const hasNumbers = numbersCB.checked;
|
| 211 |
+
const hasSymbols = symbolsCB.checked;
|
| 212 |
+
|
| 213 |
+
// Validate at least one character set is selected
|
| 214 |
+
if (!hasUppercase && !hasLowercase && !hasNumbers && !hasSymbols) {
|
| 215 |
+
passwordOutput.value = 'Select at least one option';
|
| 216 |
+
passwordOutput.classList.add('text-red-400');
|
| 217 |
+
return;
|
| 218 |
+
} else {
|
| 219 |
+
passwordOutput.classList.remove('text-red-400');
|
| 220 |
+
}
|
| 221 |
+
|
| 222 |
+
// Build character pool
|
| 223 |
+
let charPool = '';
|
| 224 |
+
if (hasUppercase) charPool += characterSets.uppercase;
|
| 225 |
+
if (hasLowercase) charPool += characterSets.lowercase;
|
| 226 |
+
if (hasNumbers) charPool += characterSets.numbers;
|
| 227 |
+
if (hasSymbols) charPool += characterSets.symbols;
|
| 228 |
+
|
| 229 |
+
// Generate password
|
| 230 |
+
let password = '';
|
| 231 |
+
for (let i = 0; i < length; i++) {
|
| 232 |
+
const randomIndex = Math.floor(Math.random() * charPool.length);
|
| 233 |
+
password += charPool[randomIndex];
|
| 234 |
+
}
|
| 235 |
+
|
| 236 |
+
// Display and save password
|
| 237 |
+
passwordOutput.value = password;
|
| 238 |
+
updatePasswordStrength(password);
|
| 239 |
+
addToHistory(password);
|
| 240 |
+
}
|
| 241 |
+
|
| 242 |
+
// Copy password to clipboard
|
| 243 |
+
copyBtn.addEventListener('click', function() {
|
| 244 |
+
if (!passwordOutput.value) return;
|
| 245 |
+
|
| 246 |
+
navigator.clipboard.writeText(passwordOutput.value).then(() => {
|
| 247 |
+
const originalContent = copyBtn.innerHTML;
|
| 248 |
+
copyBtn.innerHTML = '<i class="fas fa-check text-white"></i>';
|
| 249 |
+
copyBtn.classList.add('bg-green-500');
|
| 250 |
+
copyBtn.classList.remove('bg-blue-600');
|
| 251 |
+
|
| 252 |
+
setTimeout(() => {
|
| 253 |
+
copyBtn.innerHTML = originalContent;
|
| 254 |
+
copyBtn.classList.add('bg-blue-600');
|
| 255 |
+
copyBtn.classList.remove('bg-green-500');
|
| 256 |
+
}, 2000);
|
| 257 |
+
});
|
| 258 |
+
});
|
| 259 |
+
|
| 260 |
+
// Update password strength indicator
|
| 261 |
+
function updatePasswordStrength(password) {
|
| 262 |
+
let strength = 0;
|
| 263 |
+
|
| 264 |
+
// Length score
|
| 265 |
+
strength += Math.min(password.length / 8, 3);
|
| 266 |
+
|
| 267 |
+
// Character diversity score
|
| 268 |
+
if (/[A-Z]/.test(password)) strength += 1;
|
| 269 |
+
if (/[a-z]/.test(password)) strength += 1;
|
| 270 |
+
if (/[0-9]/.test(password)) strength += 1;
|
| 271 |
+
if (/[^A-Za-z0-9]/.test(password)) strength += 1;
|
| 272 |
+
|
| 273 |
+
// Normalize to 0-1 range
|
| 274 |
+
strength = Math.min(strength / 5, 1);
|
| 275 |
+
|
| 276 |
+
// Update UI
|
| 277 |
+
const strengthPercent = Math.round(strength * 100);
|
| 278 |
+
|
| 279 |
+
if (
|
| 280 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=openaitrend/password-generator" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 281 |
+
</html>
|