Fixed login and user search by email not being case-insensitive when using Flex Users

This commit is contained in:
Matias Griese 2022-06-14 10:43:46 +03:00
parent 9d6a2dba09
commit b18b49a239
3 changed files with 8 additions and 3 deletions

View File

@ -9,6 +9,7 @@
* Fixed a potential fatal error when using watermark in images
* Fixed `bin/grav install` command with arbitrary destination folder name
* Fixed Twig `|filter()` allowing code execution
* Fixed login and user search by email not being case-insensitive when using Flex Users
# v1.7.33
## 04/25/2022

View File

@ -142,7 +142,7 @@ class UserIndex extends FlexIndex implements UserCollectionInterface
} elseif ($field === 'flex_key') {
$user = $this->withKeyField('flex_key')->get($query);
} elseif ($field === 'email') {
$user = $this->withKeyField('email')->get($query);
$user = $this->withKeyField('email')->get(static::filterUsername($query, $this->getFlexDirectory()->getStorage()));
} elseif ($field === 'username') {
$user = $this->get(static::filterUsername($query, $this->getFlexDirectory()->getStorage()));
} else {

View File

@ -97,7 +97,9 @@ class FlexServiceProvider implements ServiceProviderInterface
'options' => [
'file' => 'user',
'pattern' => '{FOLDER}/{KEY:2}/{KEY}/{FILE}{EXT}',
'key' => 'storage_key'
'key' => 'storage_key',
'indexed' => true,
'case_sensitive' => false
],
];
}
@ -107,7 +109,9 @@ class FlexServiceProvider implements ServiceProviderInterface
'class' => UserFileStorage::class,
'options' => [
'pattern' => '{FOLDER}/{KEY}{EXT}',
'key' => 'username'
'key' => 'username',
'indexed' => true,
'case_sensitive' => false
],
];
}