diff options
author | Tusooa Zhu <tusooa@kazv.moe> | 2021-09-05 20:56:16 -0400 |
---|---|---|
committer | Tusooa Zhu <tusooa@kazv.moe> | 2021-09-05 21:27:02 -0400 |
commit | 198250dcef9b477912567932a714a6ecf37f8353 (patch) | |
tree | 352579ab718cc6482fd3e46636560636e8afa258 /lib | |
parent | 6b1282a8297e7767d77b748f89d7d001716c94bd (diff) | |
download | pleroma-198250dcef9b477912567932a714a6ecf37f8353.tar.gz |
Allow users to remove their emails if instance does not need email to register
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/user.ex | 2 | ||||
-rw-r--r-- | lib/pleroma/web/api_spec/operations/twitter_util_operation.ex | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index 62506f37a..04deb3f79 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -2248,7 +2248,7 @@ defmodule Pleroma.User do def change_email(user, email) do user |> cast(%{email: email}, [:email]) - |> validate_required([:email]) + |> maybe_validate_required_email(false) |> unique_constraint(:email) |> validate_format(:email, @email_regex) |> update_and_set_cache() diff --git a/lib/pleroma/web/api_spec/operations/twitter_util_operation.ex b/lib/pleroma/web/api_spec/operations/twitter_util_operation.ex index 879b2227e..ebcfd3be2 100644 --- a/lib/pleroma/web/api_spec/operations/twitter_util_operation.ex +++ b/lib/pleroma/web/api_spec/operations/twitter_util_operation.ex @@ -121,7 +121,10 @@ defmodule Pleroma.Web.ApiSpec.TwitterUtilOperation do type: :object, required: [:email, :password], properties: %{ - email: %Schema{type: :string, description: "New email"}, + email: %Schema{ + type: :string, + description: "New email. Set to blank to remove the user's email." + }, password: %Schema{type: :string, description: "Current password"} } } |