[#114] Added email confirmation resend action. Added tests
for registration, authentication, email confirmation, confirmation resending. Made admin methods create confirmed users.
This commit is contained in:
parent
aed0f90287
commit
b096e30cff
9 changed files with 230 additions and 16 deletions
|
|
@ -13,7 +13,7 @@ defmodule Pleroma.Web.TwitterAPI.Controller do
|
|||
require Logger
|
||||
|
||||
plug(:only_if_public_instance when action in [:public_timeline, :public_and_external_timeline])
|
||||
plug(:fetch_flash when action in [:confirm_email])
|
||||
plug(:fetch_flash when action in [:confirm_email, :resend_confirmation_email])
|
||||
action_fallback(:errors)
|
||||
|
||||
def verify_credentials(%{assigns: %{user: user}} = conn, _params) do
|
||||
|
|
@ -385,6 +385,17 @@ defmodule Pleroma.Web.TwitterAPI.Controller do
|
|||
end
|
||||
end
|
||||
|
||||
def resend_confirmation_email(conn, params) do
|
||||
nickname_or_email = params["email"] || params["nickname"]
|
||||
|
||||
with %User{} = user <- User.get_by_nickname_or_email(nickname_or_email),
|
||||
{:ok, _} <- User.try_send_confirmation_email(user) do
|
||||
conn
|
||||
|> put_flash(:info, "Email confirmation has been sent.")
|
||||
|> json_response(:no_content, "")
|
||||
end
|
||||
end
|
||||
|
||||
def update_avatar(%{assigns: %{user: user}} = conn, params) do
|
||||
{:ok, object} = ActivityPub.upload(params, type: :avatar)
|
||||
change = Changeset.change(user, %{avatar: object.data})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue