Skip to content

Commit

Permalink
fix: create user from admin panel fails due to turnstile token requir…
Browse files Browse the repository at this point in the history
…ement
  • Loading branch information
imorland committed Jun 1, 2023
1 parent 375a7d7 commit 28954f6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"homepage": "https://blomstra.net",
"require": {
"flarum/core": "^1.6.0",
"flarum/core": "^1.8.0",
"guzzlehttp/guzzle": "^7.0"
},
"authors": [
Expand Down
3 changes: 2 additions & 1 deletion src/Listeners/RegisterValidate.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public function __construct(TurnstileValidator $validator, SettingsRepositoryInt

public function handle(Saving $event)
{
if (! $event->user->exists && $this->settings->get('blomstra-turnstile.signup')) {
// We also check for the actor's admin status, so that we can allow admins to create users from the admin panel without a Turnstile token.
if (! $event->user->exists && $this->settings->get('blomstra-turnstile.signup') && !$event->actor->isAdmin()) {
$this->validator->assertValid([
'turnstile' => Arr::get($event->data, 'attributes.turnstileToken'),
]);
Expand Down

0 comments on commit 28954f6

Please sign in to comment.