Some checks are pending
E2E / Playwright e2e (push) Waiting to run
- Introduced PasswordFieldBlock component for improved password input handling, including visibility toggle and strength evaluation. - Added SignupCredentialsFields component to streamline user signup with email availability checks and password confirmation. - Updated FlowChallengeForm to integrate new components, enhancing user experience during authentication. - Refactored CSS styles for consistent design across authentication components, ensuring a cohesive look and feel.
23 lines
570 B
TypeScript
23 lines
570 B
TypeScript
export type MailAddressAvailability = {
|
|
available: boolean
|
|
reason?: string
|
|
}
|
|
|
|
export async function checkMailAddressAvailability(
|
|
local: string,
|
|
domain: string
|
|
): Promise<MailAddressAvailability> {
|
|
const params = new URLSearchParams({
|
|
local,
|
|
domain,
|
|
})
|
|
const res = await fetch(`/api/v1/mail/addresses/check?${params.toString()}`, {
|
|
credentials: "include",
|
|
headers: { Accept: "application/json" },
|
|
})
|
|
if (!res.ok) {
|
|
throw new Error(`address check failed (${res.status})`)
|
|
}
|
|
return (await res.json()) as MailAddressAvailability
|
|
}
|