This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defmodule YourAppWeb.DashboardLive.Index do | |
| @moduledoc false | |
| use YourAppWeb, :live_view | |
| on_mount YourAppWeb.Hooks.LocalTimeZoneHook | |
| @impl true | |
| def mount(_params, session, socket) do | |
| ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defmodule YourAppWeb.DashboardLive.Index do | |
| @moduledoc false | |
| use YourAppWeb, :live_view | |
| on_mount YourAppWeb.Hooks.LocalTimeZoneHook | |
| @impl true | |
| def mount(_params, session, socket) do | |
| ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defmodule YourAppWeb.Plugs.PlugAttack do | |
| @moduledoc false | |
| use PlugAttack | |
| import Plug.Conn | |
| @alg :sha512 | |
| @ip_secret System.fetch_env!("PLUG_ATTACK_IP_SECRET") | |
| rule "fail2ban by ip", conn do | |
| fail2ban hash_ip(@alg, convert_ip(conn.remote_ip)), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defmodule YourAppWeb.Plugs.PlugAttack do | |
| @moduledoc false | |
| use PlugAttack | |
| import Plug.Conn | |
| @alg :sha512 | |
| @ip_secret System.fetch_env!("PLUG_ATTACK_IP_SECRET") | |
| rule "throttle by ip", conn do | |
| throttle hash_ip(@alg, convert_ip(conn.remote_ip)), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defmodule YourAppWeb.PersonRegistrationLive.New do | |
| use Phoenix.LiveView | |
| alias YourAppWeb.Router.Helpers, as: Routes | |
| alias YourApp.Accounts | |
| alias YourApp.Accounts.Person | |
| def mount(_params, _session, socket) do | |
| changeset = Accounts.change_person_registration(%Person{}) | |
| {:ok, assign(socket, changeset: changeset)} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defmodule YourAppWeb.PersonRegistrationLive.New do | |
| use Phoenix.LiveView | |
| alias YourAppWeb.Router.Helpers, as: Routes | |
| alias YourApp.Accounts | |
| alias YourApp.Accounts.Person | |
| def mount(_params, _session, socket) do | |
| changeset = Accounts.change_person_registration(%Person{}) | |
| {:ok, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def render(assigns) do | |
| ~H""" | |
| <.form let={f} for={@changeset} url="#" phx_change="validate" phx_submit="save"> | |
| <div class={unless @current_step === 1, do: "hidden"}> | |
| <!-- Step 1 form fields here --> | |
| </div> | |
| <div class={unless @current_step === 2, do: "hidden"}> | |
| <!-- Step 2 form fields here --> | |
| </div> |
NewerOlder