aaronrenner / phx_gen_auth

An authentication system generator for Phoenix 1.5 applications.
772 stars 55 forks source link

Use redact: true from Ecto v3.5 instead of deriving inspect #91

Closed josevalim closed 3 years ago

josevalim commented 4 years ago

Here is the diff:

diff --git a/apps/bytepack/lib/bytepack/accounts/user.ex b/apps/bytepack/lib/bytepack/accounts/user.ex
index ee2032f..0ddc88d 100644
--- a/apps/bytepack/lib/bytepack/accounts/user.ex
+++ b/apps/bytepack/lib/bytepack/accounts/user.ex
@@ -2,11 +2,10 @@ defmodule Bytepack.Accounts.User do
   use Bytepack.Schema
   import Ecto.Changeset

-  @derive {Inspect, except: [:password]}
   schema "users" do
     field :email, :string
-    field :password, :string, virtual: true
-    field :hashed_password, :string
+    field :password, :string, virtual: true, redact: true
+    field :hashed_password, :string, redact: true
     field :confirmed_at, :utc_datetime_usec
     field :is_staff, :boolean, default: false
     timestamps()

However, this requires Ecto v3.5, so I would only do these changes after the generator is merged into Phoenix. I have already bumped Phoenix master to require v3.5.

aaronrenner commented 3 years ago

Closing in favor of https://github.com/phoenixframework/phoenix/pull/4092 on phoenix master.