mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-17 12:16:56 +02:00
Fix user editing and email field consistency across the platform
Update handleEditUser to prioritize firstName/lastName over the name field for user editing, and make the email field consistently optional in both create and edit forms. Replit-Commit-Author: Agent Replit-Commit-Session-Id: a8a78c07-e900-425c-a577-5b4c5894379d Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/a8a78c07-e900-425c-a577-5b4c5894379d/vetH0Gp
This commit is contained in:
1 parent
a3b457f990
commit
1e72358c6c
4 files changed
+231
-4
No files matched your search
@@ -455,9 +455,16 @@ export default function UsersPage() {
|
||||
};
|
||||
|
||||
const handleEditUser = (userData: UserWithGroups) => {
|
||||
// Convert the single 'name' field to firstName/lastName
|
||||
const [firstName = '', ...lastNameParts] = (userData.name || '').split(' ');
|
||||
const lastName = lastNameParts.join(' ');
|
||||
// Priority: use firstName/lastName if available, fallback to splitting 'name' field
|
||||
let firstName = userData.firstName || '';
|
||||
let lastName = userData.lastName || '';
|
||||
|
||||
// If no firstName/lastName but we have a 'name' field, try to split it
|
||||
if (!firstName && !lastName && userData.name) {
|
||||
const [firstPart = '', ...lastNameParts] = userData.name.split(' ');
|
||||
firstName = firstPart;
|
||||
lastName = lastNameParts.join(' ');
|
||||
}
|
||||
|
||||
const userWithNames = {
|
||||
...userData,
|
||||
|
||||
Reference in new issue
Block a user