fix tests
This commit is contained in:
@@ -16,6 +16,7 @@ const errorMessage = document.getElementById("error-message");
|
||||
const errorText = document.getElementById("error-text");
|
||||
const generatePasswordBtn = document.getElementById("generate-password-btn");
|
||||
const generatedPasswordHint = document.getElementById("generated-password-hint");
|
||||
const mustChangePasswordInput = document.getElementById("must-change-password");
|
||||
const logoutBtn = document.getElementById("logout-btn");
|
||||
const currentUserEl = document.getElementById("username-display");
|
||||
const currentRoleEl = document.getElementById("role-badge");
|
||||
@@ -441,12 +442,13 @@ userForm.addEventListener("submit", async (e) => {
|
||||
const username = formData.get("username");
|
||||
const password = formData.get("password");
|
||||
const role = formData.get("role");
|
||||
const mustChangePassword = mustChangePasswordInput?.checked !== false;
|
||||
|
||||
try {
|
||||
const res = await fetch("/api/users", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ username, password, role }),
|
||||
body: JSON.stringify({ username, password, role, mustChangePassword }),
|
||||
});
|
||||
|
||||
const data = await res.json();
|
||||
|
||||
@@ -208,6 +208,20 @@
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<label class="flex items-start gap-3 rounded-lg border border-slate-700 bg-slate-800/50 p-3 cursor-pointer">
|
||||
<input
|
||||
id="must-change-password"
|
||||
name="mustChangePassword"
|
||||
type="checkbox"
|
||||
checked
|
||||
class="mt-0.5 h-4 w-4 accent-violet-500"
|
||||
/>
|
||||
<span>
|
||||
<span class="block text-sm font-medium text-slate-200">Prompt for password confirmation on first login</span>
|
||||
<span class="block text-xs text-slate-500 mt-0.5">The user may keep this password, but must enter it again before accessing the dashboard.</span>
|
||||
</span>
|
||||
</label>
|
||||
|
||||
<div
|
||||
id="error-message"
|
||||
class="hidden p-3 bg-red-900/20 border border-red-800 rounded-lg text-red-400 text-sm"
|
||||
|
||||
Reference in New Issue
Block a user