Skip to content

Commit

Permalink
Check for an existing username before getting creative. Fixes #6016 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
dmeltzer authored and snipe committed Aug 3, 2018
1 parent 1a66091 commit 2d0df24
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/Importer/Importer.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,13 @@ protected function createOrFetchUser($row)
'email' => $this->findCsvMatch($row, "email"),
'username' => $this->findCsvMatch($row, "username")
];

// Maybe we're lucky and the user already exists.
if($user = User::where('username', $user_array['username'])->first()) {
$this->log('User '.$user_array['username'].' already exists');
return $user;
}

// If the full name is empty, bail out--we need this to extract first name (at the very least)
if(empty($user_array['full_name'])) {
$this->log('Insufficient user data provided (Full name is required)- skipping user creation, just adding asset');
Expand Down

0 comments on commit 2d0df24

Please sign in to comment.