File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -177,6 +177,10 @@ public function findByCredentials(array $credentials): ?User
177177 $ email = $ credentials ['email ' ] ?? null ;
178178 unset($ credentials ['email ' ]);
179179
180+ if ($ email === null && $ credentials === []) {
181+ return null ;
182+ }
183+
180184 // any of the credentials used should be case-insensitive
181185 foreach ($ credentials as $ key => $ value ) {
182186 $ this ->where (
Original file line number Diff line number Diff line change @@ -48,14 +48,16 @@ public function testSaveInsertUser(): void
4848 /**
4949 * @see https://github.com/codeigniter4/shield/issues/546
5050 */
51- public function testfindByCredentialsEmailEmptyString (): void
51+ public function testfindByCredentialsEmptyEmail (): void
5252 {
5353 $ users = $ this ->createUserModel ();
5454 $ user = $ this ->createNewUser ();
5555 $ users ->save ($ user );
5656
5757 $ user = $ users ->findByCredentials (['email ' => '' ]);
58+ $ this ->assertNull ($ user );
5859
60+ $ user = $ users ->findByCredentials ([]);
5961 $ this ->assertNull ($ user );
6062 }
6163
You can’t perform that action at this time.
0 commit comments