-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
76 Separate Authentication & Registration Views (#79)
* fix: use actual app name instead of dirname * add registration route and navbar link * bump version to `0.8.0` * add passkey components * split registration and authentication views * fix automatic prompt for auth with existing passkeys * update auth live test * rm unnecessary assign reset
- Loading branch information
Showing
17 changed files
with
387 additions
and
251 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
defmodule <%= inspect @web_pascal_case %>.PasskeyComponents do | ||
@moduledoc """ | ||
Components for navigating the application. | ||
""" | ||
use Phoenix.Component | ||
use <%= inspect @web_pascal_case %>, :verified_routes | ||
import <%= inspect @web_pascal_case %>.CoreComponents | ||
alias Phoenix.LiveView.JS | ||
|
||
embed_templates "/passkeys/*" | ||
def guidance(assigns) | ||
|
||
attr :form, Phoenix.HTML.Form, required: true, doc: "Form used to create a session upon successful registration or authentication." | ||
|
||
def token_form(assigns) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<details class="grid gap-4 bg-gray-50 ring-1 ring-gray-200 shadow-lg rounded-lg group"> | ||
<summary class={[ | ||
"px-4 py-2 cursor-pointer transition select-none", | ||
"bg-gray-50 hover:bg-gray-100 font-semibold", | ||
"rounted-t-lg rounded-b-lg group-open:rounded-b-none", | ||
"group-open:border-b-2 group-open:border-gray-300" | ||
]}> | ||
Where's the password? | ||
</summary> | ||
|
||
<div class="py-4 px-8 text-justify grid gap-2"> | ||
<p> | ||
This application uses a new technology that replaces passwords and temporary codes. | ||
</p> | ||
|
||
<p> | ||
<a href="https://fidoalliance.org/passkeys/" class="font-bold" target="_blank"> | ||
Passkeys | ||
</a> | ||
are a more secure way to sign into applications. They use advanced technology embraced by security experts, while improving ease-of-use. | ||
</p> | ||
|
||
<p> | ||
Read more about Passkeys at the <a | ||
href="https://fidoalliance.org/passkeys/#faq" | ||
class="font-bold" | ||
target="_blank" | ||
> | ||
FIDO Alliance | ||
</a>. | ||
</p> | ||
</div> | ||
</details> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<%!-- | ||
- The form is only rendered when a token has been created by the registration or authentication component. | ||
- The form is present in the markup, but hidden from view. | ||
- When the form is mounted, JS is used to click the submit button. | ||
- This is a bit hacky, but it works. | ||
--%> | ||
|
||
<.simple_form | ||
:let={f} | ||
:if={@form} | ||
for={@form} | ||
method="post" | ||
id="token-form" | ||
action={~p"/session"} | ||
phx-mounted={JS.dispatch("click", to: "#token-form button[type='submit']")} | ||
class="hidden" | ||
> | ||
<.input type="text" field={f[:value]} label="Value" /> | ||
<.button type="submit">Go</.button> | ||
</.simple_form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.