diff --git a/assets/css/app.css b/assets/css/app.css index 41f56fb..13994e5 100644 --- a/assets/css/app.css +++ b/assets/css/app.css @@ -14,6 +14,10 @@ html { font-size: 16px; } +* { + box-sizing: border-box; +} + *::selection { background-color: var(--accent); color: var(--bg); diff --git a/assets/css/core_components.css b/assets/css/core_components.css index 9772f70..b5eec67 100644 --- a/assets/css/core_components.css +++ b/assets/css/core_components.css @@ -3,6 +3,7 @@ font-size: 0.875rem; font-weight: 600; line-height: 1.5rem; + margin-top: 16px; } .error { @@ -147,6 +148,11 @@ font-size: 0.875rem; font-weight: 600; line-height: 1.5rem; + background-color: #312d51; + border: 2px solid #7a7abd; + color: white; + cursor: pointer; + width: 100%; } .input { @@ -154,6 +160,14 @@ margin-top: 0.5rem; border-radius: 0.5rem; width: 100%; + background-color: #312d51; + border: 2px solid #7a7abd; + padding: 4px 8px; + color: white; +} + +.input:focus { + outline: 1px solid #7a7abd; } @media (min-width: 640px) { @@ -168,6 +182,17 @@ margin-top: 0.5rem; border-radius: 0.5rem; width: 100%; + background-color: #312d51; + border: 2px solid #7a7abd; + padding: 4px 8px; + color: white; + resize: vertical; + min-height: 50px; + max-height: 330px; +} + +.textarea:focus { + outline: 1px solid #7a7abd; } @media (min-width: 640px) { diff --git a/lib/comfycamp/accounts/user.ex b/lib/comfycamp/accounts/user.ex index 66a3727..60b0a0d 100644 --- a/lib/comfycamp/accounts/user.ex +++ b/lib/comfycamp/accounts/user.ex @@ -8,6 +8,8 @@ defmodule Comfycamp.Accounts.User do field :hashed_password, :string, redact: true field :confirmed_at, :naive_datetime field :is_admin, :boolean, default: false + field :is_approved, :boolean, default: false + field :info, :string timestamps(type: :utc_datetime) end @@ -37,9 +39,10 @@ defmodule Comfycamp.Accounts.User do """ def registration_changeset(user, attrs, opts \\ []) do user - |> cast(attrs, [:email, :password]) + |> cast(attrs, [:email, :password, :info]) |> validate_email(opts) |> validate_password(opts) + |> validate_info() end defp validate_email(changeset, opts) do @@ -86,6 +89,11 @@ defmodule Comfycamp.Accounts.User do end end + defp validate_info(changeset) do + changeset + |> validate_length(:info, max: 4096) + end + @doc """ A user changeset for changing the email. diff --git a/lib/comfycamp_web/live/user_registration_live.ex b/lib/comfycamp_web/live/user_registration_live.ex index a92a7cc..3adbeb3 100644 --- a/lib/comfycamp_web/live/user_registration_live.ex +++ b/lib/comfycamp_web/live/user_registration_live.ex @@ -33,6 +33,11 @@ defmodule ComfycampWeb.UserRegistrationLive do <.input field={@form[:email]} type="email" label="Email" required /> <.input field={@form[:password]} type="password" label="Пароль" required /> + <.input field={@form[:info]} type="textarea" label="Почему вы хотите получить доступ?" required /> +

+ Ваш небольшой рассказ помогает защитить сервисы. + Можете указать ссылки на соцсети. +

<:actions> <.button phx-disable-with="Создаю аккаунт..." class="w-full"> diff --git a/priv/repo/migrations/20240815172732_user_moderation.exs b/priv/repo/migrations/20240815172732_user_moderation.exs new file mode 100644 index 0000000..8a1b3c4 --- /dev/null +++ b/priv/repo/migrations/20240815172732_user_moderation.exs @@ -0,0 +1,10 @@ +defmodule Comfycamp.Repo.Migrations.UserModeration do + use Ecto.Migration + + def change do + alter table(:users) do + add :is_approved, :boolean, null: false, default: false + add :info, :string, size: 4096, null: true + end + end +end