Skip to content
This repository has been archived by the owner on Jan 14, 2024. It is now read-only.

Commit

Permalink
Added check for nullable variables
Browse files Browse the repository at this point in the history
  • Loading branch information
vinkla committed Mar 1, 2018
1 parent 8dc1803 commit 4c37c24
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## 2.4.1 (released 2018-03-01)

- Added check for nullable variables

## 2.4.0 (released 2018-02-08)

- Added laravel 5.6 support
Expand Down
18 changes: 10 additions & 8 deletions src/Shield.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,18 @@ public function __construct(array $users = [])
*/
public function verify(string $username = null, string $password = null, string $user = null)
{
$users = $this->getUsers($user);
if ($username && $password) {
$users = $this->getUsers($user);

foreach ($users as $user => $credentials) {
if (
password_verify($username, reset($credentials)) &&
password_verify($password, end($credentials))
) {
$this->currentUser = $user;
foreach ($users as $user => $credentials) {
if (
password_verify($username, reset($credentials)) &&
password_verify($password, end($credentials))
) {
$this->currentUser = $user;

return;
return;
}
}
}

Expand Down

0 comments on commit 4c37c24

Please sign in to comment.