remove old password stuff, fix some links, nav
This commit is contained in:
parent
05f9dce1e5
commit
f8859e8070
4 changed files with 16 additions and 39 deletions
config
lib
mix/tasks
web
|
@ -4,15 +4,6 @@ if System.get_env("PHX_SERVER") do
|
||||||
config :sloanely_but_surely, Web.Endpoint, server: true
|
config :sloanely_but_surely, Web.Endpoint, server: true
|
||||||
end
|
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
|
if config_env() == :prod do
|
||||||
database_url =
|
database_url =
|
||||||
System.get_env("DATABASE_URL") ||
|
System.get_env("DATABASE_URL") ||
|
||||||
|
|
|
@ -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
|
|
|
@ -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="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">
|
<div class="flex flex-col md:flex-row">
|
||||||
<section class="flex flex-row gap-x-2 md:border-r border-gray-200 px-2">
|
<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>
|
💜 <span class="group-hover:underline">sloanelybutsurely.com</span>
|
||||||
</.link>
|
</.link>
|
||||||
<nav>
|
<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>
|
</nav>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -23,9 +23,9 @@ defmodule Web.AdminDashboardLive do
|
||||||
<h2 class="font-bold text-xl">recent statuses</h2>
|
<h2 class="font-bold text-xl">recent statuses</h2>
|
||||||
<.link navigate={~p"/admin/posts/new?kind=status"}>new status</.link>
|
<.link navigate={~p"/admin/posts/new?kind=status"}>new status</.link>
|
||||||
</header>
|
</header>
|
||||||
<ol id="recent-statuses" phx-update="stream">
|
<.post_list :let={status} id="recent-statuses" stream={@streams.statuses}>
|
||||||
<li :for={{dom_id, status} <- @streams.statuses} id={dom_id}>{status.body}</li>
|
<.link navigate={~p"/admin/posts/#{status}"}>{status.body}</.link>
|
||||||
</ol>
|
</.post_list>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
|
@ -34,7 +34,7 @@ defmodule Web.AdminDashboardLive do
|
||||||
<.link navigate={~p"/admin/posts/new?kind=blog"}>new blog</.link>
|
<.link navigate={~p"/admin/posts/new?kind=blog"}>new blog</.link>
|
||||||
</header>
|
</header>
|
||||||
<.post_list :let={blog} id="recent-blogs" stream={@streams.blogs}>
|
<.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>
|
</.post_list>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue