Skip to content

Commit

Permalink
chore(auth): fix WebAuthn spelling
Browse files Browse the repository at this point in the history
  • Loading branch information
kloenk committed Jul 22, 2023
1 parent d4cb9ab commit c2ea470
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 29 deletions.
2 changes: 1 addition & 1 deletion apps/ex_fleet_yards_auth/assets/js/webauthn/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function setMsg(msg) {

function webAuthnLogin() {
if (!isWebAuthnSupported()) {
setMsg("This browser does not support WebAuthN")
setMsg("This browser does not support WebAuthn")
return
}
fetch(WEBAUTHN_LOGIN_CHALLENGE_URL, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<span class="absolute left-0 inset-y-0 flex items-center pl-3">
<.icon name="hero-lock-closed-solid" />
</span>
Sign in via WebAuthN
Sign in via WebAuthn
</a>
</div>
<% end %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<img class="mx-auto h-12 w-auto" src={~p"/images/logo-dark.png"} alt="Logo" />

<h2 class="mt-6 text-center text-3xl font-extrabold text-white">
WebAuthN
WebAuthn
</h2>
</div>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule ExFleetYardsAuth.Auth.WebAuthNController do
defmodule ExFleetYardsAuth.Auth.WebAuthnController do
@moduledoc """
U2F controller to register new keys
"""
Expand All @@ -8,18 +8,7 @@ defmodule ExFleetYardsAuth.Auth.WebAuthNController do
alias ExFleetYards.Repo.Account
alias ExFleetYards.Repo.Account.User

plug :put_view, html: ExFleetYardsAuth.Auth.WebAuthNHTML

def index(conn, %{}) do
user = conn.assigns[:current_user]
{:ok, {_, totp}} = User.second_factors(user)

conn
|> render("index.html",
u2f_tokens: [],
totp_tokens: totp
)
end
plug :put_view, html: ExFleetYardsAuth.Auth.WebAuthnHTML

def register_challenge(conn, %{}) do
user = conn.assigns[:current_user]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule ExFleetYardsAuth.Auth.WebAuthNHTML do
defmodule ExFleetYardsAuth.Auth.WebAuthnHTML do
use ExFleetYardsAuth, :html

embed_templates "webauthn_html/*"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
<img class="mx-auto h-12 w-auto" src={~p"/images/logo-dark.png"} alt="Logo" />
<h2 class="mt-6 text-center text-3xl font-extrabold text-white">
WebAuthN Key Register and Management
WebAuthn Key Register and Management
</h2>
</div>
<%= if !@totp_tokens do %>
<a href={~p"/totp"}>
<div class="mt-8 sm:mx-auto sm:w-full sm:max-w-md py-2 px-4 bg-yellow-500 rounded-md">
<p class="text-md font-medium text-white">
No TOTP tokens are configured. You will not be able to recover your account if you lose your WebAuthN key.
No TOTP tokens are configured. You will not be able to recover your account if you lose your WebAuthn key.
</p>
</div>
</a>
Expand Down Expand Up @@ -52,7 +52,7 @@
id="webauthn_key_name"
type="text"
required
placeholder="Enter WebAuthN key name"
placeholder="Enter WebAuthn key name"
/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
defmodule ExFleetYardsAuth.Auth.WebAuthNLive do
defmodule ExFleetYardsAuth.Auth.WebAuthnLive do
@doc """
Live view for WebAuthN
Live view for WebAuthn
"""
use ExFleetYardsAuth, :live_view

alias ExFleetYards.Repo.Account.User

def render(assigns) do
ExFleetYardsAuth.Auth.WebAuthNHTML.index(assigns)
ExFleetYardsAuth.Auth.WebAuthnHTML.index(assigns)
end

def mount(params, %{"user_token" => user_token}, socket) do
Expand Down
11 changes: 5 additions & 6 deletions apps/ex_fleet_yards_auth/lib/ex_fleet_yards_auth/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ defmodule ExFleetYardsAuth.Router do
scope "/webauthn" do
pipe_through :browser_api

post "/challenge", WebAuthNController, :login_challenge
post "/", WebAuthNController, :login
post "/challenge", WebAuthnController, :login_challenge
post "/", WebAuthnController, :login
end
end

Expand All @@ -55,14 +55,13 @@ defmodule ExFleetYardsAuth.Router do
scope "/webauthn", ExFleetYardsAuth.Auth do
pipe_through :require_authenticated_user

# get "/", WebAuthNController, :index
live "/", WebAuthNLive
live "/", WebAuthnLive

scope "/" do
pipe_through :browser_api

post "/register/challenge", WebAuthNController, :register_challenge
post "/register", WebAuthNController, :register
post "/register/challenge", WebAuthnController, :register_challenge
post "/register", WebAuthnController, :register
end
end
end
Expand Down

0 comments on commit c2ea470

Please sign in to comment.