Update the seeders so that they set dynamic passwords by default
This commit is contained in:
parent
963413eb88
commit
2731d2f17c
3 changed files with 17 additions and 6 deletions
|
@ -55,9 +55,9 @@ class Console extends EA_Controller {
|
|||
{
|
||||
$this->instance->migrate('fresh');
|
||||
|
||||
$this->instance->seed();
|
||||
$password = $this->instance->seed();
|
||||
|
||||
response(PHP_EOL . '⇾ Installation completed, login with "administrator" / "administrator".' . PHP_EOL . PHP_EOL);
|
||||
response(PHP_EOL . '⇾ Installation completed, login with "administrator" / "' . $password . '".' . PHP_EOL . PHP_EOL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -113,7 +113,7 @@ class Installation extends EA_Controller {
|
|||
],
|
||||
'settings' => [
|
||||
'username' => 'janedoe',
|
||||
'password' => 'janedoe',
|
||||
'password' => random_string(),
|
||||
'working_plan' => setting('company_working_plan'),
|
||||
'notifications' => TRUE,
|
||||
'google_sync' => FALSE,
|
||||
|
|
|
@ -84,17 +84,23 @@ class Instance {
|
|||
|
||||
/**
|
||||
* Seed the database with test data.
|
||||
*
|
||||
* @return string Return's the administrator user password.
|
||||
*/
|
||||
public function seed()
|
||||
public function seed(): string
|
||||
{
|
||||
// Settings
|
||||
|
||||
setting([
|
||||
'company_name' => 'Company Name',
|
||||
'company_email' => 'info@example.org',
|
||||
'company_link' => 'https://example.org',
|
||||
]);
|
||||
|
||||
$password = random_string();
|
||||
|
||||
// Admin
|
||||
|
||||
$this->CI->admins_model->save([
|
||||
'first_name' => 'John',
|
||||
'last_name' => 'Doe',
|
||||
|
@ -102,13 +108,14 @@ class Instance {
|
|||
'phone_number' => '+10000000000',
|
||||
'settings' => [
|
||||
'username' => 'administrator',
|
||||
'password' => 'administrator',
|
||||
'password' => $password,
|
||||
'notifications' => TRUE,
|
||||
'calendar_view' => CALENDAR_VIEW_DEFAULT
|
||||
],
|
||||
]);
|
||||
|
||||
// Service
|
||||
|
||||
$service_id = $this->CI->services_model->save([
|
||||
'name' => 'Service',
|
||||
'duration' => '30',
|
||||
|
@ -119,6 +126,7 @@ class Instance {
|
|||
]);
|
||||
|
||||
// Provider
|
||||
|
||||
$this->CI->providers_model->save([
|
||||
'first_name' => 'Jane',
|
||||
'last_name' => 'Doe',
|
||||
|
@ -129,7 +137,7 @@ class Instance {
|
|||
],
|
||||
'settings' => [
|
||||
'username' => 'janedoe',
|
||||
'password' => 'janedoe',
|
||||
'password' => random_string(),
|
||||
'working_plan' => setting('company_working_plan'),
|
||||
'notifications' => TRUE,
|
||||
'google_sync' => FALSE,
|
||||
|
@ -140,12 +148,15 @@ class Instance {
|
|||
]);
|
||||
|
||||
// Customer
|
||||
|
||||
$this->CI->customers_model->save([
|
||||
'first_name' => 'James',
|
||||
'last_name' => 'Doe',
|
||||
'email' => 'james@example.org',
|
||||
'phone_number' => '+10000000000',
|
||||
]);
|
||||
|
||||
return $password;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue