diff --git a/config/config.exs b/config/config.exs index d31789a..5930680 100644 --- a/config/config.exs +++ b/config/config.exs @@ -30,6 +30,7 @@ config :chess, Chess.Auth.Guardian, secret_key: "vd2vXkrYTTFKSKmNMoS2/Hk4Fxn8BkyzsVArRkxJazdQ3mr6bI4YgAC6f8ODiWlM" config :formulator, + validate: false, translate_error_module: ChessWeb.ErrorHelpers # Configure esbuild (the version is required) diff --git a/lib/chess/store/user.ex b/lib/chess/store/user.ex index 34f9c4f..a0ab54b 100644 --- a/lib/chess/store/user.ex +++ b/lib/chess/store/user.ex @@ -76,6 +76,7 @@ defmodule Chess.Store.User do if password do changeset |> change(Argon2.add_hash(password)) + |> change(password: nil) else changeset end diff --git a/test/chess/auth_test.exs b/test/chess/auth_test.exs index c06c408..c9fc97e 100644 --- a/test/chess/auth_test.exs +++ b/test/chess/auth_test.exs @@ -76,15 +76,13 @@ defmodule Chess.AuthTest do test "authenticate_user/1 returns false on incorrect password " do user_fixture(email: "link@hyrule.com", password: "eyeofsheikah") - assert {:error, message} = - Auth.authenticate_user("link@hyrule.com", "shadowtemple") + assert {:error, message} = Auth.authenticate_user("link@hyrule.com", "shadowtemple") assert message == "invalid password" end test "authenticate_user/1 returns true on correct password " do user = user_fixture(email: "link@hyrule.com", password: "eyeofsheikah") - assert {:ok, ^user} = - Auth.authenticate_user("link@hyrule.com", "eyeofsheikah") + assert {:ok, ^user} = Auth.authenticate_user("link@hyrule.com", "eyeofsheikah") end end end diff --git a/test/features/profile_test.exs b/test/features/profile_test.exs index b536821..eda2426 100644 --- a/test/features/profile_test.exs +++ b/test/features/profile_test.exs @@ -7,11 +7,12 @@ defmodule Chess.Features.ProfileTest do import Chess.AuthenticationHelpers test "user can update their details", %{session: session} do - user = insert(:user, %{ - name: "Link", - email: "link@hyrule.com", - password: "ilovezelda" - }) + user = + insert(:user, %{ + name: "Link", + email: "link@hyrule.com", + password: "ilovezelda" + }) session |> login(user.email, "ilovezelda") @@ -25,11 +26,12 @@ defmodule Chess.Features.ProfileTest do end test "name cannot be blank", %{session: session} do - user = insert(:user, %{ - name: "Link", - email: "link@hyrule.com", - password: "ilovezelda" - }) + user = + insert(:user, %{ + name: "Link", + email: "link@hyrule.com", + password: "ilovezelda" + }) session |> login(user.email, "ilovezelda") @@ -40,17 +42,16 @@ defmodule Chess.Features.ProfileTest do |> click(button("Update Profile")) session - |> assert_has( - css("[data-role='name-error']", text: "can't be blank") - ) + |> assert_has(css("[data-role='name-error']", text: "can't be blank")) end test "email cannot be blank", %{session: session} do - user = insert(:user, %{ - name: "Link", - email: "link@hyrule.com", - password: "ilovezelda" - }) + user = + insert(:user, %{ + name: "Link", + email: "link@hyrule.com", + password: "ilovezelda" + }) session |> login(user.email, "ilovezelda") @@ -61,8 +62,6 @@ defmodule Chess.Features.ProfileTest do |> click(button("Update Profile")) session - |> assert_has( - css("[data-role='email-error']", text: "can't be blank") - ) + |> assert_has(css("[data-role='email-error']", text: "can't be blank")) end end