This commit is contained in:
nate 2026-04-09 08:06:38 +04:00
parent dc062767ac
commit ba2a682bb8
1 changed files with 1 additions and 11 deletions

View File

@ -175,17 +175,7 @@
</label> </label>
</div> </div>
<% <% const hasPassword = !it.isNew && p.password_hash; %>
// Three UI states for the password field:
// 1. New page or no password set → bare input, "leave blank for public"
// 2. Existing page with password set → "Password is set" badge + Change/Remove buttons
// 3. State (2), then user clicks Change → input revealed
// The hidden `remove_password` flag is set by the Remove button so the
// dashboard handler can forward an explicit `password: null` to the API.
// Without that flag, an empty input means "leave the existing password
// alone" (the form post handler drops empty strings on purpose).
const hasPassword = !it.isNew && p.password_hash;
%>
<div data-password-section> <div data-password-section>
<label class="block text-sm text-gray-400 mb-1.5">Password <span class="text-gray-600">(optional)</span></label> <label class="block text-sm text-gray-400 mb-1.5">Password <span class="text-gray-600">(optional)</span></label>
<% if (hasPassword) { %> <% if (hasPassword) { %>