Skip to content

Commit 75ba392

Browse files
committed
Exclude auth and users controllers
1 parent aab3032 commit 75ba392

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## 5.2.0 - Unreleased
44

5-
- Added front-end login actions to the list of excluded actions ([#34](https://github.com/putyourlightson/craft-snaptcha/issues/34)).
5+
- The `auth` and `users` controllers are now excluded from validation, except for `users/save-user` ([#34](https://github.com/putyourlightson/craft-snaptcha/issues/34)).
66

77
## 5.1.2 - 2025-07-01
88

src/services/SnaptchaService.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,8 @@ class SnaptchaService extends Component
4040
*/
4141
public const EXCLUDE_CONTROLLER_ACTIONS = [
4242
// Craft CMS actions
43-
'users/login',
4443
'graphql/api',
4544
'templates/render',
46-
'auth/verify-totp',
4745
// Plugins actions
4846
'ad-wizard/tracking/click',
4947
'commerce/webhooks/process-webhook',
@@ -136,6 +134,12 @@ public function isExcludedControllerAction(Action $action): bool
136134
return true;
137135
}
138136

137+
// Exclude auth and user controllers (except for `users/save-user`)
138+
if (str_starts_with($controllerAction, 'auth/') ||
139+
(str_starts_with($controllerAction, 'users/') && $controllerAction !== 'users/save-user')) {
140+
return true;
141+
}
142+
139143
return false;
140144
}
141145

0 commit comments

Comments
 (0)