Skip to content

Commit 48953f7

Browse files
committed
Invalidate caches after login attempts
#10313
1 parent a75a6ad commit 48953f7

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
## Unreleased
44

5+
### Changed
6+
- User caches are now invalidated after login attempts. ([#10313](https://github.com/craftcms/cms/discussions/10313))
7+
58
### Deprecated
69
- Added `craft\helpers\App::parseEnv()` and `parseBooleanEnv()`, replacing their `Craft` class counterparts. ([#10319](https://github.com/craftcms/cms/discussions/10319))
710

src/services/Users.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,9 @@ public function handleValidLogin(User $user)
578578
// Update the User model too
579579
$user->lastLoginDate = $now;
580580
$user->invalidLoginCount = null;
581+
582+
// Invalidate caches
583+
Craft::$app->getElements()->invalidateCachesForElement($user);
581584
}
582585

583586
/**
@@ -635,6 +638,9 @@ public function handleInvalidLogin(User $user)
635638
'user' => $user,
636639
]));
637640
}
641+
642+
// Invalidate caches
643+
Craft::$app->getElements()->invalidateCachesForElement($user);
638644
}
639645

640646
/**

0 commit comments

Comments
 (0)