(
{
error,
notice,
email,
formData,
isEmailVerificationEnabled,
isMultiFactorAuthEnabled,
isSingleSignOnEnabled,
singleSignOnUrl,
helpEmail,
}: {
error?: string;
notice?: string;
email?: string;
formData?: FormData;
isEmailVerificationEnabled: boolean;
isMultiFactorAuthEnabled: boolean;
isSingleSignOnEnabled: boolean;
singleSignOnUrl?: string;
helpEmail: string;
},
)
| 208 | } |
| 209 | |
| 210 | function defaultHtmlContent( |
| 211 | { |
| 212 | error, |
| 213 | notice, |
| 214 | email, |
| 215 | formData, |
| 216 | isEmailVerificationEnabled, |
| 217 | isMultiFactorAuthEnabled, |
| 218 | isSingleSignOnEnabled, |
| 219 | singleSignOnUrl, |
| 220 | helpEmail, |
| 221 | }: { |
| 222 | error?: string; |
| 223 | notice?: string; |
| 224 | email?: string; |
| 225 | formData?: FormData; |
| 226 | isEmailVerificationEnabled: boolean; |
| 227 | isMultiFactorAuthEnabled: boolean; |
| 228 | isSingleSignOnEnabled: boolean; |
| 229 | singleSignOnUrl?: string; |
| 230 | helpEmail: string; |
| 231 | }, |
| 232 | ) { |
| 233 | const passwordlessPasskeyLoginReactNode = <PasswordlessPasskeyLogin />; |
| 234 | |
| 235 | const passwordlessPasskeyLoginHtml = renderToString(passwordlessPasskeyLoginReactNode); |
| 236 | |
| 237 | const htmlContent = html` |
| 238 | <main id="main"> |
| 239 | <section class="max-w-3xl mx-auto flex flex-col items-center justify-center"> |
| 240 | <h1 class="text-4xl mb-6"> |
| 241 | Login |
| 242 | </h1> |
| 243 | ${error |
| 244 | ? html` |
| 245 | <section class="notification-error"> |
| 246 | <h3>Failed to login!</h3> |
| 247 | <p>${error}</p> |
| 248 | </section> |
| 249 | ` |
| 250 | : ''} ${notice |
| 251 | ? html` |
| 252 | <section class="notification-success"> |
| 253 | <h3>${isEmailVerificationEnabled ? 'Verify your email!' : 'Account created!'}</h3> |
| 254 | <p>${notice}</p> |
| 255 | </section> |
| 256 | ` |
| 257 | : ''} |
| 258 | |
| 259 | <form method="POST" class="mb-4"> |
| 260 | ${formFields( |
| 261 | email, |
| 262 | notice?.includes('verify your email') && isEmailVerificationEnabled, |
| 263 | ).map((field) => generateFieldHtml(field, formData || new FormData())).join('')} |
| 264 | <section class="flex justify-center mt-8 mb-4"> |
| 265 | <button class="button" type="submit">Login</button> |
| 266 | </section> |
| 267 |
no test coverage detected