fix style issues
Some checks reported errors
continuous-integration/drone/push Build encountered an error
Some checks reported errors
continuous-integration/drone/push Build encountered an error
This commit is contained in:
parent
2346a82a46
commit
1e55039a67
@ -219,7 +219,7 @@ defmodule Memex.Accounts do
|
||||
|
||||
with {:ok, query} <- UserToken.verify_change_email_token_query(token, context),
|
||||
%UserToken{sent_to: email} <- Repo.one(query),
|
||||
{:ok, _} <- Repo.transaction(user_email_multi(user, email, context)) do
|
||||
{:ok, _result} <- Repo.transaction(user_email_multi(user, email, context)) do
|
||||
:ok
|
||||
else
|
||||
_error_tuple -> :error
|
||||
|
@ -140,7 +140,7 @@ defmodule Memex.Accounts.User do
|
||||
|> cast(attrs, [:email])
|
||||
|> validate_email()
|
||||
|> case do
|
||||
%{changes: %{email: _}} = changeset -> changeset
|
||||
%{changes: %{email: _email}} = changeset -> changeset
|
||||
%{} = changeset -> add_error(changeset, :email, dgettext("errors", "did not change"))
|
||||
end
|
||||
end
|
||||
|
@ -155,7 +155,7 @@ defmodule Memex.Accounts.UserToken do
|
||||
from t in __MODULE__, where: t.user_id == ^user.id
|
||||
end
|
||||
|
||||
def user_and_contexts_query(user, [_ | _] = contexts) do
|
||||
def user_and_contexts_query(user, [_head | _rest] = contexts) do
|
||||
from t in __MODULE__, where: t.user_id == ^user.id and t.context in ^contexts
|
||||
end
|
||||
end
|
||||
|
@ -40,7 +40,7 @@ defmodule MemexWeb.UserResetPasswordController do
|
||||
# leaked token giving the user access to the account.
|
||||
def update(conn, %{"user" => user_params}) do
|
||||
case Accounts.reset_user_password(conn.assigns.user, user_params) do
|
||||
{:ok, _} ->
|
||||
{:ok, _user} ->
|
||||
conn
|
||||
|> put_flash(:info, dgettext("prompts", "password reset successfully."))
|
||||
|> redirect(to: ~p"/users/log_in")
|
||||
|
@ -316,7 +316,7 @@ defmodule Memex.AccountsTest do
|
||||
test "deletes all tokens for the given user", %{user: user} do
|
||||
_session_token = Accounts.generate_user_session_token(user)
|
||||
|
||||
{:ok, _} =
|
||||
{:ok, _user} =
|
||||
Accounts.update_user_password(user, valid_user_password(), %{
|
||||
"password" => "new valid password"
|
||||
})
|
||||
|
@ -64,7 +64,7 @@ defmodule Memex.DataCase do
|
||||
symbols = ~c"0123456789abcdef-"
|
||||
symbol_count = Enum.count(symbols)
|
||||
|
||||
for _ <- Range.new(1, length),
|
||||
for _index <- 1..length//1,
|
||||
into: "",
|
||||
do: <<Enum.at(symbols, :rand.uniform(symbol_count - 1))>>
|
||||
end
|
||||
|
@ -47,8 +47,8 @@ defmodule Memex.Fixtures do
|
||||
|> Atom.to_string()
|
||||
|> Email.generate_email(Accounts.get_user!(user_id), attrs)
|
||||
|
||||
[_, html_token | _] = email.html_body |> String.split("[TOKEN]")
|
||||
[_, text_token | _] = email.text_body |> String.split("[TOKEN]")
|
||||
[_prefix, html_token | _postfix] = email.html_body |> String.split("[TOKEN]")
|
||||
[_prefix, text_token | _postfix] = email.text_body |> String.split("[TOKEN]")
|
||||
^text_token = html_token
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user