cap again

This commit is contained in:
Mark Felder 2018-03-19 18:00:02 +00:00
parent 2549a73d6d
commit 2702df489f

View file

@ -40,7 +40,7 @@ def use_token(%Authorization{used: false, valid_until: valid_until} = auth) do
if NaiveDateTime.diff(NaiveDateTime.utc_now, valid_until) < 0 do
Repo.update(use_changeset(auth, %{used: true}))
else
{:error, "token expired"}
{:error, "Token expired"}
end
end
def use_token(%Authorization{used: true}), do: {:error, "Already used"}