Ensure user records always have salt value

This commit is contained in:
Alex Tselegidis 2024-01-12 13:05:24 +01:00
parent 75837b8449
commit edb5458f54
3 changed files with 32 additions and 0 deletions

View File

@ -334,6 +334,10 @@ class Admins_model extends EA_Model
throw new RuntimeException('No settings record found for admin with ID: ' . $admin['id']);
}
if (empty($existing_settings['salt'])) {
$existing_settings['salt'] = $settings['salt'] = generate_salt();
}
$settings['password'] = hash_password($existing_settings['salt'], $settings['password']);
}

View File

@ -374,6 +374,10 @@ class Providers_model extends EA_Model
throw new RuntimeException('No settings record found for provider with ID: ' . $provider['id']);
}
if (empty($existing_settings['salt'])) {
$existing_settings['salt'] = $settings['salt'] = generate_salt();
}
$settings['password'] = hash_password($existing_settings['salt'], $settings['password']);
}
@ -899,6 +903,26 @@ class Providers_model extends EA_Model
$decoded_resource['settings']['google_token'] = $provider['settings']['googleToken'];
}
if (array_key_exists('caldavSync', $provider['settings'])) {
$decoded_resource['settings']['caldav_sync'] = $provider['settings']['caldavSync'];
}
if (array_key_exists('caldavUrl', $provider['settings'])) {
$decoded_resource['settings']['caldav_url'] = $provider['settings']['caldavUrl'];
}
if (array_key_exists('caldavUsername', $provider['settings'])) {
$decoded_resource['settings']['caldav_username'] = $provider['settings']['caldavUsername'];
}
if (array_key_exists('caldavPassword', $provider['settings'])) {
$decoded_resource['settings']['caldav_password'] = $provider['settings']['caldavPassword'];
}
if (array_key_exists('caldavCalendar', $provider['settings'])) {
$decoded_resource['settings']['caldav_calendar'] = $provider['settings']['caldavCalendar'];
}
if (array_key_exists('syncFutureDays', $provider['settings'])) {
$decoded_resource['settings']['sync_future_days'] = $provider['settings']['syncFutureDays'];
}

View File

@ -364,6 +364,10 @@ class Secretaries_model extends EA_Model
throw new RuntimeException('No settings record found for secretary with ID: ' . $secretary['id']);
}
if (empty($existing_settings['salt'])) {
$existing_settings['salt'] = $settings['salt'] = generate_salt();
}
$settings['password'] = hash_password($existing_settings['salt'], $settings['password']);
}