summaryrefslogtreecommitdiff
path: root/public/account
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2025-05-10 18:42:16 +0500
committerilotterytea <iltsu@alright.party>2025-05-10 18:42:16 +0500
commitfb2fd0644c4f74e09a9fe6b8cc1af931c77b04df (patch)
tree795e5c1f6df29eab0285f3cdb4ac69c4e7c4aa01 /public/account
parent4752296add769dae0f2dcf4486dec21eee026c04 (diff)
upd: hide current password field if there is no password
Diffstat (limited to 'public/account')
-rw-r--r--public/account/index.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/public/account/index.php b/public/account/index.php
index 97c5942..e5a609b 100644
--- a/public/account/index.php
+++ b/public/account/index.php
@@ -190,8 +190,14 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {
<form action="/account/security.php" method="post">
<h2>Security & Privacy</h2>
<div>
- <label for="password-current">Current password:</label>
- <input type="password" name="password-current" id="form-password-current">
+ <?php
+ $stmt = $db->prepare("SELECT CASE WHEN password IS NOT NULL THEN 1 ELSE 0 END as set_password FROM users WHERE id = ?");
+ $stmt->execute([$_SESSION["user_id"]]);
+ $set_password = $stmt->fetch()[0];
+ if ($set_password): ?>
+ <label for="password-current">Current password:</label>
+ <input type="password" name="password-current" id="form-password-current" required>
+ <?php endif; ?>
<label for="password-new">New password:</label>
<input type="password" name="password-new" id="form-password-new">
</div>