mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-02 08:21:09 -08:00
Valo/ch37/cannot log in with generated password from (#6655)
* Cannot log in with generated password from [ch37] * Cannot log in with generated password from [ch37]. Light cleanup * Added the fetchHumanBoolean() method. * Cleaning up the ternary
This commit is contained in:
parent
ef8e20f66b
commit
9ac40f705c
|
@ -440,4 +440,13 @@ abstract class Importer
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function fetchHumanBoolean($value)
|
||||||
|
{
|
||||||
|
if (($value =='1') || (strtolower($value) =='true') || (strtolower($value) =='yes'))
|
||||||
|
{
|
||||||
|
return '1';
|
||||||
|
}
|
||||||
|
return '0';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ class UserImporter extends ItemImporter
|
||||||
$this->item['email'] = $this->findCsvMatch($row, 'email');
|
$this->item['email'] = $this->findCsvMatch($row, 'email');
|
||||||
$this->item['phone'] = $this->findCsvMatch($row, 'phone_number');
|
$this->item['phone'] = $this->findCsvMatch($row, 'phone_number');
|
||||||
$this->item['jobtitle'] = $this->findCsvMatch($row, 'jobtitle');
|
$this->item['jobtitle'] = $this->findCsvMatch($row, 'jobtitle');
|
||||||
$this->item['activated'] = $this->findCsvMatch($row, 'activated');
|
$this->item['activated'] = $this->fetchHumanBoolean($this->findCsvMatch($row, 'activated'));
|
||||||
$this->item['employee_num'] = $this->findCsvMatch($row, 'employee_num');
|
$this->item['employee_num'] = $this->findCsvMatch($row, 'employee_num');
|
||||||
$this->item['department_id'] = $this->createOrFetchDepartment($this->findCsvMatch($row, 'department'));
|
$this->item['department_id'] = $this->createOrFetchDepartment($this->findCsvMatch($row, 'department'));
|
||||||
$this->item['manager_id'] = $this->fetchManager($this->findCsvMatch($row, 'manager_first_name'), $this->findCsvMatch($row, 'manager_last_name'));
|
$this->item['manager_id'] = $this->fetchManager($this->findCsvMatch($row, 'manager_first_name'), $this->findCsvMatch($row, 'manager_last_name'));
|
||||||
|
@ -60,11 +60,12 @@ class UserImporter extends ItemImporter
|
||||||
}
|
}
|
||||||
// This needs to be applied after the update logic, otherwise we'll overwrite user passwords
|
// This needs to be applied after the update logic, otherwise we'll overwrite user passwords
|
||||||
// Issue #5408
|
// Issue #5408
|
||||||
$this->item['password'] = $this->tempPassword;
|
$this->item['password'] = bcrypt($this->tempPassword);
|
||||||
|
|
||||||
$this->log("No matching user, creating one");
|
$this->log("No matching user, creating one");
|
||||||
$user = new User();
|
$user = new User();
|
||||||
$user->fill($this->sanitizeItemForStoring($user));
|
$user->fill($this->sanitizeItemForStoring($user));
|
||||||
|
|
||||||
if ($user->save()) {
|
if ($user->save()) {
|
||||||
// $user->logCreate('Imported using CSV Importer');
|
// $user->logCreate('Imported using CSV Importer');
|
||||||
$this->log("User " . $this->item["name"] . ' was created');
|
$this->log("User " . $this->item["name"] . ' was created');
|
||||||
|
|
Loading…
Reference in a new issue