-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstyle7.html.erb
127 lines (112 loc) · 2.85 KB
/
style7.html.erb
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dynamic Password Strength Display</title>
<link href="https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@400;700&family=Roboto:wght@400;500;700&display=swap" rel="stylesheet">
<style>
body {
margin: 0;
padding: 0;
background: #121212;
font-family: 'Roboto', sans-serif;
color: #ffffff;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
text-align: center;
}
.container {
width: 90%;
max-width: 400px;
}
.title {
margin-bottom: 24px;
color: #FBC02D;
}
.password-input {
position: relative;
margin-bottom: 16px;
}
input[type="text"] {
width: 100%;
padding: 10px;
margin-bottom: 6px;
border: 2px solid #FBC02D;
border-radius: 4px;
background: transparent;
color: #fff;
}
.strength-background {
height: 4px;
width: 100%;
background: rgba(255, 255, 255, 0.2);
border-radius: 2px;
}
.strength-bar {
height: 100%;
width: 0%;
border-radius: 2px;
transition: width 0.3s ease;
}
.password-hints {
color: #BDBDBD;
font-size: 14px;
}
/* Add classes for different strength levels */
.weak { background: #E53935; }
.medium { background: #FBC02D; }
.strong { background: #43A047; }
.very-strong { background: #1B5E20; }
</style>
</head>
<body>
<div class="container">
<h1 class="title">Password Strength Indicator</h1>
<div class="password-input">
<input type="text" id="password" placeholder="Type your password..." oninput="updateStrengthIndicator()">
<div class="strength-background">
<div class="strength-bar"></div>
</div>
</div>
<div class="password-hints">
<p>Use a mix of letters, numbers, and symbols to strengthen your password.</p>
</div>
</div>
<script>
function updateStrengthIndicator() {
const password = document.getElementById('password').value;
const strengthBar = document.querySelector('.strength-bar');
const strength = getStrength(password);
strengthBar.style.width = `${strength}%`;
if (strength < 25) {
strengthBar.className = 'strength-bar weak';
} else if (strength < 50) {
strengthBar.className = 'strength-bar medium';
} else if (strength < 75) {
strengthBar.className = 'strength-bar strong';
} else {
strengthBar.className = 'strength-bar very-strong';
}
}
function getStrength(password) {
let strength = 0;
if (password.match(/[a-zA-Z0-9]+/)) {
strength += 25;
}
if (password.match(/[!@#$%^&*()_]+/)) {
strength += 25;
}
if (password.length > 5) {
strength += 25;
}
if (password.length > 10) {
strength += 25;
}
return strength;
}
</script>
</body>
</html>