diff options
author | lain <lain@soykaf.club> | 2020-03-04 12:43:06 +0000 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-03-04 12:43:06 +0000 |
commit | 6f7a8c43a200d2d0166e4e544aee1e6104bcb671 (patch) | |
tree | c3942b6a54f5768b5f3efa6f0e9aa1ea2f40d281 /lib/pleroma/web/twitter_api | |
parent | 5992c256ad7c5bc8207240c9d51e03964e50eb64 (diff) | |
parent | cb60a9c42f48f0b9df1681f9cba229b21eb6095c (diff) | |
download | pleroma-6f7a8c43a200d2d0166e4e544aee1e6104bcb671.tar.gz |
Merge branch 'fix/no-email-no-fail' into 'develop'
Do not fail when user has no email
See merge request pleroma/pleroma!2249
Diffstat (limited to 'lib/pleroma/web/twitter_api')
-rw-r--r-- | lib/pleroma/web/twitter_api/twitter_api.ex | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/pleroma/web/twitter_api/twitter_api.ex b/lib/pleroma/web/twitter_api/twitter_api.ex index 4d74c6a73..f9c0994da 100644 --- a/lib/pleroma/web/twitter_api/twitter_api.ex +++ b/lib/pleroma/web/twitter_api/twitter_api.ex @@ -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"} |