From e33f8ad22fc2207174408107df3bddcfbf62cca8 Mon Sep 17 00:00:00 2001 From: SantiSvk Date: Tue, 18 Jun 2024 11:53:49 -0300 Subject: [PATCH] antes de viaje --- lib/derivantes/accounts/user.ex | 9 +- .../components/layouts/root.html.heex | 1 + .../live/derivantes/derivantes_live.ex | 92 ++++++++++- .../live/derivantes/derivanteshash_live.ex | 154 ------------------ .../live/user_registration_live.ex | 1 + .../20240610131325_add_matricula_to_user.exs | 11 ++ 6 files changed, 111 insertions(+), 157 deletions(-) delete mode 100755 lib/derivantes_web/live/derivantes/derivanteshash_live.ex create mode 100644 priv/repo/migrations/20240610131325_add_matricula_to_user.exs diff --git a/lib/derivantes/accounts/user.ex b/lib/derivantes/accounts/user.ex index 12e4752..e2dc477 100644 --- a/lib/derivantes/accounts/user.ex +++ b/lib/derivantes/accounts/user.ex @@ -3,6 +3,7 @@ defmodule Derivantes.Accounts.User do import Ecto.Changeset schema "users" do + field :matricula, :string field :email, :string field :password, :string, virtual: true, redact: true field :hashed_password, :string, redact: true @@ -36,9 +37,15 @@ defmodule Derivantes.Accounts.User do """ def registration_changeset(user, attrs, opts \\ []) do user - |> cast(attrs, [:email, :password]) + |> cast(attrs, [:email, :password, :matricula]) |> validate_email(opts) |> validate_password(opts) + |> validate_matricula(opts) + end + + defp validate_matricula(changeset, opts) do + IO.inspect(opts) + changeset end defp validate_email(changeset, opts) do diff --git a/lib/derivantes_web/components/layouts/root.html.heex b/lib/derivantes_web/components/layouts/root.html.heex index e5975b2..11cd701 100644 --- a/lib/derivantes_web/components/layouts/root.html.heex +++ b/lib/derivantes_web/components/layouts/root.html.heex @@ -10,6 +10,7 @@ +