diff --git a/src/app/Observers/UserObserver.php b/src/app/Observers/UserObserver.php index 8829425..3f4272b 100644 --- a/src/app/Observers/UserObserver.php +++ b/src/app/Observers/UserObserver.php @@ -13,6 +13,9 @@ class UserObserver public function updating($user): void { PasswordHistoryManager::logPassword($user); + $user->update([ + 'password_expires_at' => now()->addDays(config('ae3auth-config.password_expires_in')) + ]); } /** @@ -22,5 +25,8 @@ class UserObserver public function created($user): void { PasswordHistoryManager::logNewPassword($user->id, $user->password); + $user->update([ + 'password_expires_at' => now()->addDays(config('ae3auth-config.password_expires_in')) + ]); } } diff --git a/src/config/ae3auth.php b/src/config/ae3auth.php index 712b7fd..3be19f4 100644 --- a/src/config/ae3auth.php +++ b/src/config/ae3auth.php @@ -30,5 +30,6 @@ return [ 'expires_password_column_name' => env('EXPIRES_PASSWORD_COLUMN_NAME', 'password_expires_at'), 'user_model' => env('USER_MODEL', 'App\\Models\\User'), 'password_column' => env('PASSWORD_COLUMN', 'password'), - ] + ], + 'password_expires_in' => intval(env('PASSWORD_EXPIRES_IN', 30)) ];