diff --git a/src/app/Observers/UserObserver.php b/src/app/Observers/UserObserver.php index 3f4272b..4da153b 100644 --- a/src/app/Observers/UserObserver.php +++ b/src/app/Observers/UserObserver.php @@ -13,9 +13,6 @@ class UserObserver public function updating($user): void { PasswordHistoryManager::logPassword($user); - $user->update([ - 'password_expires_at' => now()->addDays(config('ae3auth-config.password_expires_in')) - ]); } /** @@ -25,8 +22,11 @@ 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')) - ]); + } + + public function creating($user): void + { + $expiresAtColumn = config('ae3auth-config.user.expires_password_column_name'); + $user->$expiresAtColumn = now()->addDays(config('ae3auth-config.password_expires_in')); } }