diff --git a/lib/microwaveprop/accounts/user.ex b/lib/microwaveprop/accounts/user.ex index e8fa9573..36e1fabe 100644 --- a/lib/microwaveprop/accounts/user.ex +++ b/lib/microwaveprop/accounts/user.ex @@ -131,7 +131,7 @@ defmodule Microwaveprop.Accounts.User do defp validate_password(changeset, opts) do changeset |> validate_required([:password]) - |> validate_length(:password, min: 12, max: 72) + |> validate_length(:password, min: 8, max: 72) # Examples of additional password validation: # |> validate_format(:password, ~r/[a-z]/, message: "at least one lower case character") # |> validate_format(:password, ~r/[A-Z]/, message: "at least one upper case character") diff --git a/lib/microwaveprop_web.ex b/lib/microwaveprop_web.ex index dcbeadda..34fa33e6 100644 --- a/lib/microwaveprop_web.ex +++ b/lib/microwaveprop_web.ex @@ -52,6 +52,8 @@ defmodule MicrowavepropWeb do quote do use Phoenix.LiveView + on_mount MicrowavepropWeb.UserAuth + unquote(html_helpers()) end end diff --git a/lib/microwaveprop_web/components/layouts.ex b/lib/microwaveprop_web/components/layouts.ex index 1459daad..0c55d563 100644 --- a/lib/microwaveprop_web/components/layouts.ex +++ b/lib/microwaveprop_web/components/layouts.ex @@ -46,6 +46,18 @@ defmodule MicrowavepropWeb.Layouts do <.link navigate="/contacts/map" class="btn btn-ghost btn-sm">Contact Map <.link navigate="/contacts" class="btn btn-ghost btn-sm">Contacts <.link navigate="/submit" class="btn btn-ghost btn-sm">Submit + <%= if @current_scope && @current_scope.user do %> + + {@current_scope.user.callsign} + + <.link href={~p"/users/settings"} class="btn btn-ghost btn-sm">Settings + <.link href={~p"/users/log-out"} method="delete" class="btn btn-ghost btn-sm"> + Log out + + <% else %> + <.link href={~p"/users/register"} class="btn btn-ghost btn-sm">Register + <.link href={~p"/users/log-in"} class="btn btn-ghost btn-sm">Log in + <% end %>