Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/utils/auth.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ export async function checkCommonPassword(password: string) {
if (error instanceof Error && error.name === 'AbortError') {
console.warn('Password check timed out')
}
console.warn('unknow error during password check', error)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
console.warn('unknow error during password check', error)
} else {
console.warn('unknow error during password check', error)
}

return false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be a good idea to add a warning if any other kind of error is thrown so we at least have some visibility into whether things are working.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah completely forgot about it

}
}
9 changes: 4 additions & 5 deletions tests/mocks/common-password.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { http, HttpResponse } from 'msw'

export const pwnedPasswordApiHandler = http.get(
'https://api.pwnedpasswords.com/range/:prefix',
() => {
export const pwnedPasswordApiHandlers = [
http.get('https://api.pwnedpasswords.com/range/:prefix', () => {
return new HttpResponse('', { status: 200 })
},
)
}),
]
4 changes: 2 additions & 2 deletions tests/mocks/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import closeWithGrace from 'close-with-grace'
import { setupServer } from 'msw/node'
import { pwnedPasswordApiHandler } from './common-password.ts'
import { pwnedPasswordApiHandlers } from './common-password.ts'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's rename the common-password file to pwnedpasswords.ts

import { handlers as githubHandlers } from './github.ts'
import { handlers as resendHandlers } from './resend.ts'
import { handlers as tigrisHandlers } from './tigris.ts'
Expand All @@ -9,7 +9,7 @@ export const server = setupServer(
...resendHandlers,
...githubHandlers,
...tigrisHandlers,
pwnedPasswordApiHandler,
...pwnedPasswordApiHandlers,
)

server.listen({
Expand Down