remove old password stuff, fix some links, nav

This commit is contained in:
sloane 2025-03-31 08:55:11 -04:00
parent 05f9dce1e5
commit f8859e8070
Signed by: sloanelybutsurely
SSH key fingerprint: SHA256:8SBnwhl+RY3oEyQxy1a9wByPzxWM0x+/Ejc+sIlY5qQ
4 changed files with 16 additions and 39 deletions

View file

@ -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") ||

View file

@ -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

View file

@ -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>

View file

@ -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>