feat: Add initial identifier field to user management and update related functions

This commit is contained in:
2025-09-29 19:41:49 +02:00
parent fc5f0fd39a
commit e589d6667f
3 changed files with 34 additions and 6 deletions

View File

@@ -18,6 +18,7 @@ export default function EditUserPage() {
username: "",
role: "user",
is_active: true,
initial: "",
password: ""
});
const [loading, setLoading] = useState(true);
@@ -65,6 +66,7 @@ export default function EditUserPage() {
username: userData.username,
role: userData.role,
is_active: userData.is_active,
initial: userData.initial || "",
password: "" // Never populate password field
});
} catch (err) {
@@ -86,7 +88,8 @@ export default function EditUserPage() {
name: formData.name,
username: formData.username,
role: formData.role,
is_active: formData.is_active
is_active: formData.is_active,
initial: formData.initial.trim() || null
};
// Only include password if it's provided
@@ -253,6 +256,23 @@ export default function EditUserPage() {
</div>
</div>
<div>
<label className="block text-sm font-medium text-gray-700 mb-2">
Initial
</label>
<Input
type="text"
value={formData.initial}
onChange={(e) => setFormData({ ...formData, initial: e.target.value })}
placeholder="1-2 letter identifier"
maxLength={2}
className="w-full md:w-1/2"
/>
<p className="text-xs text-gray-500 mt-1">
Optional 1-2 letter identifier for the user
</p>
</div>
<div className="flex items-center">
<input
type="checkbox"