Generated Accounts context, User schema, and controllers via phx.gen.auth. Adapted it for password-only login with required email confirmation: - Users have callsign (unique, uppercased), name, email, password - Registration form fields: callsign, name, email, password, confirm - Magic-link login path removed; login is email + password only - After register, a confirmation email is sent and login is blocked until the account is confirmed via the token URL - Confirmation link logs the user in on first use - SMTP2GO configured as the outgoing mailer in k8s prod
47 lines
1.4 KiB
Text
47 lines
1.4 KiB
Text
<Layouts.app flash={@flash} current_scope={@current_scope}>
|
|
<div class="mx-auto max-w-sm space-y-4">
|
|
<div class="text-center">
|
|
<.header>
|
|
<p>Log in</p>
|
|
<:subtitle>
|
|
<%= if @current_scope do %>
|
|
You need to reauthenticate to perform sensitive actions on your account.
|
|
<% else %>
|
|
Don't have an account? <.link
|
|
navigate={~p"/users/register"}
|
|
class="font-semibold text-brand hover:underline"
|
|
phx-no-format
|
|
>Sign up</.link> for an account now.
|
|
<% end %>
|
|
</:subtitle>
|
|
</.header>
|
|
</div>
|
|
|
|
<.form :let={f} for={@form} as={:user} id="login_form_password" action={~p"/users/log-in"}>
|
|
<.input
|
|
readonly={!!@current_scope}
|
|
field={f[:email]}
|
|
type="email"
|
|
label="Email"
|
|
autocomplete="username"
|
|
spellcheck="false"
|
|
required
|
|
phx-mounted={JS.focus()}
|
|
/>
|
|
<.input
|
|
field={f[:password]}
|
|
type="password"
|
|
label="Password"
|
|
autocomplete="current-password"
|
|
spellcheck="false"
|
|
required
|
|
/>
|
|
<.button class="btn btn-primary w-full" name={@form[:remember_me].name} value="true">
|
|
Log in and stay logged in <span aria-hidden="true">→</span>
|
|
</.button>
|
|
<.button class="btn btn-primary btn-soft w-full mt-2">
|
|
Log in only this time
|
|
</.button>
|
|
</.form>
|
|
</div>
|
|
</Layouts.app>
|