diff --git a/config/runtime.exs b/config/runtime.exs index 59dae60..8fea8df 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -4,15 +4,6 @@ if System.get_env("PHX_SERVER") do config :sloanely_but_surely, Web.Endpoint, server: true end -config :sloanely_but_surely, - password_hash: - System.get_env("PASSWORD_HASH") || - raise(""" - environment variable PASSWORD_HASH is missing. - - Generate a hashed password using `mix cms.gen.password_hash` - """) - if config_env() == :prod do database_url = System.get_env("DATABASE_URL") || diff --git a/lib/mix/tasks/sloanely_but_surely.gen.password_hash.ex b/lib/mix/tasks/sloanely_but_surely.gen.password_hash.ex deleted file mode 100644 index 699ab8c..0000000 --- a/lib/mix/tasks/sloanely_but_surely.gen.password_hash.ex +++ /dev/null @@ -1,24 +0,0 @@ -defmodule Mix.Tasks.SloanelyButSurely.Gen.PasswordHash do - @shortdoc @moduledoc - @moduledoc """ - Hashes a password for the admin account - """ - use Boundary, classify_to: SloanelyButSurely.Mix - use Mix.Task - - @impl Mix.Task - def run(_args) do - password = Mix.shell().prompt("Password: ") - password = String.trim_trailing(password) - - password_confirmation = Mix.shell().prompt("Confirm password: ") - password_confirmation = String.trim_trailing(password_confirmation) - - if password == password_confirmation do - hashed = Argon2.hash_pwd_salt(password) - Mix.shell().info(hashed) - else - Mix.shell().error("Passwords do not match") - end - end -end diff --git a/lib/web/components/layouts/app.html.heex b/lib/web/components/layouts/app.html.heex index 00ea327..b5e9694 100644 --- a/lib/web/components/layouts/app.html.heex +++ b/lib/web/components/layouts/app.html.heex @@ -1,11 +1,21 @@ <div class="sticky top-0 z-50 flex flex-row bg-white justify-between py-1 md:mb-2 border-b border-gray-200"> <div class="flex flex-col md:flex-row"> <section class="flex flex-row gap-x-2 md:border-r border-gray-200 px-2"> - <.link href={~p"/"} class="font-bold group"> + <.link navigate={~p"/"} class="font-bold group"> 💜 <span class="group-hover:underline">sloanelybutsurely.com</span> </.link> <nav> - <ul class="flex flex-row gap-x-2"></ul> + <ul class="flex flex-row gap-x-2"> + <li><.link href="#">writing</.link></li> + <li><.link href="#">microblog</.link></li> + </ul> + </nav> + </section> + <section :if={not is_nil(@current_user)} class="ml-2"> + <nav> + <ul class="flex flex-row gap-x-2"> + <li><.link navigate={~p"/admin"}>admin</.link></li> + </ul> </nav> </section> </div> diff --git a/lib/web/live/admin_dashboard_live.ex b/lib/web/live/admin_dashboard_live.ex index 5be91bb..be54573 100644 --- a/lib/web/live/admin_dashboard_live.ex +++ b/lib/web/live/admin_dashboard_live.ex @@ -23,9 +23,9 @@ defmodule Web.AdminDashboardLive do <h2 class="font-bold text-xl">recent statuses</h2> <.link navigate={~p"/admin/posts/new?kind=status"}>new status</.link> </header> - <ol id="recent-statuses" phx-update="stream"> - <li :for={{dom_id, status} <- @streams.statuses} id={dom_id}>{status.body}</li> - </ol> + <.post_list :let={status} id="recent-statuses" stream={@streams.statuses}> + <.link navigate={~p"/admin/posts/#{status}"}>{status.body}</.link> + </.post_list> </section> <section> @@ -34,7 +34,7 @@ defmodule Web.AdminDashboardLive do <.link navigate={~p"/admin/posts/new?kind=blog"}>new blog</.link> </header> <.post_list :let={blog} id="recent-blogs" stream={@streams.blogs}> - <.link href={~p"/admin/posts/#{blog}"}>{blog.title}</.link> + <.link navigate={~p"/admin/posts/#{blog}"}>{blog.title}</.link> </.post_list> </section> </div>