diff --git a/composer.json b/composer.json index 5720a0c9..b70284e8 100644 --- a/composer.json +++ b/composer.json @@ -39,7 +39,7 @@ "prefer-stable": true, "require": { "php": ">=7.0.0", - "barryvdh/laravel-cors": "~0.10.0", + "barryvdh/laravel-cors": "~0.11.0", "doctrine/dbal": "~2.5.0", "guzzlehttp/guzzle": "~6.0", "symfony/yaml": "~2.8|~3.0", diff --git a/config/df.php b/config/df.php index 15cb9332..646b92f0 100644 --- a/config/df.php +++ b/config/df.php @@ -62,8 +62,8 @@ ], 'query_log_enabled' => env('DB_QUERY_LOG_ENABLED', false), ], - // Cache config, in minutes - 'default_cache_ttl' => env('CACHE_DEFAULT_TTL', env('DF_CACHE_TTL', 300)), + // Cache config, in seconds + 'default_cache_ttl' => env('CACHE_DEFAULT_TTL', env('DF_CACHE_TTL', 18000)), // Session config 'allow_forever_sessions' => env('DF_ALLOW_FOREVER_SESSIONS', false), // System URLs @@ -71,7 +71,7 @@ 'confirm_invite_url' => env('DF_CONFIRM_INVITE_URL', '/dreamfactory/dist/#/user-invite'), 'confirm_register_url' => env('DF_CONFIRM_REGISTER_URL', '/dreamfactory/dist/#/register-confirm'), 'confirm_code_length' => env('DF_CONFIRM_CODE_LENGTH', 32), - 'confirm_code_ttl' => env('DF_CONFIRM_CODE_TTL', 1440), // 1440 minutes (24 hours). + 'confirm_code_ttl' => env('DF_CONFIRM_CODE_TTL', 86400), // 86400 seconds (24 hours). 'landing_page' => env('DF_LANDING_PAGE', '/dreamfactory/dist/index.html'), // Enable/disable detailed CORS logging 'log_cors_info' => false, diff --git a/src/Commands/ClearAllFileCache.php b/src/Commands/ClearAllFileCache.php index 617458f4..9e07d7d4 100644 --- a/src/Commands/ClearAllFileCache.php +++ b/src/Commands/ClearAllFileCache.php @@ -26,9 +26,9 @@ public function __construct() */ public function handle() { - $this->laravel['events']->fire('cache:clearing', ['file']); + $this->laravel['events']->dispatch('cache:clearing', ['file']); $this->removeDirectory($this->cacheRoot); - $this->laravel['events']->fire('cache:cleared', ['file']); + $this->laravel['events']->dispatch('cache:cleared', ['file']); $this->info('Cleared DreamFactory cache for all instances!'); } diff --git a/src/Components/RestHandler.php b/src/Components/RestHandler.php index bd39b1cc..de37aeaf 100644 --- a/src/Components/RestHandler.php +++ b/src/Components/RestHandler.php @@ -288,7 +288,7 @@ protected function firePreProcessEvent($name = null, $resource = null) } $event = new PreProcessApiEvent($name, $this->request, $this->response, $resource); /** @noinspection PhpUnusedLocalVariableInspection */ - $results = \Event::fire($event); + $results = \Event::dispatch($event); $this->response = $event->response; } @@ -363,7 +363,7 @@ protected function firePostProcessEvent($name = null, $resource = null) $resource = $this->getEventResource(); } /** @noinspection PhpUnusedLocalVariableInspection */ - $results = \Event::fire(new PostProcessApiEvent($name, $this->request, $this->response, $resource)); + $results = \Event::dispatch(new PostProcessApiEvent($name, $this->request, $this->response, $resource)); } /** @@ -388,7 +388,7 @@ protected function fireFinalEvent($name = null, $resource = null) $resource = $this->getEventResource(); } /** @noinspection PhpUnusedLocalVariableInspection */ - $results = \Event::fire(new ApiEvent($name, $this->request, $this->response, $resource)); + $results = \Event::dispatch(new ApiEvent($name, $this->request, $this->response, $resource)); } /** diff --git a/src/Enums/DateTimeIntervals.php b/src/Enums/DateTimeIntervals.php index 9222ff9d..9ca0d914 100644 --- a/src/Enums/DateTimeIntervals.php +++ b/src/Enums/DateTimeIntervals.php @@ -43,6 +43,14 @@ class DateTimeIntervals extends FactoryEnum * @var int */ const SECONDS_PER_DAY = 86400; + /** + * @var int + */ + const SECONDS_PER_WEEK = 604800; + /** + * @var int + */ + const SECONDS_PER_MONTH = 18144000; /** * @var int Stupid, I know, but at least it's a constant */ diff --git a/src/Handlers/Events/ServiceEventHandler.php b/src/Handlers/Events/ServiceEventHandler.php index 6d31a4d4..4bd0f96c 100644 --- a/src/Handlers/Events/ServiceEventHandler.php +++ b/src/Handlers/Events/ServiceEventHandler.php @@ -77,7 +77,7 @@ public function handleApiEvent($event) Log::debug('Service event handled: ' . $eventName); /** @var BaseRestService $service */ $service = \ServiceManager::getServiceById($record->service_id); - Event::fire(new ServiceAssignedEvent($service, $event, $record->toArray())); + Event::dispatch(new ServiceAssignedEvent($service, $event, $record->toArray())); } } diff --git a/src/LogHandlers/DfLoggingTrait.php b/src/LogHandlers/DfLoggingTrait.php deleted file mode 100644 index 32d63bbb..00000000 --- a/src/LogHandlers/DfLoggingTrait.php +++ /dev/null @@ -1,17 +0,0 @@ -= $allowedLogLevel) { - parent::write($record); - } - } -} \ No newline at end of file diff --git a/src/LogHandlers/ErrorLogHandler.php b/src/LogHandlers/ErrorLogHandler.php deleted file mode 100644 index b12344e5..00000000 --- a/src/LogHandlers/ErrorLogHandler.php +++ /dev/null @@ -1,8 +0,0 @@ -is_active) { diff --git a/src/Models/ServiceCacheConfig.php b/src/Models/ServiceCacheConfig.php index 3a101005..02d9516b 100644 --- a/src/Models/ServiceCacheConfig.php +++ b/src/Models/ServiceCacheConfig.php @@ -38,7 +38,7 @@ protected static function prepareConfigSchemaField(array &$schema) ' Only GET requests without payload are cached.'; break; case 'cache_ttl': - $schema['label'] = 'Cache Time To Live (minutes)'; + $schema['label'] = 'Cache Time To Live (seconds)'; $schema['description'] = 'The amount of time each cached response is allowed to last.' . ' Once expired, a new request to the service is made.'; diff --git a/src/Models/User.php b/src/Models/User.php index b494dfe8..4e334210 100644 --- a/src/Models/User.php +++ b/src/Models/User.php @@ -18,6 +18,7 @@ use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract; use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract; use Illuminate\Database\Eloquent\Model; +use Illuminate\Support\Facades\Hash; use Validator; /** @@ -475,7 +476,7 @@ public static function deleteInternal($id, $record, $params = []) */ public function setSecurityAnswerAttribute($value) { - $this->attributes['security_answer'] = bcrypt($value); + $this->attributes['security_answer'] = Hash::make($value); } /** @@ -486,7 +487,7 @@ public function setSecurityAnswerAttribute($value) public function setPasswordAttribute($password) { if (!empty($password)) { - $password = bcrypt($password); + $password = Hash::make($password); JWTUtilities::invalidateTokenByUserId($this->id); // When password is set user account must be confirmed. Confirming user // account here with confirm_code = null. diff --git a/src/Utility/FileUtilities.php b/src/Utility/FileUtilities.php index c32fecac..eb12540e 100755 --- a/src/Utility/FileUtilities.php +++ b/src/Utility/FileUtilities.php @@ -1365,7 +1365,7 @@ public static function updateEnvSetting(array $settings, $path = null) * Using a new instance of dotenv to get the * most update to .env file content for reading. */ - $dotenv = new Dotenv(base_path()); + $dotenv = Dotenv::create(base_path()); $dotenv->load(); $search = $key . '=' . getenv($key);