"""
end
def mount(_params, _session, socket) do
{:ok, socket}
end
def handle_event("send_instructions", %{"user" => %{"email" => email}}, socket) do
if user = Accounts.get_user_by_email(email) do
case Accounts.deliver_user_confirmation_instructions(
user,
&url(~p"/users/confirm/#{&1}")
) do
{:ok, _} ->
info =
"If your email is in our system and it has not been confirmed yet, you will receive an email with instructions shortly."
{:noreply,
socket
|> put_flash(:info, info)
|> redirect(to: ~p"/")}
{:error, _reason} ->
{:noreply, put_flash(socket, :error, "Failed to send email. Please try again later.")}
end
else
info =
"If your email is in our system and it has not been confirmed yet, you will receive an email with instructions shortly."
{:noreply,
socket
|> put_flash(:info, info)
|> redirect(to: ~p"/")}
end
end
end