Admin: User import: Set e-mail to empty string if not provided. Don't check if e-mail is valid if it is not provided and not required - refs #3712

pull/3897/head
Yannick Warnier 4 years ago committed by GitHub
parent 1a59b8ed2c
commit 1d37571430
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      main/admin/user_import.php

@ -131,7 +131,7 @@ function validate_data($users, $checkUniqueEmail = false)
if (api_get_setting('registration', 'email') === 'false' && empty($user['Email'])) {
$user['Email'] = '';
}
if (isset($user['Email'])) {
if (!empty($user['Email'])) {
$result = api_valid_email($user['Email']);
if ($result === false) {
$user['message'] .= Display::return_message(get_lang('PleaseEnterValidEmail'), 'warning');
@ -140,7 +140,7 @@ function validate_data($users, $checkUniqueEmail = false)
}
if ($checkUniqueEmail) {
if (isset($user['Email'])) {
if (!empty($user['Email'])) {
$userFromEmail = api_get_user_info_from_email($user['Email']);
if (!empty($userFromEmail)) {
$user['message'] .= Display::return_message(get_lang('EmailUsedTwice'), 'warning');

Loading…
Cancel
Save