From c8e2c3f1a68eb5cf0196d6f4e54f373f90e83354 Mon Sep 17 00:00:00 2001
From: JediKev <kevin@enhancesoft.com>
Date: Fri, 6 Jul 2018 09:31:52 -0500
Subject: [PATCH] issue: User Import No Email

This addresses issue 4329 where you can import a User with no email
address via CSV file. Once the User is added and you try to update them
with an email address it fails due to no default email. This updates the
check for email address from `!isset()` to `empty()` which will correctly
check for empty string.
---
 include/class.user.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/class.user.php b/include/class.user.php
index 24cae58b9..f0d5f235d 100644
--- a/include/class.user.php
+++ b/include/class.user.php
@@ -452,7 +452,7 @@ implements TemplateVariable {
             db_autocommit(false);
             $records = $importer->importCsv(UserForm::getUserForm()->getFields(), $defaults);
             foreach ($records as $data) {
-                if (!isset($data['email']) || !isset($data['name']))
+                if (!Validator::is_email($data['email']) || empty($data['name']))
                     throw new ImportError('Both `name` and `email` fields are required');
                 if (!($user = static::fromVars($data, true, true)))
                     throw new ImportError(sprintf(__('Unable to import user: %s'),
-- 
GitLab