projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Update functions in object fetcher for tesla and set up a proper mock for tests
[akkoma]
/
lib
/
pleroma
/
PasswordResetToken.ex
diff --git
a/lib/pleroma/PasswordResetToken.ex
b/lib/pleroma/PasswordResetToken.ex
index 750ddd3c04645e3714face400e0cbbc42bb6ebe8..7afbc8751bd947e9be446db1d101801b7996643c 100644
(file)
--- a/
lib/pleroma/PasswordResetToken.ex
+++ b/
lib/pleroma/PasswordResetToken.ex
@@
-7,9
+7,9
@@
defmodule Pleroma.PasswordResetToken do
import Ecto.Changeset
import Ecto.Changeset
- alias Pleroma.User
- alias Pleroma.Repo
alias Pleroma.PasswordResetToken
alias Pleroma.PasswordResetToken
+ alias Pleroma.Repo
+ alias Pleroma.User
schema "password_reset_tokens" do
belongs_to(:user, User, type: Pleroma.FlakeId)
schema "password_reset_tokens" do
belongs_to(:user, User, type: Pleroma.FlakeId)
@@
-39,7
+39,7
@@
defmodule Pleroma.PasswordResetToken do
def reset_password(token, data) do
with %{used: false} = token <- Repo.get_by(PasswordResetToken, %{token: token}),
def reset_password(token, data) do
with %{used: false} = token <- Repo.get_by(PasswordResetToken, %{token: token}),
- %User{} = user <-
Repo.get(User,
token.user_id),
+ %User{} = user <-
User.get_by_id(
token.user_id),
{:ok, _user} <- User.reset_password(user, data),
{:ok, token} <- Repo.update(used_changeset(token)) do
{:ok, token}
{:ok, _user} <- User.reset_password(user, data),
{:ok, token} <- Repo.update(used_changeset(token)) do
{:ok, token}