forked from shibao/cannery
improve changesets and typespecs
This commit is contained in:
parent
20a2311229
commit
e0ac714681
@ -1,3 +1,6 @@
|
|||||||
|
# v0.7.2
|
||||||
|
- Code improvements
|
||||||
|
|
||||||
# v0.7.1
|
# v0.7.1
|
||||||
- Fix table component alignment and styling
|
- Fix table component alignment and styling
|
||||||
- Fix toggle button styling
|
- Fix toggle button styling
|
||||||
|
@ -17,8 +17,8 @@ If you're multilingual, this project can use your translations! Visit
|
|||||||
functions as short as possible while keeping variable names descriptive! For
|
functions as short as possible while keeping variable names descriptive! For
|
||||||
instance, use inline `do:` blocks for short functions and make your aliases as
|
instance, use inline `do:` blocks for short functions and make your aliases as
|
||||||
short as possible without introducing ambiguity.
|
short as possible without introducing ambiguity.
|
||||||
- I.e. since there's only one `Changeset` in the app, please alias
|
- I.e. since there's only one `AmmoGroup` in the app, please alias
|
||||||
`Changeset.t(Type.t())` instead of using `Ecto.Changeset.t(Long.Type.t())`
|
`AmmoGroup.t()` instead of using `Cannery.Ammo.AmmoGroup.t()`
|
||||||
- Use pipelines when possible. If only calling a single method, a pipeline isn't
|
- Use pipelines when possible. If only calling a single method, a pipeline isn't
|
||||||
strictly necessary but still encouraged for future modification.
|
strictly necessary but still encouraged for future modification.
|
||||||
- Please add typespecs to your functions! Even your private functions may be
|
- Please add typespecs to your functions! Even your private functions may be
|
||||||
|
@ -23,7 +23,7 @@ defmodule Cannery.Accounts do
|
|||||||
nil
|
nil
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@spec get_user_by_email(String.t()) :: User.t() | nil
|
@spec get_user_by_email(email :: String.t()) :: User.t() | nil
|
||||||
def get_user_by_email(email) when is_binary(email), do: Repo.get_by(User, email: email)
|
def get_user_by_email(email) when is_binary(email), do: Repo.get_by(User, email: email)
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
@ -38,7 +38,7 @@ defmodule Cannery.Accounts do
|
|||||||
nil
|
nil
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@spec get_user_by_email_and_password(String.t(), String.t()) ::
|
@spec get_user_by_email_and_password(email :: String.t(), password :: String.t()) ::
|
||||||
User.t() | nil
|
User.t() | nil
|
||||||
def get_user_by_email_and_password(email, password)
|
def get_user_by_email_and_password(email, password)
|
||||||
when is_binary(email) and is_binary(password) do
|
when is_binary(email) and is_binary(password) do
|
||||||
@ -86,7 +86,7 @@ defmodule Cannery.Accounts do
|
|||||||
[%User{}]
|
[%User{}]
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@spec list_users_by_role(:admin | :user) :: [User.t()]
|
@spec list_users_by_role(User.role()) :: [User.t()]
|
||||||
def list_users_by_role(role) do
|
def list_users_by_role(role) do
|
||||||
role = role |> to_string()
|
role = role |> to_string()
|
||||||
Repo.all(from u in User, where: u.role == ^role, order_by: u.email)
|
Repo.all(from u in User, where: u.role == ^role, order_by: u.email)
|
||||||
@ -106,15 +106,21 @@ defmodule Cannery.Accounts do
|
|||||||
{:error, %Changeset{}}
|
{:error, %Changeset{}}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@spec register_user(map()) :: {:ok, User.t()} | {:error, Changeset.t(User.new_user())}
|
@spec register_user(attrs :: map()) :: {:ok, User.t()} | {:error, User.changeset()}
|
||||||
def register_user(attrs) do
|
def register_user(attrs) do
|
||||||
|
Multi.new()
|
||||||
|
|> Multi.one(:users_count, from(u in User, select: count(u.id), distinct: true))
|
||||||
|
|> Multi.insert(:add_user, fn %{users_count: count} ->
|
||||||
# if no registered users, make first user an admin
|
# if no registered users, make first user an admin
|
||||||
role =
|
role = if count == 0, do: "admin", else: "user"
|
||||||
if Repo.one!(from u in User, select: count(u.id), distinct: true) == 0,
|
|
||||||
do: "admin",
|
|
||||||
else: "user"
|
|
||||||
|
|
||||||
%User{} |> User.registration_changeset(attrs |> Map.put("role", role)) |> Repo.insert()
|
User.registration_changeset(attrs) |> User.role_changeset(role)
|
||||||
|
end)
|
||||||
|
|> Repo.transaction()
|
||||||
|
|> case do
|
||||||
|
{:ok, %{add_user: user}} -> {:ok, user}
|
||||||
|
{:error, :add_user, changeset, _changes_so_far} -> {:error, changeset}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
@ -126,12 +132,10 @@ defmodule Cannery.Accounts do
|
|||||||
%Changeset{data: %User{}}
|
%Changeset{data: %User{}}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@spec change_user_registration(User.t() | User.new_user()) ::
|
@spec change_user_registration() :: User.changeset()
|
||||||
Changeset.t(User.t() | User.new_user())
|
@spec change_user_registration(attrs :: map()) :: User.changeset()
|
||||||
@spec change_user_registration(User.t() | User.new_user(), map()) ::
|
def change_user_registration(attrs \\ %{}),
|
||||||
Changeset.t(User.t() | User.new_user())
|
do: User.registration_changeset(attrs, hash_password: false)
|
||||||
def change_user_registration(user, attrs \\ %{}),
|
|
||||||
do: User.registration_changeset(user, attrs, hash_password: false)
|
|
||||||
|
|
||||||
## Settings
|
## Settings
|
||||||
|
|
||||||
@ -144,7 +148,8 @@ defmodule Cannery.Accounts do
|
|||||||
%Changeset{data: %User{}}
|
%Changeset{data: %User{}}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@spec change_user_email(User.t(), map()) :: Changeset.t(User.t())
|
@spec change_user_email(User.t()) :: User.changeset()
|
||||||
|
@spec change_user_email(User.t(), attrs :: map()) :: User.changeset()
|
||||||
def change_user_email(user, attrs \\ %{}), do: User.email_changeset(user, attrs)
|
def change_user_email(user, attrs \\ %{}), do: User.email_changeset(user, attrs)
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
@ -156,7 +161,7 @@ defmodule Cannery.Accounts do
|
|||||||
%Changeset{data: %User{}}
|
%Changeset{data: %User{}}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@spec change_user_role(User.t(), atom()) :: Changeset.t(User.t())
|
@spec change_user_role(User.t(), User.role()) :: User.changeset()
|
||||||
def change_user_role(user, role), do: User.role_changeset(user, role)
|
def change_user_role(user, role), do: User.role_changeset(user, role)
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
@ -172,8 +177,8 @@ defmodule Cannery.Accounts do
|
|||||||
{:error, %Changeset{}}
|
{:error, %Changeset{}}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@spec apply_user_email(User.t(), String.t(), map()) ::
|
@spec apply_user_email(User.t(), email :: String.t(), attrs :: map()) ::
|
||||||
{:ok, User.t()} | {:error, Changeset.t(User.t())}
|
{:ok, User.t()} | {:error, User.changeset()}
|
||||||
def apply_user_email(user, password, attrs) do
|
def apply_user_email(user, password, attrs) do
|
||||||
user
|
user
|
||||||
|> User.email_changeset(attrs)
|
|> User.email_changeset(attrs)
|
||||||
@ -187,7 +192,7 @@ defmodule Cannery.Accounts do
|
|||||||
If the token matches, the user email is updated and the token is deleted.
|
If the token matches, the user email is updated and the token is deleted.
|
||||||
The confirmed_at date is also updated to the current time.
|
The confirmed_at date is also updated to the current time.
|
||||||
"""
|
"""
|
||||||
@spec update_user_email(User.t(), String.t()) :: :ok | :error
|
@spec update_user_email(User.t(), token :: String.t()) :: :ok | :error
|
||||||
def update_user_email(user, token) do
|
def update_user_email(user, token) do
|
||||||
context = "change:#{user.email}"
|
context = "change:#{user.email}"
|
||||||
|
|
||||||
@ -200,7 +205,7 @@ defmodule Cannery.Accounts do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@spec user_email_multi(User.t(), String.t(), String.t()) :: Multi.t()
|
@spec user_email_multi(User.t(), email :: String.t(), context :: String.t()) :: Multi.t()
|
||||||
defp user_email_multi(user, email, context) do
|
defp user_email_multi(user, email, context) do
|
||||||
changeset = user |> User.email_changeset(%{email: email}) |> User.confirm_changeset()
|
changeset = user |> User.email_changeset(%{email: email}) |> User.confirm_changeset()
|
||||||
|
|
||||||
@ -218,7 +223,8 @@ defmodule Cannery.Accounts do
|
|||||||
{:ok, %{to: ..., body: ...}}
|
{:ok, %{to: ..., body: ...}}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@spec deliver_update_email_instructions(User.t(), String.t(), function) :: Job.t()
|
@spec deliver_update_email_instructions(User.t(), current_email :: String.t(), function) ::
|
||||||
|
Job.t()
|
||||||
def deliver_update_email_instructions(user, current_email, update_email_url_fun)
|
def deliver_update_email_instructions(user, current_email, update_email_url_fun)
|
||||||
when is_function(update_email_url_fun, 1) do
|
when is_function(update_email_url_fun, 1) do
|
||||||
{encoded_token, user_token} = UserToken.build_email_token(user, "change:#{current_email}")
|
{encoded_token, user_token} = UserToken.build_email_token(user, "change:#{current_email}")
|
||||||
@ -235,7 +241,7 @@ defmodule Cannery.Accounts do
|
|||||||
%Changeset{data: %User{}}
|
%Changeset{data: %User{}}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@spec change_user_password(User.t(), map()) :: Changeset.t(User.t())
|
@spec change_user_password(User.t(), attrs :: map()) :: User.changeset()
|
||||||
def change_user_password(user, attrs \\ %{}),
|
def change_user_password(user, attrs \\ %{}),
|
||||||
do: User.password_changeset(user, attrs, hash_password: false)
|
do: User.password_changeset(user, attrs, hash_password: false)
|
||||||
|
|
||||||
@ -251,8 +257,8 @@ defmodule Cannery.Accounts do
|
|||||||
{:error, %Changeset{}}
|
{:error, %Changeset{}}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@spec update_user_password(User.t(), String.t(), map()) ::
|
@spec update_user_password(User.t(), String.t(), attrs :: map()) ::
|
||||||
{:ok, User.t()} | {:error, Changeset.t(User.t())}
|
{:ok, User.t()} | {:error, User.changeset()}
|
||||||
def update_user_password(user, password, attrs) do
|
def update_user_password(user, password, attrs) do
|
||||||
changeset =
|
changeset =
|
||||||
user
|
user
|
||||||
@ -278,7 +284,7 @@ defmodule Cannery.Accounts do
|
|||||||
%Changeset{data: %User{}}
|
%Changeset{data: %User{}}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@spec change_user_locale(User.t()) :: Changeset.t(User.t())
|
@spec change_user_locale(User.t()) :: User.changeset()
|
||||||
def change_user_locale(%{locale: locale} = user), do: User.locale_changeset(user, locale)
|
def change_user_locale(%{locale: locale} = user), do: User.locale_changeset(user, locale)
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
@ -294,7 +300,7 @@ defmodule Cannery.Accounts do
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
@spec update_user_locale(User.t(), locale :: String.t()) ::
|
@spec update_user_locale(User.t(), locale :: String.t()) ::
|
||||||
{:ok, User.t()} | {:error, Changeset.t(User.t())}
|
{:ok, User.t()} | {:error, User.changeset()}
|
||||||
def update_user_locale(user, locale),
|
def update_user_locale(user, locale),
|
||||||
do: user |> User.locale_changeset(locale) |> Repo.update()
|
do: user |> User.locale_changeset(locale) |> Repo.update()
|
||||||
|
|
||||||
@ -310,7 +316,7 @@ defmodule Cannery.Accounts do
|
|||||||
%User{}
|
%User{}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@spec delete_user!(User.t(), User.t()) :: User.t()
|
@spec delete_user!(user_to_delete :: User.t(), User.t()) :: User.t()
|
||||||
def delete_user!(user, %User{role: :admin}), do: user |> Repo.delete!()
|
def delete_user!(user, %User{role: :admin}), do: user |> Repo.delete!()
|
||||||
def delete_user!(%User{id: user_id} = user, %User{id: user_id}), do: user |> Repo.delete!()
|
def delete_user!(%User{id: user_id} = user, %User{id: user_id}), do: user |> Repo.delete!()
|
||||||
|
|
||||||
@ -329,7 +335,7 @@ defmodule Cannery.Accounts do
|
|||||||
@doc """
|
@doc """
|
||||||
Gets the user with the given signed token.
|
Gets the user with the given signed token.
|
||||||
"""
|
"""
|
||||||
@spec get_user_by_session_token(String.t()) :: User.t()
|
@spec get_user_by_session_token(token :: String.t()) :: User.t()
|
||||||
def get_user_by_session_token(token) do
|
def get_user_by_session_token(token) do
|
||||||
{:ok, query} = UserToken.verify_session_token_query(token)
|
{:ok, query} = UserToken.verify_session_token_query(token)
|
||||||
Repo.one(query)
|
Repo.one(query)
|
||||||
@ -338,7 +344,7 @@ defmodule Cannery.Accounts do
|
|||||||
@doc """
|
@doc """
|
||||||
Deletes the signed token with the given context.
|
Deletes the signed token with the given context.
|
||||||
"""
|
"""
|
||||||
@spec delete_session_token(String.t()) :: :ok
|
@spec delete_session_token(token :: String.t()) :: :ok
|
||||||
def delete_session_token(token) do
|
def delete_session_token(token) do
|
||||||
Repo.delete_all(UserToken.token_and_context_query(token, "session"))
|
Repo.delete_all(UserToken.token_and_context_query(token, "session"))
|
||||||
:ok
|
:ok
|
||||||
@ -394,7 +400,7 @@ defmodule Cannery.Accounts do
|
|||||||
If the token matches, the user account is marked as confirmed
|
If the token matches, the user account is marked as confirmed
|
||||||
and the token is deleted.
|
and the token is deleted.
|
||||||
"""
|
"""
|
||||||
@spec confirm_user(String.t()) :: {:ok, User.t()} | atom()
|
@spec confirm_user(token :: String.t()) :: {:ok, User.t()} | :error
|
||||||
def confirm_user(token) do
|
def confirm_user(token) do
|
||||||
with {:ok, query} <- UserToken.verify_email_token_query(token, "confirm"),
|
with {:ok, query} <- UserToken.verify_email_token_query(token, "confirm"),
|
||||||
%User{} = user <- Repo.one(query),
|
%User{} = user <- Repo.one(query),
|
||||||
@ -443,7 +449,7 @@ defmodule Cannery.Accounts do
|
|||||||
nil
|
nil
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@spec get_user_by_reset_password_token(String.t()) :: User.t() | nil
|
@spec get_user_by_reset_password_token(token :: String.t()) :: User.t() | nil
|
||||||
def get_user_by_reset_password_token(token) do
|
def get_user_by_reset_password_token(token) do
|
||||||
with {:ok, query} <- UserToken.verify_email_token_query(token, "reset_password"),
|
with {:ok, query} <- UserToken.verify_email_token_query(token, "reset_password"),
|
||||||
%User{} = user <- Repo.one(query) do
|
%User{} = user <- Repo.one(query) do
|
||||||
@ -465,7 +471,8 @@ defmodule Cannery.Accounts do
|
|||||||
{:error, %Changeset{}}
|
{:error, %Changeset{}}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@spec reset_user_password(User.t(), map()) :: {:ok, User.t()} | {:error, Changeset.t(User.t())}
|
@spec reset_user_password(User.t(), attrs :: map()) ::
|
||||||
|
{:ok, User.t()} | {:error, User.changeset()}
|
||||||
def reset_user_password(user, attrs) do
|
def reset_user_password(user, attrs) do
|
||||||
Multi.new()
|
Multi.new()
|
||||||
|> Multi.update(:user, User.password_changeset(user, attrs))
|
|> Multi.update(:user, User.password_changeset(user, attrs))
|
||||||
|
@ -39,7 +39,7 @@ defmodule Cannery.Accounts.User do
|
|||||||
password: String.t(),
|
password: String.t(),
|
||||||
hashed_password: String.t(),
|
hashed_password: String.t(),
|
||||||
confirmed_at: NaiveDateTime.t(),
|
confirmed_at: NaiveDateTime.t(),
|
||||||
role: atom(),
|
role: role(),
|
||||||
locale: String.t() | nil,
|
locale: String.t() | nil,
|
||||||
invites: [Invite.t()],
|
invites: [Invite.t()],
|
||||||
inserted_at: NaiveDateTime.t(),
|
inserted_at: NaiveDateTime.t(),
|
||||||
@ -47,6 +47,8 @@ defmodule Cannery.Accounts.User do
|
|||||||
}
|
}
|
||||||
@type new_user :: %User{}
|
@type new_user :: %User{}
|
||||||
@type id :: UUID.t()
|
@type id :: UUID.t()
|
||||||
|
@type changeset :: Changeset.t(t() | new_user())
|
||||||
|
@type role :: :admin | :user | String.t()
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
A user changeset for registration.
|
A user changeset for registration.
|
||||||
@ -65,26 +67,24 @@ defmodule Cannery.Accounts.User do
|
|||||||
validations on a LiveView form), this option can be set to `false`.
|
validations on a LiveView form), this option can be set to `false`.
|
||||||
Defaults to `true`.
|
Defaults to `true`.
|
||||||
"""
|
"""
|
||||||
@spec registration_changeset(t() | new_user(), attrs :: map()) :: Changeset.t(t() | new_user())
|
@spec registration_changeset(attrs :: map()) :: changeset()
|
||||||
@spec registration_changeset(t() | new_user(), attrs :: map(), opts :: keyword()) ::
|
@spec registration_changeset(attrs :: map(), opts :: keyword()) :: changeset()
|
||||||
Changeset.t(t() | new_user())
|
def registration_changeset(attrs, opts \\ []) do
|
||||||
def registration_changeset(user, attrs, opts \\ []) do
|
%User{}
|
||||||
user
|
|> cast(attrs, [:email, :password, :locale])
|
||||||
|> cast(attrs, [:email, :password, :role, :locale])
|
|
||||||
|> validate_email()
|
|> validate_email()
|
||||||
|> validate_password(opts)
|
|> validate_password(opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
A user changeset for role.
|
A user changeset for role.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@spec role_changeset(t(), role :: atom()) :: Changeset.t(t())
|
@spec role_changeset(t() | new_user() | changeset(), role()) :: changeset()
|
||||||
def role_changeset(user, role) do
|
def role_changeset(user, role) do
|
||||||
user |> cast(%{"role" => role}, [:role])
|
user |> cast(%{"role" => role}, [:role])
|
||||||
end
|
end
|
||||||
|
|
||||||
@spec validate_email(Changeset.t(t() | new_user())) :: Changeset.t(t() | new_user())
|
@spec validate_email(changeset()) :: changeset()
|
||||||
defp validate_email(changeset) do
|
defp validate_email(changeset) do
|
||||||
changeset
|
changeset
|
||||||
|> validate_required([:email])
|
|> validate_required([:email])
|
||||||
@ -96,8 +96,8 @@ defmodule Cannery.Accounts.User do
|
|||||||
|> unique_constraint(:email)
|
|> unique_constraint(:email)
|
||||||
end
|
end
|
||||||
|
|
||||||
@spec validate_password(Changeset.t(t() | new_user()), opts :: keyword()) ::
|
@spec validate_password(changeset(), opts :: keyword()) ::
|
||||||
Changeset.t(t() | new_user())
|
changeset()
|
||||||
defp validate_password(changeset, opts) do
|
defp validate_password(changeset, opts) do
|
||||||
changeset
|
changeset
|
||||||
|> validate_required([:password])
|
|> validate_required([:password])
|
||||||
@ -108,8 +108,7 @@ defmodule Cannery.Accounts.User do
|
|||||||
|> maybe_hash_password(opts)
|
|> maybe_hash_password(opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
@spec maybe_hash_password(Changeset.t(t() | new_user()), opts :: keyword()) ::
|
@spec maybe_hash_password(changeset(), opts :: keyword()) :: changeset()
|
||||||
Changeset.t(t() | new_user())
|
|
||||||
defp maybe_hash_password(changeset, opts) do
|
defp maybe_hash_password(changeset, opts) do
|
||||||
hash_password? = Keyword.get(opts, :hash_password, true)
|
hash_password? = Keyword.get(opts, :hash_password, true)
|
||||||
password = get_change(changeset, :password)
|
password = get_change(changeset, :password)
|
||||||
@ -128,7 +127,7 @@ defmodule Cannery.Accounts.User do
|
|||||||
|
|
||||||
It requires the email to change otherwise an error is added.
|
It requires the email to change otherwise an error is added.
|
||||||
"""
|
"""
|
||||||
@spec email_changeset(t(), attrs :: map()) :: Changeset.t(t())
|
@spec email_changeset(t(), attrs :: map()) :: changeset()
|
||||||
def email_changeset(user, attrs) do
|
def email_changeset(user, attrs) do
|
||||||
user
|
user
|
||||||
|> cast(attrs, [:email])
|
|> cast(attrs, [:email])
|
||||||
@ -151,8 +150,8 @@ defmodule Cannery.Accounts.User do
|
|||||||
validations on a LiveView form), this option can be set to `false`.
|
validations on a LiveView form), this option can be set to `false`.
|
||||||
Defaults to `true`.
|
Defaults to `true`.
|
||||||
"""
|
"""
|
||||||
@spec password_changeset(t(), attrs :: map()) :: Changeset.t(t())
|
@spec password_changeset(t(), attrs :: map()) :: changeset()
|
||||||
@spec password_changeset(t(), attrs :: map(), opts :: keyword()) :: Changeset.t(t())
|
@spec password_changeset(t(), attrs :: map(), opts :: keyword()) :: changeset()
|
||||||
def password_changeset(user, attrs, opts \\ []) do
|
def password_changeset(user, attrs, opts \\ []) do
|
||||||
user
|
user
|
||||||
|> cast(attrs, [:password])
|
|> cast(attrs, [:password])
|
||||||
@ -163,7 +162,7 @@ defmodule Cannery.Accounts.User do
|
|||||||
@doc """
|
@doc """
|
||||||
Confirms the account by setting `confirmed_at`.
|
Confirms the account by setting `confirmed_at`.
|
||||||
"""
|
"""
|
||||||
@spec confirm_changeset(t() | Changeset.t(t())) :: Changeset.t(t())
|
@spec confirm_changeset(t() | changeset()) :: changeset()
|
||||||
def confirm_changeset(user_or_changeset) do
|
def confirm_changeset(user_or_changeset) do
|
||||||
now = NaiveDateTime.utc_now() |> NaiveDateTime.truncate(:second)
|
now = NaiveDateTime.utc_now() |> NaiveDateTime.truncate(:second)
|
||||||
user_or_changeset |> change(confirmed_at: now)
|
user_or_changeset |> change(confirmed_at: now)
|
||||||
@ -189,7 +188,7 @@ defmodule Cannery.Accounts.User do
|
|||||||
@doc """
|
@doc """
|
||||||
Validates the current password otherwise adds an error to the changeset.
|
Validates the current password otherwise adds an error to the changeset.
|
||||||
"""
|
"""
|
||||||
@spec validate_current_password(Changeset.t(t()), String.t()) :: Changeset.t(t())
|
@spec validate_current_password(changeset(), String.t()) :: changeset()
|
||||||
def validate_current_password(changeset, password) do
|
def validate_current_password(changeset, password) do
|
||||||
if valid_password?(changeset.data, password),
|
if valid_password?(changeset.data, password),
|
||||||
do: changeset,
|
do: changeset,
|
||||||
@ -199,7 +198,7 @@ defmodule Cannery.Accounts.User do
|
|||||||
@doc """
|
@doc """
|
||||||
A changeset for changing the user's locale
|
A changeset for changing the user's locale
|
||||||
"""
|
"""
|
||||||
@spec locale_changeset(t() | Changeset.t(t()), locale :: String.t() | nil) :: Changeset.t(t())
|
@spec locale_changeset(t() | changeset(), locale :: String.t() | nil) :: changeset()
|
||||||
def locale_changeset(user_or_changeset, locale) do
|
def locale_changeset(user_or_changeset, locale) do
|
||||||
user_or_changeset
|
user_or_changeset
|
||||||
|> cast(%{"locale" => locale}, [:locale])
|
|> cast(%{"locale" => locale}, [:locale])
|
||||||
|
@ -5,7 +5,7 @@ defmodule Cannery.ActivityLog do
|
|||||||
|
|
||||||
import Ecto.Query, warn: false
|
import Ecto.Query, warn: false
|
||||||
alias Cannery.{Accounts.User, ActivityLog.ShotGroup, Ammo.AmmoGroup, Repo}
|
alias Cannery.{Accounts.User, ActivityLog.ShotGroup, Ammo.AmmoGroup, Repo}
|
||||||
alias Ecto.{Changeset, Multi}
|
alias Ecto.Multi
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Returns the list of shot_groups.
|
Returns the list of shot_groups.
|
||||||
@ -58,7 +58,7 @@ defmodule Cannery.ActivityLog do
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
@spec create_shot_group(attrs :: map(), User.t(), AmmoGroup.t()) ::
|
@spec create_shot_group(attrs :: map(), User.t(), AmmoGroup.t()) ::
|
||||||
{:ok, ShotGroup.t()} | {:error, Changeset.t(ShotGroup.t()) | nil}
|
{:ok, ShotGroup.t()} | {:error, ShotGroup.changeset() | nil}
|
||||||
def create_shot_group(attrs, user, ammo_group) do
|
def create_shot_group(attrs, user, ammo_group) do
|
||||||
Multi.new()
|
Multi.new()
|
||||||
|> Multi.insert(
|
|> Multi.insert(
|
||||||
@ -99,7 +99,7 @@ defmodule Cannery.ActivityLog do
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
@spec update_shot_group(ShotGroup.t(), attrs :: map(), User.t()) ::
|
@spec update_shot_group(ShotGroup.t(), attrs :: map(), User.t()) ::
|
||||||
{:ok, ShotGroup.t()} | {:error, Changeset.t(ShotGroup.t()) | nil}
|
{:ok, ShotGroup.t()} | {:error, ShotGroup.changeset() | nil}
|
||||||
def update_shot_group(
|
def update_shot_group(
|
||||||
%ShotGroup{count: count, user_id: user_id} = shot_group,
|
%ShotGroup{count: count, user_id: user_id} = shot_group,
|
||||||
attrs,
|
attrs,
|
||||||
@ -149,7 +149,7 @@ defmodule Cannery.ActivityLog do
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
@spec delete_shot_group(ShotGroup.t(), User.t()) ::
|
@spec delete_shot_group(ShotGroup.t(), User.t()) ::
|
||||||
{:ok, ShotGroup.t()} | {:error, Changeset.t(ShotGroup.t())}
|
{:ok, ShotGroup.t()} | {:error, ShotGroup.changeset()}
|
||||||
def delete_shot_group(
|
def delete_shot_group(
|
||||||
%ShotGroup{user_id: user_id} = shot_group,
|
%ShotGroup{user_id: user_id} = shot_group,
|
||||||
%User{id: user_id}
|
%User{id: user_id}
|
||||||
|
@ -44,6 +44,7 @@ defmodule Cannery.ActivityLog.ShotGroup do
|
|||||||
}
|
}
|
||||||
@type new_shot_group :: %ShotGroup{}
|
@type new_shot_group :: %ShotGroup{}
|
||||||
@type id :: UUID.t()
|
@type id :: UUID.t()
|
||||||
|
@type changeset :: Changeset.t(t() | new_shot_group())
|
||||||
|
|
||||||
@doc false
|
@doc false
|
||||||
@spec create_changeset(
|
@spec create_changeset(
|
||||||
@ -51,8 +52,7 @@ defmodule Cannery.ActivityLog.ShotGroup do
|
|||||||
User.t() | any(),
|
User.t() | any(),
|
||||||
AmmoGroup.t() | any(),
|
AmmoGroup.t() | any(),
|
||||||
attrs :: map()
|
attrs :: map()
|
||||||
) ::
|
) :: changeset()
|
||||||
Changeset.t(new_shot_group())
|
|
||||||
def create_changeset(
|
def create_changeset(
|
||||||
shot_group,
|
shot_group,
|
||||||
%User{id: user_id},
|
%User{id: user_id},
|
||||||
@ -87,8 +87,7 @@ defmodule Cannery.ActivityLog.ShotGroup do
|
|||||||
end
|
end
|
||||||
|
|
||||||
@doc false
|
@doc false
|
||||||
@spec update_changeset(t() | new_shot_group(), User.t(), attrs :: map()) ::
|
@spec update_changeset(t() | new_shot_group(), User.t(), attrs :: map()) :: changeset()
|
||||||
Changeset.t(t() | new_shot_group())
|
|
||||||
def update_changeset(
|
def update_changeset(
|
||||||
%ShotGroup{user_id: user_id} = shot_group,
|
%ShotGroup{user_id: user_id} = shot_group,
|
||||||
%User{id: user_id} = user,
|
%User{id: user_id} = user,
|
||||||
|
@ -182,7 +182,7 @@ defmodule Cannery.Ammo do
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
@spec create_ammo_type(attrs :: map(), User.t()) ::
|
@spec create_ammo_type(attrs :: map(), User.t()) ::
|
||||||
{:ok, AmmoType.t()} | {:error, Changeset.t(AmmoType.new_ammo_type())}
|
{:ok, AmmoType.t()} | {:error, AmmoType.changeset()}
|
||||||
def create_ammo_type(attrs \\ %{}, %User{} = user),
|
def create_ammo_type(attrs \\ %{}, %User{} = user),
|
||||||
do: %AmmoType{} |> AmmoType.create_changeset(user, attrs) |> Repo.insert()
|
do: %AmmoType{} |> AmmoType.create_changeset(user, attrs) |> Repo.insert()
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ defmodule Cannery.Ammo do
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
@spec update_ammo_type(AmmoType.t(), attrs :: map(), User.t()) ::
|
@spec update_ammo_type(AmmoType.t(), attrs :: map(), User.t()) ::
|
||||||
{:ok, AmmoType.t()} | {:error, Changeset.t(AmmoType.t())}
|
{:ok, AmmoType.t()} | {:error, AmmoType.changeset()}
|
||||||
def update_ammo_type(%AmmoType{user_id: user_id} = ammo_type, attrs, %User{id: user_id}),
|
def update_ammo_type(%AmmoType{user_id: user_id} = ammo_type, attrs, %User{id: user_id}),
|
||||||
do: ammo_type |> AmmoType.update_changeset(attrs) |> Repo.update()
|
do: ammo_type |> AmmoType.update_changeset(attrs) |> Repo.update()
|
||||||
|
|
||||||
@ -216,7 +216,7 @@ defmodule Cannery.Ammo do
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
@spec delete_ammo_type(AmmoType.t(), User.t()) ::
|
@spec delete_ammo_type(AmmoType.t(), User.t()) ::
|
||||||
{:ok, AmmoType.t()} | {:error, Changeset.t(AmmoType.t())}
|
{:ok, AmmoType.t()} | {:error, AmmoType.changeset()}
|
||||||
def delete_ammo_type(%AmmoType{user_id: user_id} = ammo_type, %User{id: user_id}),
|
def delete_ammo_type(%AmmoType{user_id: user_id} = ammo_type, %User{id: user_id}),
|
||||||
do: ammo_type |> Repo.delete()
|
do: ammo_type |> Repo.delete()
|
||||||
|
|
||||||
@ -549,7 +549,7 @@ defmodule Cannery.Ammo do
|
|||||||
"""
|
"""
|
||||||
@spec create_ammo_groups(attrs :: map(), multiplier :: non_neg_integer(), User.t()) ::
|
@spec create_ammo_groups(attrs :: map(), multiplier :: non_neg_integer(), User.t()) ::
|
||||||
{:ok, {count :: non_neg_integer(), [AmmoGroup.t()] | nil}}
|
{:ok, {count :: non_neg_integer(), [AmmoGroup.t()] | nil}}
|
||||||
| {:error, Changeset.t(AmmoGroup.new_ammo_group())}
|
| {:error, AmmoGroup.changeset()}
|
||||||
def create_ammo_groups(
|
def create_ammo_groups(
|
||||||
%{"ammo_type_id" => ammo_type_id, "container_id" => container_id} = attrs,
|
%{"ammo_type_id" => ammo_type_id, "container_id" => container_id} = attrs,
|
||||||
multiplier,
|
multiplier,
|
||||||
@ -628,7 +628,7 @@ defmodule Cannery.Ammo do
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
@spec update_ammo_group(AmmoGroup.t(), attrs :: map(), User.t()) ::
|
@spec update_ammo_group(AmmoGroup.t(), attrs :: map(), User.t()) ::
|
||||||
{:ok, AmmoGroup.t()} | {:error, Changeset.t(AmmoGroup.t())}
|
{:ok, AmmoGroup.t()} | {:error, AmmoGroup.changeset()}
|
||||||
def update_ammo_group(
|
def update_ammo_group(
|
||||||
%AmmoGroup{user_id: user_id} = ammo_group,
|
%AmmoGroup{user_id: user_id} = ammo_group,
|
||||||
attrs,
|
attrs,
|
||||||
@ -649,7 +649,7 @@ defmodule Cannery.Ammo do
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
@spec delete_ammo_group(AmmoGroup.t(), User.t()) ::
|
@spec delete_ammo_group(AmmoGroup.t(), User.t()) ::
|
||||||
{:ok, AmmoGroup.t()} | {:error, Changeset.t(AmmoGroup.t())}
|
{:ok, AmmoGroup.t()} | {:error, AmmoGroup.changeset()}
|
||||||
def delete_ammo_group(%AmmoGroup{user_id: user_id} = ammo_group, %User{id: user_id}),
|
def delete_ammo_group(%AmmoGroup{user_id: user_id} = ammo_group, %User{id: user_id}),
|
||||||
do: ammo_group |> Repo.delete()
|
do: ammo_group |> Repo.delete()
|
||||||
|
|
||||||
|
@ -59,6 +59,7 @@ defmodule Cannery.Ammo.AmmoGroup do
|
|||||||
}
|
}
|
||||||
@type new_ammo_group :: %AmmoGroup{}
|
@type new_ammo_group :: %AmmoGroup{}
|
||||||
@type id :: UUID.t()
|
@type id :: UUID.t()
|
||||||
|
@type changeset :: Changeset.t(t() | new_ammo_group())
|
||||||
|
|
||||||
@doc false
|
@doc false
|
||||||
@spec create_changeset(
|
@spec create_changeset(
|
||||||
@ -67,7 +68,7 @@ defmodule Cannery.Ammo.AmmoGroup do
|
|||||||
Container.t() | nil,
|
Container.t() | nil,
|
||||||
User.t(),
|
User.t(),
|
||||||
attrs :: map()
|
attrs :: map()
|
||||||
) :: Changeset.t(new_ammo_group())
|
) :: changeset()
|
||||||
def create_changeset(
|
def create_changeset(
|
||||||
ammo_group,
|
ammo_group,
|
||||||
%AmmoType{id: ammo_type_id},
|
%AmmoType{id: ammo_type_id},
|
||||||
@ -97,8 +98,7 @@ defmodule Cannery.Ammo.AmmoGroup do
|
|||||||
end
|
end
|
||||||
|
|
||||||
@doc false
|
@doc false
|
||||||
@spec update_changeset(t() | new_ammo_group(), attrs :: map(), User.t()) ::
|
@spec update_changeset(t() | new_ammo_group(), attrs :: map(), User.t()) :: changeset()
|
||||||
Changeset.t(t() | new_ammo_group())
|
|
||||||
def update_changeset(ammo_group, attrs, user) do
|
def update_changeset(ammo_group, attrs, user) do
|
||||||
ammo_group
|
ammo_group
|
||||||
|> cast(attrs, [:count, :price_paid, :notes, :staged, :purchased_on, :container_id])
|
|> cast(attrs, [:count, :price_paid, :notes, :staged, :purchased_on, :container_id])
|
||||||
@ -121,8 +121,7 @@ defmodule Cannery.Ammo.AmmoGroup do
|
|||||||
This range changeset is used when "using up" ammo groups, and allows for
|
This range changeset is used when "using up" ammo groups, and allows for
|
||||||
updating the count to 0
|
updating the count to 0
|
||||||
"""
|
"""
|
||||||
@spec range_changeset(t() | new_ammo_group(), attrs :: map()) ::
|
@spec range_changeset(t() | new_ammo_group(), attrs :: map()) :: changeset()
|
||||||
Changeset.t(t() | new_ammo_group())
|
|
||||||
def range_changeset(ammo_group, attrs) do
|
def range_changeset(ammo_group, attrs) do
|
||||||
ammo_group
|
ammo_group
|
||||||
|> cast(attrs, [:count, :staged])
|
|> cast(attrs, [:count, :staged])
|
||||||
|
@ -102,6 +102,7 @@ defmodule Cannery.Ammo.AmmoType do
|
|||||||
}
|
}
|
||||||
@type new_ammo_type :: %AmmoType{}
|
@type new_ammo_type :: %AmmoType{}
|
||||||
@type id :: UUID.t()
|
@type id :: UUID.t()
|
||||||
|
@type changeset :: Changeset.t(t() | new_ammo_type())
|
||||||
|
|
||||||
@spec changeset_fields() :: [atom()]
|
@spec changeset_fields() :: [atom()]
|
||||||
defp changeset_fields,
|
defp changeset_fields,
|
||||||
@ -130,8 +131,7 @@ defmodule Cannery.Ammo.AmmoType do
|
|||||||
]
|
]
|
||||||
|
|
||||||
@doc false
|
@doc false
|
||||||
@spec create_changeset(new_ammo_type(), User.t(), attrs :: map()) ::
|
@spec create_changeset(new_ammo_type(), User.t(), attrs :: map()) :: changeset()
|
||||||
Changeset.t(new_ammo_type())
|
|
||||||
def create_changeset(ammo_type, %User{id: user_id}, attrs) do
|
def create_changeset(ammo_type, %User{id: user_id}, attrs) do
|
||||||
ammo_type
|
ammo_type
|
||||||
|> change(user_id: user_id)
|
|> change(user_id: user_id)
|
||||||
@ -140,8 +140,7 @@ defmodule Cannery.Ammo.AmmoType do
|
|||||||
end
|
end
|
||||||
|
|
||||||
@doc false
|
@doc false
|
||||||
@spec update_changeset(t() | new_ammo_type(), attrs :: map()) ::
|
@spec update_changeset(t() | new_ammo_type(), attrs :: map()) :: changeset()
|
||||||
Changeset.t(t() | new_ammo_type())
|
|
||||||
def update_changeset(ammo_type, attrs) do
|
def update_changeset(ammo_type, attrs) do
|
||||||
ammo_type
|
ammo_type
|
||||||
|> cast(attrs, changeset_fields())
|
|> cast(attrs, changeset_fields())
|
||||||
|
@ -89,7 +89,7 @@ defmodule Cannery.Containers do
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
@spec create_container(attrs :: map(), User.t()) ::
|
@spec create_container(attrs :: map(), User.t()) ::
|
||||||
{:ok, Container.t()} | {:error, Changeset.t(Container.new_container())}
|
{:ok, Container.t()} | {:error, Container.changeset()}
|
||||||
def create_container(attrs, %User{} = user) do
|
def create_container(attrs, %User{} = user) do
|
||||||
%Container{} |> Container.create_changeset(user, attrs) |> Repo.insert()
|
%Container{} |> Container.create_changeset(user, attrs) |> Repo.insert()
|
||||||
end
|
end
|
||||||
@ -107,7 +107,7 @@ defmodule Cannery.Containers do
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
@spec update_container(Container.t(), User.t(), attrs :: map()) ::
|
@spec update_container(Container.t(), User.t(), attrs :: map()) ::
|
||||||
{:ok, Container.t()} | {:error, Changeset.t(Container.t())}
|
{:ok, Container.t()} | {:error, Container.changeset()}
|
||||||
def update_container(%Container{user_id: user_id} = container, %User{id: user_id}, attrs) do
|
def update_container(%Container{user_id: user_id} = container, %User{id: user_id}, attrs) do
|
||||||
container |> Container.update_changeset(attrs) |> Repo.update()
|
container |> Container.update_changeset(attrs) |> Repo.update()
|
||||||
end
|
end
|
||||||
@ -125,7 +125,7 @@ defmodule Cannery.Containers do
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
@spec delete_container(Container.t(), User.t()) ::
|
@spec delete_container(Container.t(), User.t()) ::
|
||||||
{:ok, Container.t()} | {:error, Changeset.t(Container.t())}
|
{:ok, Container.t()} | {:error, Container.changeset()}
|
||||||
def delete_container(%Container{user_id: user_id} = container, %User{id: user_id}) do
|
def delete_container(%Container{user_id: user_id} = container, %User{id: user_id}) do
|
||||||
Repo.one(
|
Repo.one(
|
||||||
from ag in AmmoGroup,
|
from ag in AmmoGroup,
|
||||||
|
@ -49,10 +49,10 @@ defmodule Cannery.Containers.Container do
|
|||||||
}
|
}
|
||||||
@type new_container :: %Container{}
|
@type new_container :: %Container{}
|
||||||
@type id :: UUID.t()
|
@type id :: UUID.t()
|
||||||
|
@type changeset :: Changeset.t(t() | new_container())
|
||||||
|
|
||||||
@doc false
|
@doc false
|
||||||
@spec create_changeset(new_container(), User.t(), attrs :: map()) ::
|
@spec create_changeset(new_container(), User.t(), attrs :: map()) :: changeset()
|
||||||
Changeset.t(new_container())
|
|
||||||
def create_changeset(container, %User{id: user_id}, attrs) do
|
def create_changeset(container, %User{id: user_id}, attrs) do
|
||||||
container
|
container
|
||||||
|> change(user_id: user_id)
|
|> change(user_id: user_id)
|
||||||
@ -61,8 +61,7 @@ defmodule Cannery.Containers.Container do
|
|||||||
end
|
end
|
||||||
|
|
||||||
@doc false
|
@doc false
|
||||||
@spec update_changeset(t() | new_container(), attrs :: map()) ::
|
@spec update_changeset(t() | new_container(), attrs :: map()) :: changeset()
|
||||||
Changeset.t(t() | new_container())
|
|
||||||
def update_changeset(container, attrs) do
|
def update_changeset(container, attrs) do
|
||||||
container
|
container
|
||||||
|> cast(attrs, [:name, :desc, :type, :location])
|
|> cast(attrs, [:name, :desc, :type, :location])
|
||||||
|
@ -29,10 +29,10 @@ defmodule Cannery.Containers.ContainerTag do
|
|||||||
}
|
}
|
||||||
@type new_container_tag :: %ContainerTag{}
|
@type new_container_tag :: %ContainerTag{}
|
||||||
@type id :: UUID.t()
|
@type id :: UUID.t()
|
||||||
|
@type changeset :: Changeset.t(t() | new_container_tag())
|
||||||
|
|
||||||
@doc false
|
@doc false
|
||||||
@spec create_changeset(new_container_tag(), Tag.t(), Container.t()) ::
|
@spec create_changeset(new_container_tag(), Tag.t(), Container.t()) :: changeset()
|
||||||
Changeset.t(new_container_tag())
|
|
||||||
def create_changeset(
|
def create_changeset(
|
||||||
container_tag,
|
container_tag,
|
||||||
%Tag{id: tag_id, user_id: user_id},
|
%Tag{id: tag_id, user_id: user_id},
|
||||||
|
@ -5,7 +5,6 @@ defmodule Cannery.Invites do
|
|||||||
|
|
||||||
import Ecto.Query, warn: false
|
import Ecto.Query, warn: false
|
||||||
alias Cannery.{Accounts.User, Invites.Invite, Repo}
|
alias Cannery.{Accounts.User, Invites.Invite, Repo}
|
||||||
alias Ecto.Changeset
|
|
||||||
|
|
||||||
@invite_token_length 20
|
@invite_token_length 20
|
||||||
|
|
||||||
@ -99,14 +98,14 @@ defmodule Cannery.Invites do
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
@spec create_invite(User.t(), attrs :: map()) ::
|
@spec create_invite(User.t(), attrs :: map()) ::
|
||||||
{:ok, Invite.t()} | {:error, Changeset.t(Invite.new_invite())}
|
{:ok, Invite.t()} | {:error, Invite.changeset()}
|
||||||
def create_invite(%User{role: :admin} = user, attrs) do
|
def create_invite(%User{role: :admin} = user, attrs) do
|
||||||
token =
|
token =
|
||||||
:crypto.strong_rand_bytes(@invite_token_length)
|
:crypto.strong_rand_bytes(@invite_token_length)
|
||||||
|> Base.url_encode64()
|
|> Base.url_encode64()
|
||||||
|> binary_part(0, @invite_token_length)
|
|> binary_part(0, @invite_token_length)
|
||||||
|
|
||||||
%Invite{} |> Invite.create_changeset(user, token, attrs) |> Repo.insert()
|
Invite.create_changeset(user, token, attrs) |> Repo.insert()
|
||||||
end
|
end
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
@ -122,7 +121,7 @@ defmodule Cannery.Invites do
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
@spec update_invite(Invite.t(), attrs :: map(), User.t()) ::
|
@spec update_invite(Invite.t(), attrs :: map(), User.t()) ::
|
||||||
{:ok, Invite.t()} | {:error, Changeset.t(Invite.t())}
|
{:ok, Invite.t()} | {:error, Invite.changeset()}
|
||||||
def update_invite(invite, attrs, %User{role: :admin}),
|
def update_invite(invite, attrs, %User{role: :admin}),
|
||||||
do: invite |> Invite.update_changeset(attrs) |> Repo.update()
|
do: invite |> Invite.update_changeset(attrs) |> Repo.update()
|
||||||
|
|
||||||
@ -139,7 +138,7 @@ defmodule Cannery.Invites do
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
@spec delete_invite(Invite.t(), User.t()) ::
|
@spec delete_invite(Invite.t(), User.t()) ::
|
||||||
{:ok, Invite.t()} | {:error, Changeset.t(Invite.t())}
|
{:ok, Invite.t()} | {:error, Invite.changeset()}
|
||||||
def delete_invite(invite, %User{role: :admin}), do: invite |> Repo.delete()
|
def delete_invite(invite, %User{role: :admin}), do: invite |> Repo.delete()
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
|
@ -36,12 +36,12 @@ defmodule Cannery.Invites.Invite do
|
|||||||
}
|
}
|
||||||
@type new_invite :: %Invite{}
|
@type new_invite :: %Invite{}
|
||||||
@type id :: UUID.t()
|
@type id :: UUID.t()
|
||||||
|
@type changeset :: Changeset.t(t() | new_invite())
|
||||||
|
|
||||||
@doc false
|
@doc false
|
||||||
@spec create_changeset(new_invite(), User.t(), token :: binary(), attrs :: map()) ::
|
@spec create_changeset(User.t(), token :: binary(), attrs :: map()) :: changeset()
|
||||||
Changeset.t(new_invite())
|
def create_changeset(%User{id: user_id}, token, attrs) do
|
||||||
def create_changeset(invite, %User{id: user_id}, token, attrs) do
|
%Invite{}
|
||||||
invite
|
|
||||||
|> change(token: token, user_id: user_id)
|
|> change(token: token, user_id: user_id)
|
||||||
|> cast(attrs, [:name, :uses_left, :disabled_at])
|
|> cast(attrs, [:name, :uses_left, :disabled_at])
|
||||||
|> validate_required([:name, :token, :user_id])
|
|> validate_required([:name, :token, :user_id])
|
||||||
@ -49,7 +49,7 @@ defmodule Cannery.Invites.Invite do
|
|||||||
end
|
end
|
||||||
|
|
||||||
@doc false
|
@doc false
|
||||||
@spec update_changeset(t() | new_invite(), attrs :: map()) :: Changeset.t(t() | new_invite())
|
@spec update_changeset(t() | new_invite(), attrs :: map()) :: changeset()
|
||||||
def update_changeset(invite, attrs) do
|
def update_changeset(invite, attrs) do
|
||||||
invite
|
invite
|
||||||
|> cast(attrs, [:name, :uses_left, :disabled_at])
|
|> cast(attrs, [:name, :uses_left, :disabled_at])
|
||||||
|
@ -6,7 +6,6 @@ defmodule Cannery.Tags do
|
|||||||
import Ecto.Query, warn: false
|
import Ecto.Query, warn: false
|
||||||
import CanneryWeb.Gettext
|
import CanneryWeb.Gettext
|
||||||
alias Cannery.{Accounts.User, Repo, Tags.Tag}
|
alias Cannery.{Accounts.User, Repo, Tags.Tag}
|
||||||
alias Ecto.Changeset
|
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Returns the list of tags.
|
Returns the list of tags.
|
||||||
@ -73,7 +72,7 @@ defmodule Cannery.Tags do
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
@spec create_tag(attrs :: map(), User.t()) ::
|
@spec create_tag(attrs :: map(), User.t()) ::
|
||||||
{:ok, Tag.t()} | {:error, Changeset.t(Tag.new_tag())}
|
{:ok, Tag.t()} | {:error, Tag.changeset()}
|
||||||
def create_tag(attrs, %User{} = user),
|
def create_tag(attrs, %User{} = user),
|
||||||
do: %Tag{} |> Tag.create_changeset(user, attrs) |> Repo.insert()
|
do: %Tag{} |> Tag.create_changeset(user, attrs) |> Repo.insert()
|
||||||
|
|
||||||
@ -90,7 +89,7 @@ defmodule Cannery.Tags do
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
@spec update_tag(Tag.t(), attrs :: map(), User.t()) ::
|
@spec update_tag(Tag.t(), attrs :: map(), User.t()) ::
|
||||||
{:ok, Tag.t()} | {:error, Changeset.t(Tag.t())}
|
{:ok, Tag.t()} | {:error, Tag.changeset()}
|
||||||
def update_tag(%Tag{user_id: user_id} = tag, attrs, %User{id: user_id}),
|
def update_tag(%Tag{user_id: user_id} = tag, attrs, %User{id: user_id}),
|
||||||
do: tag |> Tag.update_changeset(attrs) |> Repo.update()
|
do: tag |> Tag.update_changeset(attrs) |> Repo.update()
|
||||||
|
|
||||||
@ -106,7 +105,7 @@ defmodule Cannery.Tags do
|
|||||||
{:error, %Changeset{}}
|
{:error, %Changeset{}}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@spec delete_tag(Tag.t(), User.t()) :: {:ok, Tag.t()} | {:error, Changeset.t(Tag.t())}
|
@spec delete_tag(Tag.t(), User.t()) :: {:ok, Tag.t()} | {:error, Tag.changeset()}
|
||||||
def delete_tag(%Tag{user_id: user_id} = tag, %User{id: user_id}), do: tag |> Repo.delete()
|
def delete_tag(%Tag{user_id: user_id} = tag, %User{id: user_id}), do: tag |> Repo.delete()
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
|
@ -40,9 +40,10 @@ defmodule Cannery.Tags.Tag do
|
|||||||
}
|
}
|
||||||
@type new_tag() :: %Tag{}
|
@type new_tag() :: %Tag{}
|
||||||
@type id() :: UUID.t()
|
@type id() :: UUID.t()
|
||||||
|
@type changeset() :: Changeset.t(t() | new_tag())
|
||||||
|
|
||||||
@doc false
|
@doc false
|
||||||
@spec create_changeset(new_tag(), User.t(), attrs :: map()) :: Changeset.t(new_tag())
|
@spec create_changeset(new_tag(), User.t(), attrs :: map()) :: changeset()
|
||||||
def create_changeset(tag, %User{id: user_id}, attrs) do
|
def create_changeset(tag, %User{id: user_id}, attrs) do
|
||||||
tag
|
tag
|
||||||
|> change(user_id: user_id)
|
|> change(user_id: user_id)
|
||||||
@ -51,7 +52,7 @@ defmodule Cannery.Tags.Tag do
|
|||||||
end
|
end
|
||||||
|
|
||||||
@doc false
|
@doc false
|
||||||
@spec update_changeset(t() | new_tag(), attrs :: map()) :: Changeset.t(t() | new_tag())
|
@spec update_changeset(t() | new_tag(), attrs :: map()) :: changeset()
|
||||||
def update_changeset(tag, attrs) do
|
def update_changeset(tag, attrs) do
|
||||||
tag
|
tag
|
||||||
|> cast(attrs, [:name, :bg_color, :text_color])
|
|> cast(attrs, [:name, :bg_color, :text_color])
|
||||||
|
@ -2,7 +2,6 @@ defmodule CanneryWeb.UserRegistrationController do
|
|||||||
use CanneryWeb, :controller
|
use CanneryWeb, :controller
|
||||||
import CanneryWeb.Gettext
|
import CanneryWeb.Gettext
|
||||||
alias Cannery.{Accounts, Invites}
|
alias Cannery.{Accounts, Invites}
|
||||||
alias Cannery.Accounts.User
|
|
||||||
alias CanneryWeb.{Endpoint, HomeLive}
|
alias CanneryWeb.{Endpoint, HomeLive}
|
||||||
|
|
||||||
def new(conn, %{"invite" => invite_token}) do
|
def new(conn, %{"invite" => invite_token}) do
|
||||||
@ -30,7 +29,7 @@ defmodule CanneryWeb.UserRegistrationController do
|
|||||||
# renders new user registration page
|
# renders new user registration page
|
||||||
defp render_new(conn, invite \\ nil) do
|
defp render_new(conn, invite \\ nil) do
|
||||||
render(conn, "new.html",
|
render(conn, "new.html",
|
||||||
changeset: Accounts.change_user_registration(%User{}),
|
changeset: Accounts.change_user_registration(),
|
||||||
invite: invite,
|
invite: invite,
|
||||||
page_title: gettext("Register")
|
page_title: gettext("Register")
|
||||||
)
|
)
|
||||||
|
@ -38,7 +38,7 @@ defmodule CanneryWeb.InviteLive.FormComponent do
|
|||||||
|
|
||||||
changeset =
|
changeset =
|
||||||
case action do
|
case action do
|
||||||
:new -> invite |> Invite.create_changeset(user, "example_token", invite_params)
|
:new -> Invite.create_changeset(user, "example_token", invite_params)
|
||||||
:edit -> invite |> Invite.update_changeset(invite_params)
|
:edit -> invite |> Invite.update_changeset(invite_params)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
2
mix.exs
2
mix.exs
@ -4,7 +4,7 @@ defmodule Cannery.MixProject do
|
|||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :cannery,
|
app: :cannery,
|
||||||
version: "0.7.1",
|
version: "0.7.2",
|
||||||
elixir: "1.14.1",
|
elixir: "1.14.1",
|
||||||
elixirc_paths: elixirc_paths(Mix.env()),
|
elixirc_paths: elixirc_paths(Mix.env()),
|
||||||
compilers: Mix.compilers(),
|
compilers: Mix.compilers(),
|
||||||
|
@ -711,7 +711,7 @@ msgstr "Passwort vergessen?"
|
|||||||
msgid "Log in"
|
msgid "Log in"
|
||||||
msgstr "Einloggen"
|
msgstr "Einloggen"
|
||||||
|
|
||||||
#: lib/cannery_web/controllers/user_registration_controller.ex:35
|
#: lib/cannery_web/controllers/user_registration_controller.ex:34
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Register"
|
msgid "Register"
|
||||||
msgstr "Registrieren"
|
msgstr "Registrieren"
|
||||||
|
@ -83,14 +83,14 @@ msgstr "Oops, etwas ist schiefgegangen. Bitte beachten Sie den Fehler unten."
|
|||||||
msgid "Reset password link is invalid or it has expired."
|
msgid "Reset password link is invalid or it has expired."
|
||||||
msgstr "Link zum Passwort zurücksetzen ist ungültig oder abgelaufen."
|
msgstr "Link zum Passwort zurücksetzen ist ungültig oder abgelaufen."
|
||||||
|
|
||||||
#: lib/cannery_web/controllers/user_registration_controller.ex:25
|
#: lib/cannery_web/controllers/user_registration_controller.ex:24
|
||||||
#: lib/cannery_web/controllers/user_registration_controller.ex:56
|
#: lib/cannery_web/controllers/user_registration_controller.ex:55
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Sorry, public registration is disabled"
|
msgid "Sorry, public registration is disabled"
|
||||||
msgstr "Entschuldigung, aber öffentliche Registrierung ist deaktiviert"
|
msgstr "Entschuldigung, aber öffentliche Registrierung ist deaktiviert"
|
||||||
|
|
||||||
#: lib/cannery_web/controllers/user_registration_controller.ex:15
|
#: lib/cannery_web/controllers/user_registration_controller.ex:14
|
||||||
#: lib/cannery_web/controllers/user_registration_controller.ex:46
|
#: lib/cannery_web/controllers/user_registration_controller.ex:45
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Sorry, this invite was not found or expired"
|
msgid "Sorry, this invite was not found or expired"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -121,17 +121,17 @@ msgstr "Sie sind nicht berechtigt, diese Seite aufzurufen"
|
|||||||
msgid "You are not authorized to view this page."
|
msgid "You are not authorized to view this page."
|
||||||
msgstr "Sie sind nicht berechtigt, diese Seite aufzurufen."
|
msgstr "Sie sind nicht berechtigt, diese Seite aufzurufen."
|
||||||
|
|
||||||
#: lib/cannery/accounts/user.ex:138
|
#: lib/cannery/accounts/user.ex:137
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "did not change"
|
msgid "did not change"
|
||||||
msgstr "hat sich nicht geändert"
|
msgstr "hat sich nicht geändert"
|
||||||
|
|
||||||
#: lib/cannery/accounts/user.ex:159
|
#: lib/cannery/accounts/user.ex:158
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "does not match password"
|
msgid "does not match password"
|
||||||
msgstr "Passwort stimmt nicht überein"
|
msgstr "Passwort stimmt nicht überein"
|
||||||
|
|
||||||
#: lib/cannery/accounts/user.ex:196
|
#: lib/cannery/accounts/user.ex:195
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "is not valid"
|
msgid "is not valid"
|
||||||
msgstr "ist nicht gültig"
|
msgstr "ist nicht gültig"
|
||||||
@ -141,7 +141,7 @@ msgstr "ist nicht gültig"
|
|||||||
msgid "must have the @ sign and no spaces"
|
msgid "must have the @ sign and no spaces"
|
||||||
msgstr "Muss ein @ Zeichen und keine Leerzeichen haben"
|
msgstr "Muss ein @ Zeichen und keine Leerzeichen haben"
|
||||||
|
|
||||||
#: lib/cannery/tags.ex:40
|
#: lib/cannery/tags.ex:39
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Tag not found"
|
msgid "Tag not found"
|
||||||
msgstr "Tag nicht gefunden"
|
msgstr "Tag nicht gefunden"
|
||||||
@ -151,13 +151,13 @@ msgstr "Tag nicht gefunden"
|
|||||||
msgid "Tag could not be added"
|
msgid "Tag could not be added"
|
||||||
msgstr "Tag konnte nicht hinzugefügt werden"
|
msgstr "Tag konnte nicht hinzugefügt werden"
|
||||||
|
|
||||||
#: lib/cannery/activity_log/shot_group.ex:123
|
#: lib/cannery/activity_log/shot_group.ex:122
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Count must be at least 1"
|
msgid "Count must be at least 1"
|
||||||
msgstr "Anzahl muss mindestens 1 sein"
|
msgstr "Anzahl muss mindestens 1 sein"
|
||||||
|
|
||||||
#: lib/cannery/activity_log/shot_group.ex:82
|
#: lib/cannery/activity_log/shot_group.ex:82
|
||||||
#: lib/cannery/activity_log/shot_group.ex:119
|
#: lib/cannery/activity_log/shot_group.ex:118
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Count must be less than %{count}"
|
msgid "Count must be less than %{count}"
|
||||||
msgstr "Anzahl muss weniger als %{count} betragen"
|
msgstr "Anzahl muss weniger als %{count} betragen"
|
||||||
@ -192,7 +192,7 @@ msgstr ""
|
|||||||
msgid "Invalid multiplier"
|
msgid "Invalid multiplier"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/cannery/ammo/ammo_group.ex:96
|
#: lib/cannery/ammo/ammo_group.ex:97
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Please select an ammo type and container"
|
msgid "Please select an ammo type and container"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -150,7 +150,7 @@ msgstr "Passwort erfolgreich zurückgesetzt."
|
|||||||
msgid "Password updated successfully."
|
msgid "Password updated successfully."
|
||||||
msgstr "Passwort erfolgreich geändert."
|
msgstr "Passwort erfolgreich geändert."
|
||||||
|
|
||||||
#: lib/cannery_web/controllers/user_registration_controller.ex:74
|
#: lib/cannery_web/controllers/user_registration_controller.ex:73
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Please check your email to verify your account"
|
msgid "Please check your email to verify your account"
|
||||||
msgstr "Bitte überprüfen Sie ihre Mailbox und bestätigen Sie das Nutzerkonto"
|
msgstr "Bitte überprüfen Sie ihre Mailbox und bestätigen Sie das Nutzerkonto"
|
||||||
|
@ -694,7 +694,7 @@ msgstr ""
|
|||||||
msgid "Log in"
|
msgid "Log in"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/cannery_web/controllers/user_registration_controller.ex:35
|
#: lib/cannery_web/controllers/user_registration_controller.ex:34
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Register"
|
msgid "Register"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -695,7 +695,7 @@ msgstr ""
|
|||||||
msgid "Log in"
|
msgid "Log in"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/cannery_web/controllers/user_registration_controller.ex:35
|
#: lib/cannery_web/controllers/user_registration_controller.ex:34
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Register"
|
msgid "Register"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -70,14 +70,14 @@ msgstr ""
|
|||||||
msgid "Reset password link is invalid or it has expired."
|
msgid "Reset password link is invalid or it has expired."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/cannery_web/controllers/user_registration_controller.ex:25
|
#: lib/cannery_web/controllers/user_registration_controller.ex:24
|
||||||
#: lib/cannery_web/controllers/user_registration_controller.ex:56
|
#: lib/cannery_web/controllers/user_registration_controller.ex:55
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Sorry, public registration is disabled"
|
msgid "Sorry, public registration is disabled"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/cannery_web/controllers/user_registration_controller.ex:15
|
#: lib/cannery_web/controllers/user_registration_controller.ex:14
|
||||||
#: lib/cannery_web/controllers/user_registration_controller.ex:46
|
#: lib/cannery_web/controllers/user_registration_controller.ex:45
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Sorry, this invite was not found or expired"
|
msgid "Sorry, this invite was not found or expired"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -107,18 +107,18 @@ msgstr ""
|
|||||||
msgid "You are not authorized to view this page."
|
msgid "You are not authorized to view this page."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/cannery/accounts/user.ex:138
|
#: lib/cannery/accounts/user.ex:137
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "did not change"
|
msgid "did not change"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/cannery/accounts/user.ex:159
|
#: lib/cannery/accounts/user.ex:158
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "does not match password"
|
msgid "does not match password"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
## From Ecto.Changeset.put_change/3
|
## From Ecto.Changeset.put_change/3
|
||||||
#: lib/cannery/accounts/user.ex:196
|
#: lib/cannery/accounts/user.ex:195
|
||||||
#, elixir-autogen, elixir-format, fuzzy
|
#, elixir-autogen, elixir-format, fuzzy
|
||||||
msgid "is not valid"
|
msgid "is not valid"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -128,7 +128,7 @@ msgstr ""
|
|||||||
msgid "must have the @ sign and no spaces"
|
msgid "must have the @ sign and no spaces"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/cannery/tags.ex:40
|
#: lib/cannery/tags.ex:39
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Tag not found"
|
msgid "Tag not found"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -138,13 +138,13 @@ msgstr ""
|
|||||||
msgid "Tag could not be added"
|
msgid "Tag could not be added"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/cannery/activity_log/shot_group.ex:123
|
#: lib/cannery/activity_log/shot_group.ex:122
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Count must be at least 1"
|
msgid "Count must be at least 1"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/cannery/activity_log/shot_group.ex:82
|
#: lib/cannery/activity_log/shot_group.ex:82
|
||||||
#: lib/cannery/activity_log/shot_group.ex:119
|
#: lib/cannery/activity_log/shot_group.ex:118
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Count must be less than %{count}"
|
msgid "Count must be less than %{count}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -175,7 +175,7 @@ msgstr ""
|
|||||||
msgid "Invalid multiplier"
|
msgid "Invalid multiplier"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/cannery/ammo/ammo_group.ex:96
|
#: lib/cannery/ammo/ammo_group.ex:97
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Please select an ammo type and container"
|
msgid "Please select an ammo type and container"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -132,7 +132,7 @@ msgstr ""
|
|||||||
msgid "Password updated successfully."
|
msgid "Password updated successfully."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/cannery_web/controllers/user_registration_controller.ex:74
|
#: lib/cannery_web/controllers/user_registration_controller.ex:73
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Please check your email to verify your account"
|
msgid "Please check your email to verify your account"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -70,14 +70,14 @@ msgstr ""
|
|||||||
msgid "Reset password link is invalid or it has expired."
|
msgid "Reset password link is invalid or it has expired."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/cannery_web/controllers/user_registration_controller.ex:25
|
#: lib/cannery_web/controllers/user_registration_controller.ex:24
|
||||||
#: lib/cannery_web/controllers/user_registration_controller.ex:56
|
#: lib/cannery_web/controllers/user_registration_controller.ex:55
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Sorry, public registration is disabled"
|
msgid "Sorry, public registration is disabled"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/cannery_web/controllers/user_registration_controller.ex:15
|
#: lib/cannery_web/controllers/user_registration_controller.ex:14
|
||||||
#: lib/cannery_web/controllers/user_registration_controller.ex:46
|
#: lib/cannery_web/controllers/user_registration_controller.ex:45
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Sorry, this invite was not found or expired"
|
msgid "Sorry, this invite was not found or expired"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -107,17 +107,17 @@ msgstr ""
|
|||||||
msgid "You are not authorized to view this page."
|
msgid "You are not authorized to view this page."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/cannery/accounts/user.ex:138
|
#: lib/cannery/accounts/user.ex:137
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "did not change"
|
msgid "did not change"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/cannery/accounts/user.ex:159
|
#: lib/cannery/accounts/user.ex:158
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "does not match password"
|
msgid "does not match password"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/cannery/accounts/user.ex:196
|
#: lib/cannery/accounts/user.ex:195
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "is not valid"
|
msgid "is not valid"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -127,7 +127,7 @@ msgstr ""
|
|||||||
msgid "must have the @ sign and no spaces"
|
msgid "must have the @ sign and no spaces"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/cannery/tags.ex:40
|
#: lib/cannery/tags.ex:39
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Tag not found"
|
msgid "Tag not found"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -137,13 +137,13 @@ msgstr ""
|
|||||||
msgid "Tag could not be added"
|
msgid "Tag could not be added"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/cannery/activity_log/shot_group.ex:123
|
#: lib/cannery/activity_log/shot_group.ex:122
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Count must be at least 1"
|
msgid "Count must be at least 1"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/cannery/activity_log/shot_group.ex:82
|
#: lib/cannery/activity_log/shot_group.ex:82
|
||||||
#: lib/cannery/activity_log/shot_group.ex:119
|
#: lib/cannery/activity_log/shot_group.ex:118
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Count must be less than %{count}"
|
msgid "Count must be less than %{count}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -174,7 +174,7 @@ msgstr ""
|
|||||||
msgid "Invalid multiplier"
|
msgid "Invalid multiplier"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/cannery/ammo/ammo_group.ex:96
|
#: lib/cannery/ammo/ammo_group.ex:97
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Please select an ammo type and container"
|
msgid "Please select an ammo type and container"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -709,7 +709,7 @@ msgstr ""
|
|||||||
msgid "Log in"
|
msgid "Log in"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/cannery_web/controllers/user_registration_controller.ex:35
|
#: lib/cannery_web/controllers/user_registration_controller.ex:34
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Register"
|
msgid "Register"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -86,14 +86,14 @@ msgid "Reset password link is invalid or it has expired."
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"El enlace de reestablecimiento de la contraseña es inválido o ha caducado."
|
"El enlace de reestablecimiento de la contraseña es inválido o ha caducado."
|
||||||
|
|
||||||
#: lib/cannery_web/controllers/user_registration_controller.ex:25
|
#: lib/cannery_web/controllers/user_registration_controller.ex:24
|
||||||
#: lib/cannery_web/controllers/user_registration_controller.ex:56
|
#: lib/cannery_web/controllers/user_registration_controller.ex:55
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Sorry, public registration is disabled"
|
msgid "Sorry, public registration is disabled"
|
||||||
msgstr "Lo sentimos, la inscripción pública está desactivada"
|
msgstr "Lo sentimos, la inscripción pública está desactivada"
|
||||||
|
|
||||||
#: lib/cannery_web/controllers/user_registration_controller.ex:15
|
#: lib/cannery_web/controllers/user_registration_controller.ex:14
|
||||||
#: lib/cannery_web/controllers/user_registration_controller.ex:46
|
#: lib/cannery_web/controllers/user_registration_controller.ex:45
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Sorry, this invite was not found or expired"
|
msgid "Sorry, this invite was not found or expired"
|
||||||
msgstr "Lo sentimos, esta invitación no fue encontrada o ha expirado"
|
msgstr "Lo sentimos, esta invitación no fue encontrada o ha expirado"
|
||||||
@ -123,17 +123,17 @@ msgstr "No está autorizado a ver esta página"
|
|||||||
msgid "You are not authorized to view this page."
|
msgid "You are not authorized to view this page."
|
||||||
msgstr "No está autorizado a ver esta página."
|
msgstr "No está autorizado a ver esta página."
|
||||||
|
|
||||||
#: lib/cannery/accounts/user.ex:138
|
#: lib/cannery/accounts/user.ex:137
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "did not change"
|
msgid "did not change"
|
||||||
msgstr "no cambió"
|
msgstr "no cambió"
|
||||||
|
|
||||||
#: lib/cannery/accounts/user.ex:159
|
#: lib/cannery/accounts/user.ex:158
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "does not match password"
|
msgid "does not match password"
|
||||||
msgstr "no coincide con la contraseña"
|
msgstr "no coincide con la contraseña"
|
||||||
|
|
||||||
#: lib/cannery/accounts/user.ex:196
|
#: lib/cannery/accounts/user.ex:195
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "is not valid"
|
msgid "is not valid"
|
||||||
msgstr "no es válido"
|
msgstr "no es válido"
|
||||||
@ -143,7 +143,7 @@ msgstr "no es válido"
|
|||||||
msgid "must have the @ sign and no spaces"
|
msgid "must have the @ sign and no spaces"
|
||||||
msgstr "debe tener el signo @ y no contener espacios"
|
msgstr "debe tener el signo @ y no contener espacios"
|
||||||
|
|
||||||
#: lib/cannery/tags.ex:40
|
#: lib/cannery/tags.ex:39
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Tag not found"
|
msgid "Tag not found"
|
||||||
msgstr "Etiqueta no encontrada"
|
msgstr "Etiqueta no encontrada"
|
||||||
@ -153,13 +153,13 @@ msgstr "Etiqueta no encontrada"
|
|||||||
msgid "Tag could not be added"
|
msgid "Tag could not be added"
|
||||||
msgstr "La etiqueta no pudo ser añadida"
|
msgstr "La etiqueta no pudo ser añadida"
|
||||||
|
|
||||||
#: lib/cannery/activity_log/shot_group.ex:123
|
#: lib/cannery/activity_log/shot_group.ex:122
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Count must be at least 1"
|
msgid "Count must be at least 1"
|
||||||
msgstr "El recuento debe dar al menos 1"
|
msgstr "El recuento debe dar al menos 1"
|
||||||
|
|
||||||
#: lib/cannery/activity_log/shot_group.ex:82
|
#: lib/cannery/activity_log/shot_group.ex:82
|
||||||
#: lib/cannery/activity_log/shot_group.ex:119
|
#: lib/cannery/activity_log/shot_group.ex:118
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Count must be less than %{count}"
|
msgid "Count must be less than %{count}"
|
||||||
msgstr "El recuento debe ser menos de %{count}"
|
msgstr "El recuento debe ser menos de %{count}"
|
||||||
@ -190,7 +190,7 @@ msgstr "Número inválido de copias, debe ser entre 1 y %{max}. Fue %{multiplier
|
|||||||
msgid "Invalid multiplier"
|
msgid "Invalid multiplier"
|
||||||
msgstr "Multiplicador inválido"
|
msgstr "Multiplicador inválido"
|
||||||
|
|
||||||
#: lib/cannery/ammo/ammo_group.ex:96
|
#: lib/cannery/ammo/ammo_group.ex:97
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Please select an ammo type and container"
|
msgid "Please select an ammo type and container"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -150,7 +150,7 @@ msgstr "Contraseña reiniciada exitosamente."
|
|||||||
msgid "Password updated successfully."
|
msgid "Password updated successfully."
|
||||||
msgstr "Contraseña cambiada exitosamente."
|
msgstr "Contraseña cambiada exitosamente."
|
||||||
|
|
||||||
#: lib/cannery_web/controllers/user_registration_controller.ex:74
|
#: lib/cannery_web/controllers/user_registration_controller.ex:73
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Please check your email to verify your account"
|
msgid "Please check your email to verify your account"
|
||||||
msgstr "Por favor chequea el correo para verificar tu cuenta"
|
msgstr "Por favor chequea el correo para verificar tu cuenta"
|
||||||
|
@ -713,7 +713,7 @@ msgstr "Mot de passe oublié ?"
|
|||||||
msgid "Log in"
|
msgid "Log in"
|
||||||
msgstr "Se connecter"
|
msgstr "Se connecter"
|
||||||
|
|
||||||
#: lib/cannery_web/controllers/user_registration_controller.ex:35
|
#: lib/cannery_web/controllers/user_registration_controller.ex:34
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Register"
|
msgid "Register"
|
||||||
msgstr "S’enregistrer"
|
msgstr "S’enregistrer"
|
||||||
|
@ -85,14 +85,14 @@ msgstr ""
|
|||||||
msgid "Reset password link is invalid or it has expired."
|
msgid "Reset password link is invalid or it has expired."
|
||||||
msgstr "Le lien de réinitialisation de mot de passe est invalide ou expiré."
|
msgstr "Le lien de réinitialisation de mot de passe est invalide ou expiré."
|
||||||
|
|
||||||
#: lib/cannery_web/controllers/user_registration_controller.ex:25
|
#: lib/cannery_web/controllers/user_registration_controller.ex:24
|
||||||
#: lib/cannery_web/controllers/user_registration_controller.ex:56
|
#: lib/cannery_web/controllers/user_registration_controller.ex:55
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Sorry, public registration is disabled"
|
msgid "Sorry, public registration is disabled"
|
||||||
msgstr "Désolé, l’enregistrement public est désactivé"
|
msgstr "Désolé, l’enregistrement public est désactivé"
|
||||||
|
|
||||||
#: lib/cannery_web/controllers/user_registration_controller.ex:15
|
#: lib/cannery_web/controllers/user_registration_controller.ex:14
|
||||||
#: lib/cannery_web/controllers/user_registration_controller.ex:46
|
#: lib/cannery_web/controllers/user_registration_controller.ex:45
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Sorry, this invite was not found or expired"
|
msgid "Sorry, this invite was not found or expired"
|
||||||
msgstr "Désolé, cette invitation n’est pas trouvée ou est expirée"
|
msgstr "Désolé, cette invitation n’est pas trouvée ou est expirée"
|
||||||
@ -122,17 +122,17 @@ msgstr "Vous n’êtes pas autorisé·e à voir cette page"
|
|||||||
msgid "You are not authorized to view this page."
|
msgid "You are not authorized to view this page."
|
||||||
msgstr "Vous n’êtes pas autorisé·e à voir cette page."
|
msgstr "Vous n’êtes pas autorisé·e à voir cette page."
|
||||||
|
|
||||||
#: lib/cannery/accounts/user.ex:138
|
#: lib/cannery/accounts/user.ex:137
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "did not change"
|
msgid "did not change"
|
||||||
msgstr "est inchangé"
|
msgstr "est inchangé"
|
||||||
|
|
||||||
#: lib/cannery/accounts/user.ex:159
|
#: lib/cannery/accounts/user.ex:158
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "does not match password"
|
msgid "does not match password"
|
||||||
msgstr "le mot de passe ne correspond pas"
|
msgstr "le mot de passe ne correspond pas"
|
||||||
|
|
||||||
#: lib/cannery/accounts/user.ex:196
|
#: lib/cannery/accounts/user.ex:195
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "is not valid"
|
msgid "is not valid"
|
||||||
msgstr "n’est pas valide"
|
msgstr "n’est pas valide"
|
||||||
@ -142,7 +142,7 @@ msgstr "n’est pas valide"
|
|||||||
msgid "must have the @ sign and no spaces"
|
msgid "must have the @ sign and no spaces"
|
||||||
msgstr "doit contenir le symbole @ et aucune espace"
|
msgstr "doit contenir le symbole @ et aucune espace"
|
||||||
|
|
||||||
#: lib/cannery/tags.ex:40
|
#: lib/cannery/tags.ex:39
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Tag not found"
|
msgid "Tag not found"
|
||||||
msgstr "Tag pas trouvé"
|
msgstr "Tag pas trouvé"
|
||||||
@ -152,13 +152,13 @@ msgstr "Tag pas trouvé"
|
|||||||
msgid "Tag could not be added"
|
msgid "Tag could not be added"
|
||||||
msgstr "Le tag n’a pas pu être ajouté"
|
msgstr "Le tag n’a pas pu être ajouté"
|
||||||
|
|
||||||
#: lib/cannery/activity_log/shot_group.ex:123
|
#: lib/cannery/activity_log/shot_group.ex:122
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Count must be at least 1"
|
msgid "Count must be at least 1"
|
||||||
msgstr "Le nombre doit être au moins égal à 1"
|
msgstr "Le nombre doit être au moins égal à 1"
|
||||||
|
|
||||||
#: lib/cannery/activity_log/shot_group.ex:82
|
#: lib/cannery/activity_log/shot_group.ex:82
|
||||||
#: lib/cannery/activity_log/shot_group.ex:119
|
#: lib/cannery/activity_log/shot_group.ex:118
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Count must be less than %{count}"
|
msgid "Count must be less than %{count}"
|
||||||
msgstr "La quantité doit être inférieur à %{count}"
|
msgstr "La quantité doit être inférieur à %{count}"
|
||||||
@ -191,7 +191,7 @@ msgstr "Nombre de copies invalide, doit être 1 et %{max}. Été %{multiplier}"
|
|||||||
msgid "Invalid multiplier"
|
msgid "Invalid multiplier"
|
||||||
msgstr "Multiplicateur invalide"
|
msgstr "Multiplicateur invalide"
|
||||||
|
|
||||||
#: lib/cannery/ammo/ammo_group.ex:96
|
#: lib/cannery/ammo/ammo_group.ex:97
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Please select an ammo type and container"
|
msgid "Please select an ammo type and container"
|
||||||
msgstr "Veuillez choisir un type de munitions et un conteneur"
|
msgstr "Veuillez choisir un type de munitions et un conteneur"
|
||||||
|
@ -151,7 +151,7 @@ msgstr "Mot de passe réinitialiser avec succès."
|
|||||||
msgid "Password updated successfully."
|
msgid "Password updated successfully."
|
||||||
msgstr "Mot de passe mis à jour avec succès."
|
msgstr "Mot de passe mis à jour avec succès."
|
||||||
|
|
||||||
#: lib/cannery_web/controllers/user_registration_controller.ex:74
|
#: lib/cannery_web/controllers/user_registration_controller.ex:73
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Please check your email to verify your account"
|
msgid "Please check your email to verify your account"
|
||||||
msgstr "Veuillez vérifier votre mél pour confirmer votre compte"
|
msgstr "Veuillez vérifier votre mél pour confirmer votre compte"
|
||||||
|
@ -705,7 +705,7 @@ msgstr ""
|
|||||||
msgid "Log in"
|
msgid "Log in"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/cannery_web/controllers/user_registration_controller.ex:35
|
#: lib/cannery_web/controllers/user_registration_controller.ex:34
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Register"
|
msgid "Register"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -86,14 +86,14 @@ msgstr ""
|
|||||||
msgid "Reset password link is invalid or it has expired."
|
msgid "Reset password link is invalid or it has expired."
|
||||||
msgstr "Tá nasc an pasfhocail a athrú neamhbailí nó as dáta."
|
msgstr "Tá nasc an pasfhocail a athrú neamhbailí nó as dáta."
|
||||||
|
|
||||||
#: lib/cannery_web/controllers/user_registration_controller.ex:25
|
#: lib/cannery_web/controllers/user_registration_controller.ex:24
|
||||||
#: lib/cannery_web/controllers/user_registration_controller.ex:56
|
#: lib/cannery_web/controllers/user_registration_controller.ex:55
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Sorry, public registration is disabled"
|
msgid "Sorry, public registration is disabled"
|
||||||
msgstr "Tá brón orainn, tá clarú póiblí bactha"
|
msgstr "Tá brón orainn, tá clarú póiblí bactha"
|
||||||
|
|
||||||
#: lib/cannery_web/controllers/user_registration_controller.ex:15
|
#: lib/cannery_web/controllers/user_registration_controller.ex:14
|
||||||
#: lib/cannery_web/controllers/user_registration_controller.ex:46
|
#: lib/cannery_web/controllers/user_registration_controller.ex:45
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Sorry, this invite was not found or expired"
|
msgid "Sorry, this invite was not found or expired"
|
||||||
msgstr "Tá brón orainn, ní feidir an cuireadh seo a fáil nó tá sé as dáta"
|
msgstr "Tá brón orainn, ní feidir an cuireadh seo a fáil nó tá sé as dáta"
|
||||||
@ -123,17 +123,17 @@ msgstr "Níl cead agaibh féachaint ar an leathanach seo"
|
|||||||
msgid "You are not authorized to view this page."
|
msgid "You are not authorized to view this page."
|
||||||
msgstr "Níl cead agaibh féachaint ar an leathanach seo."
|
msgstr "Níl cead agaibh féachaint ar an leathanach seo."
|
||||||
|
|
||||||
#: lib/cannery/accounts/user.ex:138
|
#: lib/cannery/accounts/user.ex:137
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "did not change"
|
msgid "did not change"
|
||||||
msgstr "Níor athraigh sé"
|
msgstr "Níor athraigh sé"
|
||||||
|
|
||||||
#: lib/cannery/accounts/user.ex:159
|
#: lib/cannery/accounts/user.ex:158
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "does not match password"
|
msgid "does not match password"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/cannery/accounts/user.ex:196
|
#: lib/cannery/accounts/user.ex:195
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "is not valid"
|
msgid "is not valid"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -143,7 +143,7 @@ msgstr ""
|
|||||||
msgid "must have the @ sign and no spaces"
|
msgid "must have the @ sign and no spaces"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/cannery/tags.ex:40
|
#: lib/cannery/tags.ex:39
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Tag not found"
|
msgid "Tag not found"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -153,13 +153,13 @@ msgstr ""
|
|||||||
msgid "Tag could not be added"
|
msgid "Tag could not be added"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/cannery/activity_log/shot_group.ex:123
|
#: lib/cannery/activity_log/shot_group.ex:122
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Count must be at least 1"
|
msgid "Count must be at least 1"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/cannery/activity_log/shot_group.ex:82
|
#: lib/cannery/activity_log/shot_group.ex:82
|
||||||
#: lib/cannery/activity_log/shot_group.ex:119
|
#: lib/cannery/activity_log/shot_group.ex:118
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Count must be less than %{count}"
|
msgid "Count must be less than %{count}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -190,7 +190,7 @@ msgstr ""
|
|||||||
msgid "Invalid multiplier"
|
msgid "Invalid multiplier"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/cannery/ammo/ammo_group.ex:96
|
#: lib/cannery/ammo/ammo_group.ex:97
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Please select an ammo type and container"
|
msgid "Please select an ammo type and container"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -142,7 +142,7 @@ msgstr ""
|
|||||||
msgid "Password updated successfully."
|
msgid "Password updated successfully."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/cannery_web/controllers/user_registration_controller.ex:74
|
#: lib/cannery_web/controllers/user_registration_controller.ex:73
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Please check your email to verify your account"
|
msgid "Please check your email to verify your account"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -131,7 +131,7 @@ msgstr ""
|
|||||||
msgid "Password updated successfully."
|
msgid "Password updated successfully."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/cannery_web/controllers/user_registration_controller.ex:74
|
#: lib/cannery_web/controllers/user_registration_controller.ex:73
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Please check your email to verify your account"
|
msgid "Please check your email to verify your account"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -104,7 +104,7 @@ defmodule Cannery.AccountsTest do
|
|||||||
|
|
||||||
describe "change_user_registration/2" do
|
describe "change_user_registration/2" do
|
||||||
test "returns a changeset" do
|
test "returns a changeset" do
|
||||||
assert %Changeset{} = changeset = Accounts.change_user_registration(%User{})
|
assert %Changeset{} = changeset = Accounts.change_user_registration()
|
||||||
assert changeset.required == [:password, :email]
|
assert changeset.required == [:password, :email]
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -112,8 +112,7 @@ defmodule Cannery.AccountsTest do
|
|||||||
email = unique_user_email()
|
email = unique_user_email()
|
||||||
password = valid_user_password()
|
password = valid_user_password()
|
||||||
|
|
||||||
changeset =
|
changeset = Accounts.change_user_registration(%{"email" => email, "password" => password})
|
||||||
Accounts.change_user_registration(%User{}, %{"email" => email, "password" => password})
|
|
||||||
|
|
||||||
assert changeset.valid?
|
assert changeset.valid?
|
||||||
assert get_change(changeset, :email) == email
|
assert get_change(changeset, :email) == email
|
||||||
|
Loading…
Reference in New Issue
Block a user