docs: fix incorrect example in getting started guide. (#205)

Closes #204.
This commit is contained in:
James Harton 2023-05-30 10:34:48 +12:00 committed by GitHub
parent 9b43cc8f09
commit 79f03614e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -95,30 +95,47 @@ dependency:
// See the Tailwind configuration guide for advanced usage // See the Tailwind configuration guide for advanced usage
// https://tailwindcss.com/docs/configuration // https://tailwindcss.com/docs/configuration
const plugin = require("tailwindcss/plugin") const plugin = require("tailwindcss/plugin");
module.exports = { module.exports = {
content: [ content: [
"./js/**/*.js", "./js/**/*.js",
"../lib/*_web.ex", "../lib/*_web.ex",
"../lib/*_web/**/*.*ex", "../lib/*_web/**/*.*ex",
"../deps/ash_authentication_phoenix/**/*.ex" // <-- Add this line "../deps/ash_authentication_phoenix/**/*.ex", // <-- Add this line
], ],
theme: { theme: {
extend: { extend: {
colors: { colors: {
brand: "#FD4F00", brand: "#FD4F00",
} },
}, },
}, },
plugins: [ plugins: [
require("@tailwindcss/forms"), require("@tailwindcss/forms"),
plugin(({ addVariant }) => addVariant("phx-no-feedback", [".phx-no-feedback&", ".phx-no-feedback &"])), plugin(({ addVariant }) =>
plugin(({ addVariant }) => addVariant("phx-click-loading", [".phx-click-loading&", ".phx-click-loading &"])), addVariant("phx-no-feedback", [".phx-no-feedback&", ".phx-no-feedback &"])
plugin(({ addVariant }) => addVariant("phx-submit-loading", [".phx-submit-loading&", ".phx-submit-loading &"])), ),
plugin(({ addVariant }) => addVariant("phx-change-loading", [".phx-change-loading&", ".phx-change-loading &"])) plugin(({ addVariant }) =>
] addVariant("phx-click-loading", [
} ".phx-click-loading&",
".phx-click-loading &",
])
),
plugin(({ addVariant }) =>
addVariant("phx-submit-loading", [
".phx-submit-loading&",
".phx-submit-loading &",
])
),
plugin(({ addVariant }) =>
addVariant("phx-change-loading", [
".phx-change-loading&",
".phx-change-loading &",
])
),
],
};
``` ```
## AshPostgres.Repo Setup ## AshPostgres.Repo Setup
@ -256,6 +273,7 @@ end
``` ```
**lib/example/accounts/secrets.ex** **lib/example/accounts/secrets.ex**
```elixir ```elixir
defmodule Example.Accounts.Secrets do defmodule Example.Accounts.Secrets do
use AshAuthentication.Secret use AshAuthentication.Secret
@ -471,7 +489,9 @@ To see how the authentication works we replace the default Phoenix `home.html.ee
<nav class="bg-gray-800"> <nav class="bg-gray-800">
<div class="px-2 mx-auto max-w-7xl sm:px-6 lg:px-8"> <div class="px-2 mx-auto max-w-7xl sm:px-6 lg:px-8">
<div class="relative flex items-center justify-between h-16"> <div class="relative flex items-center justify-between h-16">
<div class="flex items-center justify-center flex-1 sm:items-stretch sm:justify-start"> <div
class="flex items-center justify-center flex-1 sm:items-stretch sm:justify-start"
>
<div class="block ml-6"> <div class="block ml-6">
<div class="flex space-x-4"> <div class="flex space-x-4">
<div class="px-3 py-2 text-xl font-medium text-white "> <div class="px-3 py-2 text-xl font-medium text-white ">
@ -480,24 +500,26 @@ To see how the authentication works we replace the default Phoenix `home.html.ee
</div> </div>
</div> </div>
</div> </div>
<div class="absolute inset-y-0 right-0 flex items-center pr-2 sm:static sm:inset-auto sm:ml-6 sm:pr-0"> <div
class="absolute inset-y-0 right-0 flex items-center pr-2 sm:static sm:inset-auto sm:ml-6 sm:pr-0"
>
<%= if @current_user do %> <%= if @current_user do %>
<span class="px-3 py-2 text-sm font-medium text-white rounded-md"> <span class="px-3 py-2 text-sm font-medium text-white rounded-md">
<%= @current_user.email %> <%= @current_user.email %>
</span> </span>
<a <a
href="/sign-out" href="/sign-out"
class="rounded-lg bg-zinc-100 px-2 py-1 text-[0.8125rem] font-semibold leading-6 text-zinc-900 hover:bg-zinc-200/80 active:text-zinc-900/70" class="rounded-lg bg-zinc-100 px-2 py-1 text-[0.8125rem] font-semibold leading-6 text-zinc-900 hover:bg-zinc-200/80 active:text-zinc-900/70"
> >
Sign out Sign out
</a> </a>
<% else %> <% else %>
<a <a
href="/sign-in" href="/sign-in"
class="rounded-lg bg-zinc-100 px-2 py-1 text-[0.8125rem] font-semibold leading-6 text-zinc-900 hover:bg-zinc-200/80 active:text-zinc-900/70" class="rounded-lg bg-zinc-100 px-2 py-1 text-[0.8125rem] font-semibold leading-6 text-zinc-900 hover:bg-zinc-200/80 active:text-zinc-900/70"
> >
Sign In Sign In
</a> </a>
<% end %> <% end %>
</div> </div>
</div> </div>
@ -507,13 +529,17 @@ To see how the authentication works we replace the default Phoenix `home.html.ee
<div class="py-10"> <div class="py-10">
<header> <header>
<div class="px-4 mx-auto max-w-7xl sm:px-6 lg:px-8"> <div class="px-4 mx-auto max-w-7xl sm:px-6 lg:px-8">
<h1 class="text-3xl font-bold leading-tight tracking-tight text-gray-900">Demo</h1> <h1 class="text-3xl font-bold leading-tight tracking-tight text-gray-900">
Demo
</h1>
</div> </div>
</header> </header>
<main> <main>
<div class="mx-auto max-w-7xl sm:px-6 lg:px-8"> <div class="mx-auto max-w-7xl sm:px-6 lg:px-8">
<div class="px-4 py-8 sm:px-0"> <div class="px-4 py-8 sm:px-0">
<div class="border-4 border-gray-200 border-dashed rounded-lg h-96"></div> <div
class="border-4 border-gray-200 border-dashed rounded-lg h-96"
></div>
</div> </div>
</div> </div>
</main> </main>
@ -549,10 +575,10 @@ In this section we add a reset password functionality. Which is triggered by add
# [...] # [...]
strategies do strategies do
password :password do password :password do
identity_field(:unique_email) identity_field :email
resettable do resettable do
sender(Example.Accounts.User.Senders.SendPasswordResetEmail) sender Example.Accounts.User.Senders.SendPasswordResetEmail
end end
end end
end end