Skip to content

Commit

Permalink
Review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
carlgu committed Oct 25, 2024
1 parent f213ca5 commit 17038f9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
==========

* The `createEvent` helper was removed, use `new CustomEvent()` directly.
* The `handleHttpBasicAuth()` method was removed, use `integrateHttpBasicAuth()` directly


1.x to 2.0
Expand Down
14 changes: 7 additions & 7 deletions src/next/middleware/http-auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function handleHttpBasicAuth (
{
return integrateHttpBasicAuth(
request,
[{username: username, password: password}],
[{username, password}],
responseText,
realmLabel
);
Expand All @@ -45,12 +45,12 @@ export function integrateHttpBasicAuth (
.toString()
.split(":");

users.forEach((item) => {
if (givenUser === item.username && givenPassword === item.password)
{
return;
}
})
const hasValidUser = users.some((item : Credentials) => givenUser === item.username && givenPassword === item.password);

if (hasValidUser)
{
return;
}
}

return new Response(responseText, {
Expand Down

0 comments on commit 17038f9

Please sign in to comment.