Fix user creation

pull/3890/head
Julio Montoya 4 years ago
parent f60f1054ac
commit 3b6b96b9e1
  1. 19
      public/main/admin/user_add.php
  2. 2
      public/main/inc/lib/usermanager.lib.php

@ -5,7 +5,6 @@
use Chamilo\CoreBundle\Framework\Container;
$cidReset = true;
// Including necessary libraries.
require_once __DIR__.'/../inc/global.inc.php';
// Section for the tabs
@ -341,8 +340,7 @@ $form->addGroup($html_results_enabled);
if ($form->validate()) {
$check = Security::check_token('post');
if (true) {
$user = $form->exportValues();
$user = $form->getSubmitValues();
$lastname = $user['lastname'];
$firstname = $user['firstname'];
$official_code = $user['official_code'];
@ -352,8 +350,15 @@ if ($form->validate()) {
$status = (int) $user['status'];
$language = $user['language'];
$picture = $_FILES['picture'];
$platform_admin = (int) $user['admin']['platform_admin'];
$send_mail = (int) $user['mail']['send_mail'];
$platform_admin = 0;
if (isset($user['admin']) && isset($user['admin']['platform_admin'])) {
$platform_admin = (int) $user['admin']['platform_admin'];
}
$send_mail = 0;
if (isset($user['mail']) && isset($user['mail']['send_mail'])) {
$send_mail = (int) $user['mail']['send_mail'];
}
$hr_dept_id = isset($user['hr_dept_id']) ? (int) $user['hr_dept_id'] : 0;
if (isset($extAuthSource) && count($extAuthSource) > 0 &&
@ -363,11 +368,11 @@ if ($form->validate()) {
$password = 'PLACEHOLDER';
} else {
$auth_source = PLATFORM_AUTH_SOURCE;
$password = '1' == $user['password']['password_auto'] ? api_generate_password() : $user['password']['password'];
$password = '1' === $user['password']['password_auto'] ? api_generate_password() : $user['password']['password'];
}
$expiration_date = null;
if ('1' == $user['radio_expiration_date']) {
if ('1' === $user['radio_expiration_date']) {
$expiration_date = $user['expiration_date'];
}

@ -1948,7 +1948,7 @@ class UserManager
* When deletion is requested returns empty string.
* In case of internal error or negative validation returns FALSE.
*/
public static function update_user_picture($userId, UploadedFile $file, $crop = '')
public static function update_user_picture($userId, UploadedFile $file, string $crop = '')
{
if (empty($userId) || empty($file)) {
return false;

Loading…
Cancel
Save