diff --git a/lib/towerops/accounts/user.ex b/lib/towerops/accounts/user.ex index 07bc0dd3..4a197ef7 100644 --- a/lib/towerops/accounts/user.ex +++ b/lib/towerops/accounts/user.ex @@ -28,6 +28,7 @@ defmodule Towerops.Accounts.User do field :last_name, :string field :timezone, :string, default: "UTC" field :time_format, :string, default: "24h" + field :language, :string, default: "en" field :totp_secret, :binary, redact: true field :totp_verified_at, :utc_datetime, virtual: true field :privacy_policy_consent, :boolean, virtual: true @@ -110,11 +111,12 @@ defmodule Towerops.Accounts.User do """ def profile_changeset(user, attrs) do user - |> cast(attrs, [:first_name, :last_name, :timezone, :time_format, :default_organization_id]) + |> cast(attrs, [:first_name, :last_name, :timezone, :time_format, :language, :default_organization_id]) |> validate_length(:first_name, max: 100) |> validate_length(:last_name, max: 100) |> validate_length(:timezone, max: 100) |> validate_inclusion(:time_format, ["12h", "24h"]) + |> validate_inclusion(:language, ["en"]) |> foreign_key_constraint(:default_organization_id) end diff --git a/lib/towerops_web/live/user_settings_live.html.heex b/lib/towerops_web/live/user_settings_live.html.heex index a099ebbd..50b84a4b 100644 --- a/lib/towerops_web/live/user_settings_live.html.heex +++ b/lib/towerops_web/live/user_settings_live.html.heex @@ -288,6 +288,39 @@ +