40 lines
2.4 KiB
Plaintext
40 lines
2.4 KiB
Plaintext
import { Button, Input } from "@wrnexus/ui"
|
|
|
|
component VerifyEmail {
|
|
props {
|
|
kind = "email"
|
|
action = "/api/auth/verify/email"
|
|
schema = "auth-verification-token"
|
|
token = ""
|
|
identifier = ""
|
|
title = "Verify your email"
|
|
description = "Enter the verification token or continue with your secure link."
|
|
submitLabel = "Verify email"
|
|
resendAction = "/api/auth/verification/request"
|
|
resendSchema = "auth-verification-request"
|
|
successMessage = "Your email has been verified."
|
|
color = "primary"
|
|
size = "md"
|
|
class = ""
|
|
}
|
|
view {
|
|
<section {...attrs} data-wrnexus-runtime="auth" class='w-full max-w-md rounded-[var(--wire-radius-lg)] border border-[var(--wire-color-border)] bg-[var(--wire-color-surface)] p-6 text-[var(--wire-color-text)] shadow-[var(--wire-shadow-2)] {class}'>
|
|
<h1 class="m-0 text-2xl font-semibold">{title}</h1>
|
|
<p class="mt-2 text-sm text-[var(--wire-color-muted)]">{description}</p>
|
|
<form method="post" action='{action}' data-schema='{schema}' novalidate class="mt-6 space-y-4">
|
|
<Input id="auth-email-token" name="token" label="Verification token" value="{token}" autocomplete="one-time-code" placeholder="Enter your verification token" icon="icon-[lucide--badge-check]" color="{color}" size="{size}" />
|
|
<p data-error="_form" role="alert" class="m-0 hidden rounded-[var(--wire-radius-sm)] bg-[color-mix(in_srgb,var(--wire-color-danger)_10%,transparent)] p-3 text-sm text-[var(--wire-color-danger)]"></p>
|
|
<p data-success='{successMessage}' role="status" hidden class="m-0 rounded-[var(--wire-radius-sm)] bg-[color-mix(in_srgb,var(--wire-color-success)_10%,transparent)] p-3 text-sm text-[var(--wire-color-success)]">{successMessage}</p>
|
|
<Button type="submit" label="{submitLabel}" variant="solid" color="{color}" size="{size}" fullWidth="true" />
|
|
</form>
|
|
<form method="post" action='{resendAction}' data-schema='{resendSchema}' novalidate class="mt-3">
|
|
<input type="hidden" name="type" value='{kind}' />
|
|
<input type="hidden" name="identifier" value='{identifier}' />
|
|
<p data-error="type" class="m-0 min-h-4 text-xs text-[var(--wire-color-danger)]"></p>
|
|
<p data-error="_form" role="alert" class="m-0 hidden text-xs text-[var(--wire-color-danger)]"></p>
|
|
<Button type="submit" label="Send a new code" variant="ghost" color="{color}" size="sm" />
|
|
</form>
|
|
</section>
|
|
}
|
|
}
|