From 8ad82b515e5163ecebca84908a270f26daa596ad Mon Sep 17 00:00:00 2001 From: Jamil Date: Tue, 28 Nov 2023 15:58:50 -0800 Subject: [PATCH] "Magic Link" -> "Email" (#2731) Updates user-facing terminology to `One-Time Password` to more accurately reflect this sign in method and match docs more consistently Refs #2688 Refs #2021 --- elixir/README.md | 2 +- elixir/apps/domain/lib/domain/config/definitions.ex | 4 ++-- .../apps/web/lib/web/controllers/auth_controller.ex | 2 +- .../live/settings/identity_providers/components.ex | 2 +- elixir/apps/web/lib/web/live/sign_in.ex | 4 ++-- elixir/apps/web/lib/web/live/sign_in/email.ex | 4 ++-- elixir/apps/web/lib/web/live/sign_up.ex | 4 ++-- elixir/apps/web/lib/web/mailer/auth_email.ex | 2 +- .../lib/web/mailer/auth_email/sign_in_link.html.heex | 6 +++--- .../apps/web/test/web/acceptance/auth/email_test.exs | 10 +++++----- elixir/apps/web/test/web/acceptance/auth_test.exs | 2 +- .../test/web/controllers/auth_controller_test.exs | 12 ++++++------ .../live/settings/identity_providers/index_test.exs | 2 +- elixir/apps/web/test/web/live/sign_in/email_test.exs | 2 +- elixir/apps/web/test/web/live/sign_in_test.exs | 4 ++-- 15 files changed, 31 insertions(+), 31 deletions(-) diff --git a/elixir/README.md b/elixir/README.md index 8badf4d20..848a37272 100644 --- a/elixir/README.md +++ b/elixir/README.md @@ -300,7 +300,7 @@ Interactive Elixir (1.15.2) - press Ctrl+C to exit (type h() ENTER for help) iex(web@web-3vmw.us-east1-d.c.firezone-staging.internal)1> {:ok, account} = Domain.Accounts.create_account(%{name: "Firezone", slug: "firezone"}) {:ok, ...} -iex(web@web-3vmw.us-east1-d.c.firezone-staging.internal)2> {:ok, magic_link_provider} = Domain.Auth.create_provider(account, %{name: "Magic Link", adapter: :email, adapter_config: %{}}) +iex(web@web-3vmw.us-east1-d.c.firezone-staging.internal)2> {:ok, magic_link_provider} = Domain.Auth.create_provider(account, %{name: "Email", adapter: :email, adapter_config: %{}}) {:ok, ...} iex(web@web-3vmw.us-east1-d.c.firezone-staging.internal)3> {:ok, actor} = Domain.Actors.create_actor(account, %{type: :account_admin_user, name: "Andrii Dryga"}) diff --git a/elixir/apps/domain/lib/domain/config/definitions.ex b/elixir/apps/domain/lib/domain/config/definitions.ex index 74fac02f2..15fc2a695 100644 --- a/elixir/apps/domain/lib/domain/config/definitions.ex +++ b/elixir/apps/domain/lib/domain/config/definitions.ex @@ -100,7 +100,7 @@ defmodule Domain.Config.Definitions do Providers: * `openid_connect` is used to authenticate users via OpenID Connect, this is recommended for production use; - * `email` is used to authenticate users via magic links sent to the email; + * `email` is used to authenticate users via sign in tokens sent to the email; * `token` is used to authenticate service accounts using an API token; * `userpass` is used to authenticate users with username and password, should be used with extreme care and is not recommended for production use. @@ -460,7 +460,7 @@ defmodule Domain.Config.Definitions do ) ############################################## - ## Userpass / SAML / OIDC / Magic Link authentication + ## Userpass / SAML / OIDC / Email authentication ############################################## @doc """ diff --git a/elixir/apps/web/lib/web/controllers/auth_controller.ex b/elixir/apps/web/lib/web/controllers/auth_controller.ex index 0617b34c6..04cc9e921 100644 --- a/elixir/apps/web/lib/web/controllers/auth_controller.ex +++ b/elixir/apps/web/lib/web/controllers/auth_controller.ex @@ -170,7 +170,7 @@ defmodule Web.AuthController do redirect_params = put_if_not_empty(redirect_params, "provider_identifier", identity_id) conn - |> put_flash(:error, "The sign in link is invalid or expired.") + |> put_flash(:error, "The sign in token is invalid or expired.") |> redirect( to: ~p"/#{account_id_or_slug}/sign_in/providers/email/#{provider_id}?#{redirect_params}" ) diff --git a/elixir/apps/web/lib/web/live/settings/identity_providers/components.ex b/elixir/apps/web/lib/web/live/settings/identity_providers/components.ex index 90c172ee8..57c3c1899 100644 --- a/elixir/apps/web/lib/web/live/settings/identity_providers/components.ex +++ b/elixir/apps/web/lib/web/live/settings/identity_providers/components.ex @@ -125,7 +125,7 @@ defmodule Web.Settings.IdentityProviders.Components do """ end - def adapter_name(:email), do: "Magic Link" + def adapter_name(:email), do: "Email" def adapter_name(:userpass), do: "Username & Password" def adapter_name(:token), do: "API Access Token" def adapter_name(:workos), do: "WorkOS" diff --git a/elixir/apps/web/lib/web/live/sign_in.ex b/elixir/apps/web/lib/web/live/sign_in.ex index 5888ac27c..b6931ffb4 100644 --- a/elixir/apps/web/lib/web/live/sign_in.ex +++ b/elixir/apps/web/lib/web/live/sign_in.ex @@ -85,7 +85,7 @@ defmodule Web.SignIn do <:item :if={adapter_enabled?(@providers_by_adapter, :email)}>

- Sign in with a magic link + Sign in with email

<.providers_group_form @@ -200,7 +200,7 @@ defmodule Web.SignIn do <:actions> <.button phx-disable-with="Sending..." class="w-full"> - Request sign in link + Request sign in token diff --git a/elixir/apps/web/lib/web/live/sign_in/email.ex b/elixir/apps/web/lib/web/live/sign_in/email.ex index 1aaf56f1e..46033ea80 100644 --- a/elixir/apps/web/lib/web/live/sign_in/email.ex +++ b/elixir/apps/web/lib/web/live/sign_in/email.ex @@ -45,8 +45,8 @@ defmodule Web.SignIn.Email do

- Should the provided email be registered, a sign-in link and token are dispatched to your email account. - Please copy and paste this token into the form below to proceed with your login. + Should the provided email be registered, a sign in token has been sent to your email account. + Please copy and paste this into the form below to proceed with your login.

- Your account has been created! Please check your email for a sign in link. + Your account has been created! Please check your email for sign in instructions.
@@ -254,7 +254,7 @@ defmodule Web.SignUp do :provider, fn _repo, %{account: account} -> Auth.create_provider(account, %{ - name: "Magic Link", + name: "Email", adapter: :email, adapter_config: %{} }) diff --git a/elixir/apps/web/lib/web/mailer/auth_email.ex b/elixir/apps/web/lib/web/mailer/auth_email.ex index 4cf861223..61497a224 100644 --- a/elixir/apps/web/lib/web/mailer/auth_email.ex +++ b/elixir/apps/web/lib/web/mailer/auth_email.ex @@ -44,7 +44,7 @@ defmodule Web.Mailer.AuthEmail do ) default_email() - |> subject("Firezone Sign In Link") + |> subject("Firezone sign in token") |> to(identity.provider_identifier) |> render_body(__MODULE__, :sign_in_link, account: identity.account, diff --git a/elixir/apps/web/lib/web/mailer/auth_email/sign_in_link.html.heex b/elixir/apps/web/lib/web/mailer/auth_email/sign_in_link.html.heex index 75d58f174..6e9acbf58 100644 --- a/elixir/apps/web/lib/web/mailer/auth_email/sign_in_link.html.heex +++ b/elixir/apps/web/lib/web/mailer/auth_email/sign_in_link.html.heex @@ -1,4 +1,4 @@ -

Magic sign-in link

+

Sign in token

Dear Firezone user, @@ -6,7 +6,7 @@

- Please copy the code and paste it into the Firezone application to proceed with + Please copy the token below and paste it into the Firezone application to proceed with signing in to "<%= @account.name %>":

@@ -15,7 +15,7 @@

- or click on the magic sign-in link + or click this link if you are on the same device where you are trying to sign in.

diff --git a/elixir/apps/web/test/web/acceptance/auth/email_test.exs b/elixir/apps/web/test/web/acceptance/auth/email_test.exs index a132e20ed..83e2e6652 100644 --- a/elixir/apps/web/test/web/acceptance/auth/email_test.exs +++ b/elixir/apps/web/test/web/acceptance/auth/email_test.exs @@ -9,11 +9,11 @@ defmodule Web.Acceptance.SignIn.EmailTest do session |> visit(~p"/#{account}") - |> assert_el(Query.text("Sign in with a magic link")) + |> assert_el(Query.text("Sign in with email")) |> fill_form(%{ "email[provider_identifier]" => "foo@bar.com" }) - |> click(Query.button("Request sign in link")) + |> click(Query.button("Request sign in token")) |> assert_el(Query.text("Please check your email")) end @@ -40,14 +40,14 @@ defmodule Web.Acceptance.SignIn.EmailTest do defp email_login_flow(session, account, email) do session |> visit(~p"/#{account}") - |> assert_el(Query.text("Sign in with a magic link")) + |> assert_el(Query.text("Sign in with email")) |> fill_form(%{ "email[provider_identifier]" => email }) - |> click(Query.button("Request sign in link")) + |> click(Query.button("Request sign in token")) |> assert_el(Query.text("Please check your email")) |> click(Query.link("Open Local")) - |> click(Query.link("Firezone Sign In Link")) + |> click(Query.link("Firezone sign in token")) |> assert_el(Query.text("Text body")) email_text = text(session, Query.css("body")) diff --git a/elixir/apps/web/test/web/acceptance/auth_test.exs b/elixir/apps/web/test/web/acceptance/auth_test.exs index 737b06535..314125242 100644 --- a/elixir/apps/web/test/web/acceptance/auth_test.exs +++ b/elixir/apps/web/test/web/acceptance/auth_test.exs @@ -18,7 +18,7 @@ defmodule Web.Acceptance.AuthTest do |> assert_el(Query.text("Sign into #{account.name}")) |> assert_el(Query.link("Sign in with #{openid_connect_provider.name}")) |> assert_el(Query.text("Sign in with username and password")) - |> assert_el(Query.text("Sign in with a magic link")) + |> assert_el(Query.text("Sign in with email")) end describe "sign out" do diff --git a/elixir/apps/web/test/web/controllers/auth_controller_test.exs b/elixir/apps/web/test/web/controllers/auth_controller_test.exs index 22c97155e..70e9ae25b 100644 --- a/elixir/apps/web/test/web/controllers/auth_controller_test.exs +++ b/elixir/apps/web/test/web/controllers/auth_controller_test.exs @@ -439,7 +439,7 @@ defmodule Web.AuthControllerTest do ) assert_email_sent(fn email -> - assert email.subject == "Firezone Sign In Link" + assert email.subject == "Firezone sign in token" verify_sign_in_token_path = ~p"/#{account}/sign_in/providers/#{provider.id}/verify_sign_in_token" @@ -472,7 +472,7 @@ defmodule Web.AuthControllerTest do ) assert_email_sent(fn email -> - assert email.subject == "Firezone Sign In Link" + assert email.subject == "Firezone sign in token" assert email.text_body =~ "Please copy the code and paste it into" end) @@ -552,7 +552,7 @@ defmodule Web.AuthControllerTest do assert redirected_to(conn) == ~p"/#{provider.account_id}/sign_in/providers/email/#{provider}?provider_identifier=#{identity_id}" - assert flash(conn, :error) == "The sign in link is invalid or expired." + assert flash(conn, :error) == "The sign in token is invalid or expired." end test "redirects back to the form when sign in token is invalid", %{conn: conn} do @@ -575,7 +575,7 @@ defmodule Web.AuthControllerTest do "&client_csrf_token=foo" <> "&provider_identifier=#{identity.id}" - assert flash(conn, :error) == "The sign in link is invalid or expired." + assert flash(conn, :error) == "The sign in token is invalid or expired." end test "redirects back to the form when browser token is invalid", %{conn: conn} do @@ -613,7 +613,7 @@ defmodule Web.AuthControllerTest do "&client_csrf_token=bar" <> "&provider_identifier=#{identity.id}" - assert flash(conn, :error) == "The sign in link is invalid or expired." + assert flash(conn, :error) == "The sign in token is invalid or expired." end test "redirects back to the form when browser token is not set", %{conn: conn} do @@ -646,7 +646,7 @@ defmodule Web.AuthControllerTest do ~p"/#{account}/sign_in/providers/email/#{provider}" <> "?provider_identifier=#{identity.id}" - assert flash(conn, :error) == "The sign in link is invalid or expired." + assert flash(conn, :error) == "The sign in token is invalid or expired." end test "redirects to the return to path when credentials are valid", %{conn: conn} do diff --git a/elixir/apps/web/test/web/live/settings/identity_providers/index_test.exs b/elixir/apps/web/test/web/live/settings/identity_providers/index_test.exs index 582eeee37..7e9b1eace 100644 --- a/elixir/apps/web/test/web/live/settings/identity_providers/index_test.exs +++ b/elixir/apps/web/test/web/live/settings/identity_providers/index_test.exs @@ -93,7 +93,7 @@ defmodule Web.Live.Settings.IdentityProviders.IndexTest do assert row["sync status"] =~ "Created 1 identity and 0 groups" end) |> with_table_row("name", email_provider.name, fn row -> - assert row["type"] == "Magic Link" + assert row["type"] == "Email" assert row["status"] =~ "Disabled" assert row["sync status"] =~ "Created 0 identities and 0 groups" end) diff --git a/elixir/apps/web/test/web/live/sign_in/email_test.exs b/elixir/apps/web/test/web/live/sign_in/email_test.exs index c9e0c0466..77f7c108a 100644 --- a/elixir/apps/web/test/web/live/sign_in/email_test.exs +++ b/elixir/apps/web/test/web/live/sign_in/email_test.exs @@ -135,7 +135,7 @@ defmodule Web.SignIn.EmailTest do "&client_csrf_token=foo" <> "&provider_identifier=#{identity.id}" - assert conn.assigns.flash["error"] == "The sign in link is invalid or expired." + assert conn.assigns.flash["error"] == "The sign in token is invalid or expired." end test "allows to resend magic link", %{ diff --git a/elixir/apps/web/test/web/live/sign_in_test.exs b/elixir/apps/web/test/web/live/sign_in_test.exs index be50ce4b2..16362c17e 100644 --- a/elixir/apps/web/test/web/live/sign_in_test.exs +++ b/elixir/apps/web/test/web/live/sign_in_test.exs @@ -10,7 +10,7 @@ defmodule Web.SignInTest do {:ok, _lv, html} = live(conn, ~p"/#{account}") - assert html =~ "Sign in with a magic link" + assert html =~ "Sign in with email" refute html =~ "Sign in with username and password" userpass_provider = Fixtures.Auth.create_userpass_provider(account: account) @@ -41,7 +41,7 @@ defmodule Web.SignInTest do {:ok, _provider} = Domain.Auth.delete_provider(email_provider, subject) {:ok, _lv, html} = live(conn, ~p"/#{account}") - refute html =~ "Sign in with a magic link" + refute html =~ "Sign in with email" assert html =~ "Vault" end