Skip to content

Commit df6977a

Browse files
committed
fix #1608
1 parent 5503878 commit df6977a

File tree

1 file changed

+7
-1
lines changed
  • apps/web/pages/api/forgot-password

1 file changed

+7
-1
lines changed

apps/web/pages/api/forgot-password/index.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@ async function checkDomain(host: string) {
99
if (process.env.NODE_ENV === 'development') {
1010
return true;
1111
}
12-
const domain = host.substring(host.lastIndexOf('/') + 1);
12+
let domain = host;
13+
try {
14+
const url = new URL(host);
15+
domain = url.hostname;
16+
} catch (error) {
17+
console.error('Invalid URL:', error);
18+
}
1319
if (domain === 'linen.dev' || domain === 'www.linen.dev') {
1420
return true;
1521
}

0 commit comments

Comments
 (0)