update
This commit is contained in:
parent
dfa46679a4
commit
3c08b76e90
|
|
@ -519,6 +519,117 @@ include 'static.php';
|
||||||
font-size: 13px
|
font-size: 13px
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ===== PASSWORD PAGE GLOBAL STYLES ===== */
|
||||||
|
|
||||||
|
.password-form {
|
||||||
|
max-width: 520px;
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.password-form .field {
|
||||||
|
margin-bottom: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.password-form label {
|
||||||
|
display: block;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
color: var(--muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
.password-form input {
|
||||||
|
width: 100%;
|
||||||
|
padding: 14px 12px;
|
||||||
|
border-radius: 10px;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
background: #020617;
|
||||||
|
color: var(--text);
|
||||||
|
font-size: 14px;
|
||||||
|
transition: .2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.password-form input:focus {
|
||||||
|
outline: none;
|
||||||
|
border-color: var(--accent);
|
||||||
|
box-shadow: 0 0 0 2px rgba(56, 189, 248, .15);
|
||||||
|
}
|
||||||
|
|
||||||
|
.password-form input:invalid {
|
||||||
|
border-color: #ef4444;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* divider between fields */
|
||||||
|
.password-form .field:not(:last-of-type) {
|
||||||
|
padding-bottom: 14px;
|
||||||
|
border-bottom: 1px dashed rgba(255, 255, 255, .05);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* strength bar container */
|
||||||
|
.strength {
|
||||||
|
margin-top: 8px;
|
||||||
|
height: 8px;
|
||||||
|
border-radius: 6px;
|
||||||
|
background: #111827;
|
||||||
|
overflow: hidden;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* strength fill */
|
||||||
|
.strength-bar {
|
||||||
|
height: 100%;
|
||||||
|
width: 0%;
|
||||||
|
background: #ef4444;
|
||||||
|
transition: .3s;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* strength text */
|
||||||
|
.strength-text {
|
||||||
|
font-size: 12px;
|
||||||
|
margin-top: 6px;
|
||||||
|
color: #94a3b8;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* colors by strength */
|
||||||
|
.strength-weak {
|
||||||
|
background: #ef4444
|
||||||
|
}
|
||||||
|
|
||||||
|
.strength-medium {
|
||||||
|
background: #f59e0b
|
||||||
|
}
|
||||||
|
|
||||||
|
.strength-good {
|
||||||
|
background: #22c55e
|
||||||
|
}
|
||||||
|
|
||||||
|
.strength-strong {
|
||||||
|
background: linear-gradient(90deg, #22c55e, #38bdf8);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* show password toggle */
|
||||||
|
.pass-toggle {
|
||||||
|
position: absolute;
|
||||||
|
right: 12px;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 13px;
|
||||||
|
color: #94a3b8;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pass-wrap {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* mobile */
|
||||||
|
@media(max-width:600px) {
|
||||||
|
.password-form {
|
||||||
|
max-width: 100%
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
|
||||||
|
|
@ -105,6 +105,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
<div class="card wide">
|
<div class="card wide">
|
||||||
<h3>Change Username / Password</h3>
|
<h3>Change Username / Password</h3>
|
||||||
|
|
||||||
<?php if ($error): ?>
|
<?php if ($error): ?>
|
||||||
<p style="color:#dc2626"><?= htmlspecialchars($error) ?></p>
|
<p style="color:#dc2626"><?= htmlspecialchars($error) ?></p>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
@ -112,32 +113,82 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
<?php if ($success): ?>
|
<?php if ($success): ?>
|
||||||
<p style="color:#16a34a"><?= htmlspecialchars($success) ?></p>
|
<p style="color:#16a34a"><?= htmlspecialchars($success) ?></p>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<form method="post" autocomplete="off">
|
|
||||||
|
<form method="post" class="password-form" autocomplete="off">
|
||||||
<input type="hidden" name="csrf" value="<?= htmlspecialchars($_SESSION['csrf']) ?>">
|
<input type="hidden" name="csrf" value="<?= htmlspecialchars($_SESSION['csrf']) ?>">
|
||||||
|
|
||||||
<p>
|
<div class="field">
|
||||||
<label>New Username (optional)</label><br>
|
<label>New Username (optional)</label>
|
||||||
<input type="text" name="new_username" placeholder="leave blank to keep current">
|
<input type="text" name="new_username" placeholder="leave blank to keep current">
|
||||||
</p>
|
</div>
|
||||||
|
|
||||||
<p>
|
<div class="field">
|
||||||
<label>Current Password (required)</label><br>
|
<label>Current Password</label>
|
||||||
<input type="password" name="current_password" required>
|
<div class="pass-wrap">
|
||||||
</p>
|
<input type="password" name="current_password" required>
|
||||||
|
<span class="pass-toggle" onclick="togglePass(this)">Show</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<p>
|
<div class="field">
|
||||||
<label>New Password (optional)</label><br>
|
<label>New Password</label>
|
||||||
<input type="password" name="new_password">
|
<div class="pass-wrap">
|
||||||
</p>
|
<input type="password" id="newpass" name="new_password" oninput="checkStrength(this.value)">
|
||||||
|
<span class="pass-toggle" onclick="togglePass(this)">Show</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
<p>
|
<div class="strength">
|
||||||
<label>Confirm New Password</label><br>
|
<div class="strength-bar" id="strengthBar"></div>
|
||||||
|
</div>
|
||||||
|
<div class="strength-text" id="strengthText">Password strength</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<label>Confirm New Password</label>
|
||||||
<input type="password" name="confirm_password">
|
<input type="password" name="confirm_password">
|
||||||
</p>
|
</div>
|
||||||
|
|
||||||
<button type="submit">Update</button>
|
<button type="submit">Update</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<script>
|
||||||
|
function togglePass(el) {
|
||||||
|
const input = el.parentElement.querySelector("input");
|
||||||
|
if (input.type === "password") {
|
||||||
|
input.type = "text";
|
||||||
|
el.textContent = "Hide";
|
||||||
|
} else {
|
||||||
|
input.type = "password";
|
||||||
|
el.textContent = "Show";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkStrength(p) {
|
||||||
|
let s = 0;
|
||||||
|
if (p.length > 5) s++;
|
||||||
|
if (p.length > 9) s++;
|
||||||
|
if (/[A-Z]/.test(p)) s++;
|
||||||
|
if (/[0-9]/.test(p)) s++;
|
||||||
|
if (/[^A-Za-z0-9]/.test(p)) s++;
|
||||||
|
|
||||||
|
const bar = document.getElementById("strengthBar");
|
||||||
|
const txt = document.getElementById("strengthText");
|
||||||
|
|
||||||
|
const lvl = [
|
||||||
|
["0%", ""],
|
||||||
|
["20%", "strength-weak", "Weak"],
|
||||||
|
["40%", "strength-weak", "Weak"],
|
||||||
|
["60%", "strength-medium", "Medium"],
|
||||||
|
["80%", "strength-good", "Good"],
|
||||||
|
["100%", "strength-strong", "Strong"]
|
||||||
|
][s];
|
||||||
|
|
||||||
|
bar.style.width = lvl[0];
|
||||||
|
bar.className = "strength-bar " + (lvl[1] || "");
|
||||||
|
txt.textContent = lvl[2] || "Password strength";
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
<?php include 'footer.php'; ?>
|
<?php include 'footer.php'; ?>
|
||||||
Loading…
Reference in New Issue