Importer improvements. If user real name doesn't exist don't try to create the user.

This commit is contained in:
Daniel Meltzer 2016-05-24 21:40:52 -05:00
parent fd0d04eba4
commit e353df588f

View file

@ -563,8 +563,9 @@ class ObjectImportCommand extends Command {
if (!empty($user_username)) { if (!empty($user_username)) {
if ($user = User::MatchEmailOrUsername($user_username, $user_email) if ($user = User::MatchEmailOrUsername($user_username, $user_email)
->whereNotNull('username')->first()) { ->whereNotNull('username')->first()) {
$this->log('User '.$user_username.' already exists'); $this->log('User '.$user_username.' already exists');
} else { } else if(( $first_name != '') && ($last_name != '') && ($user_username != '')) {
$user = new \App\Models\User; $user = new \App\Models\User;
$password = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 20); $password = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 20);
@ -580,6 +581,8 @@ class ObjectImportCommand extends Command {
$this->error('User: ' . $user->getErrors()); $this->error('User: ' . $user->getErrors());
} }
} else {
$user = new User;
} }
} else { } else {
$user = new User; $user = new User;