Skip to content

Commit

Permalink
Force user index file to be updated to fix email addresses [getgrav/g…
Browse files Browse the repository at this point in the history
  • Loading branch information
mahagr committed Oct 5, 2022
1 parent 8e6b823 commit fb1e31d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* Added new `Pages::getSimplePagesHash` which is useful for caching pages specific data
1. [](#bugfix)
* An attempt to workaround windows reading locked file issue [getgrav/grav-plugin-admin#2299](https://github.com/getgrav/grav-plugin-admin/issues/2299)
* Force user index file to be updated to fix email addresses [getgrav/grav-plugin-login#229](https://github.com/getgrav/grav-plugin-login/issues/229)

# v1.7.36
## 09/08/2022
Expand All @@ -15,7 +16,7 @@
* Added `authorize-*@:` support for Flex blueprints, e.g. `authorize-disabled@: not delete` disables the field if user does not have access to delete object
* Added support for `flex-ignore@` to hide all the nested fields in the blueprint
1. [](#bugfix)
* Fixed loggin with a capitalised email address when using old users [getgrav/grav-plugin-login#229](https://github.com/getgrav/grav-plugin-login/issues/229)
* Fixed login with a capitalised email address when using old users [getgrav/grav-plugin-login#229](https://github.com/getgrav/grav-plugin-login/issues/229)

# v1.7.35
## 08/04/2022
Expand Down
10 changes: 6 additions & 4 deletions system/src/Grav/Common/Flex/Types/Users/UserIndex.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*/
class UserIndex extends FlexIndex implements UserCollectionInterface
{
public const VERSION = parent::VERSION . '.1';
public const VERSION = parent::VERSION . '.2';

/**
* @param FlexStorageInterface $storage
Expand All @@ -50,7 +50,7 @@ public static function loadEntriesFromStorage(FlexStorageInterface $storage): ar
// return $index['index'];
//}

// Load up to date index.
// Load up-to-date index.
$entries = parent::loadEntriesFromStorage($storage);

return static::updateIndexFile($storage, $index['index'], $entries, ['force_update' => $force]);
Expand Down Expand Up @@ -142,9 +142,11 @@ public function find($query, $fields = ['username', 'email']): UserInterface
} elseif ($field === 'flex_key') {
$user = $this->withKeyField('flex_key')->get($query);
} elseif ($field === 'email') {
$user = $this->withKeyField('email')->get(static::filterUsername($query, $this->getFlexDirectory()->getStorage()));
$email = mb_strtolower($query);
$user = $this->withKeyField('email')->get($email);
} elseif ($field === 'username') {
$user = $this->get(static::filterUsername($query, $this->getFlexDirectory()->getStorage()));
$username = static::filterUsername($query, $this->getFlexDirectory()->getStorage());
$user = $this->get($username);
} else {
$user = $this->__call('find', [$query, $field]);
}
Expand Down

0 comments on commit fb1e31d

Please sign in to comment.