API user creation does not set the user_full_name.

This commit is contained in:
2026-06-12 23:34:24 +02:00
parent d6079878c4
commit bc8976c18e

View File

@@ -35,7 +35,10 @@ if ($API_users->request_method === 'GET') {
# The user will need to verify their email, the password field cannot be NULL so set a random password for now till the user resets it on when verifying there email
$random_string = substr(str_shuffle(str_repeat('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01', 64)), 0, rand(50, 64));
$user_password = password_hash($random_string, PASSWORD_BCRYPT, ["cost" => 12]);
$API_users->postedData['user_password'] = $user_password;
$API_users->postedData['user_full_name'] = trim($API_users->postedData['user_first_name'] . ' ' . $API_users->postedData['user_last_name']);
$API_users->postedData['user_pref_language'] = $API_users->postedData['user_pref_language'] ?? 'en';
# Password reset token that will be sent to the newly created user
$API_users->postedData['user_password_reset_token'] = bin2hex(random_bytes(32));
@@ -65,9 +68,9 @@ if ($API_users->request_method === 'GET') {
'user_stompable' => ['type' => 'boolean']
];
$API_users->postedData['user_full_name'] = trim($_POST['user_first_name'] . ' ' . $_POST['user_last_name']);
$API_users->postedData['user_pref_language'] = $_POST['user_pref_language'] ?? 'en';
$API_users->postedData['user_stompable'] = (bool)$_POST['user_stompable'];
$API_users->postedData['user_full_name'] = trim($API_users->postedData['user_first_name'] . ' ' . $API_users->postedData['user_last_name']);
$API_users->postedData['user_pref_language'] = $API_users->postedData['user_pref_language'] ?? 'en';
$API_users->postedData['user_stompable'] = (bool)$API_users->postedData['user_stompable'];
$API_users->validateData($requiredFields, $optionalFields);
@@ -83,7 +86,6 @@ if ($API_users->request_method === 'GET') {
'user_uuid' => ['type' => 'uuid'],
];
$API_users->validateData($requiredFields);
$API_users->deleteUser();