mirror of
https://github.com/nicotsx/zerobyte.git
synced 2026-04-18 05:47:31 -04:00
test: use better-auth built-in test plugin refactor: map auth errors server side refactor: native trusted providers callback usage <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **New Features** * Enhanced SSO authentication error messaging with specific guidance for different failure scenarios (account linking required, email verification needed, banned accounts, invite-only access). * **Chores** * Updated authentication dependencies to version 1.5.0. * **Tests** * Extended test coverage for SSO error code handling and authentication scenarios. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
23 lines
445 B
TypeScript
23 lines
445 B
TypeScript
type AllowedHostsResult = {
|
|
allowedHosts: string[];
|
|
invalidOrigins: string[];
|
|
};
|
|
|
|
export function buildAllowedHosts(origins: string[]): AllowedHostsResult {
|
|
const validHosts = new Set<string>();
|
|
const invalidOrigins: string[] = [];
|
|
|
|
for (const origin of origins) {
|
|
try {
|
|
validHosts.add(new URL(origin).host);
|
|
} catch {
|
|
invalidOrigins.push(origin);
|
|
}
|
|
}
|
|
|
|
return {
|
|
allowedHosts: Array.from(validHosts),
|
|
invalidOrigins,
|
|
};
|
|
}
|