diff options
author | Egor Kislitsyn <egor@kislitsyn.com> | 2020-02-27 17:27:49 +0400 |
---|---|---|
committer | Egor Kislitsyn <egor@kislitsyn.com> | 2020-02-27 17:27:49 +0400 |
commit | cb60a9c42f48f0b9df1681f9cba229b21eb6095c (patch) | |
tree | a47b1592d1e5d880c251ddad66d994dc61b59b9f /lib/pleroma/web/twitter_api | |
parent | fda6f35a467914d3d6bf6944a10dc928c4ab495c (diff) | |
download | pleroma-cb60a9c42f48f0b9df1681f9cba229b21eb6095c.tar.gz |
Do not fail when user has no email
Diffstat (limited to 'lib/pleroma/web/twitter_api')
-rw-r--r-- | lib/pleroma/web/twitter_api/twitter_api.ex | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/pleroma/web/twitter_api/twitter_api.ex b/lib/pleroma/web/twitter_api/twitter_api.ex index bfd838902..f9c0994da 100644 --- a/lib/pleroma/web/twitter_api/twitter_api.ex +++ b/lib/pleroma/web/twitter_api/twitter_api.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.TwitterAPI.TwitterAPI do @@ -99,7 +99,8 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do def password_reset(nickname_or_email) do with true <- is_binary(nickname_or_email), - %User{local: true} = user <- User.get_by_nickname_or_email(nickname_or_email), + %User{local: true, email: email} = user when not is_nil(email) <- + User.get_by_nickname_or_email(nickname_or_email), {:ok, token_record} <- Pleroma.PasswordResetToken.create_token(user) do user |> UserEmail.password_reset_email(token_record.token) @@ -110,6 +111,9 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do false -> {:error, "bad user identifier"} + %User{local: true, email: nil} -> + {:ok, :noop} + %User{local: false} -> {:error, "remote user"} |