fix(admin-api): confirm created users
This commit is contained in:
parent
836f4a2d69
commit
d0b5a05075
2 changed files with 17 additions and 1 deletions
|
|
@ -180,7 +180,7 @@ defmodule Pleroma.Web.AdminAPI.UserController do
|
||||||
bio: "."
|
bio: "."
|
||||||
}
|
}
|
||||||
|
|
||||||
{User.register_changeset(%User{}, user_data, need_confirmation: false), passwordless?}
|
{User.register_changeset(%User{}, user_data, confirmed: true), passwordless?}
|
||||||
end)
|
end)
|
||||||
|> Enum.reduce(Multi.new(), fn {changeset, passwordless?}, multi ->
|
|> Enum.reduce(Multi.new(), fn {changeset, passwordless?}, multi ->
|
||||||
user_operation = {:user, Ecto.UUID.generate()}
|
user_operation = {:user, Ecto.UUID.generate()}
|
||||||
|
|
|
||||||
|
|
@ -176,6 +176,22 @@ defmodule Pleroma.Web.AdminAPI.UserControllerTest do
|
||||||
assert ["lain", "lain2"] -- Enum.map(log_entry.data["subjects"], & &1["nickname"]) == []
|
assert ["lain", "lain2"] -- Enum.map(log_entry.data["subjects"], & &1["nickname"]) == []
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "Admin-created users bypass account confirmation", %{conn: conn} do
|
||||||
|
clear_config([:instance, :account_activation_required], true)
|
||||||
|
|
||||||
|
conn
|
||||||
|
|> put_req_header("accept", "application/json")
|
||||||
|
|> put_req_header("content-type", "application/json")
|
||||||
|
|> post("/api/pleroma/admin/users", %{
|
||||||
|
"users" => [
|
||||||
|
%{"nickname" => "lain", "email" => "lain@example.org", "password" => "test"}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
|
assert User.get_by_nickname("lain").is_confirmed
|
||||||
|
end
|
||||||
|
|
||||||
test "Creating without a password returns a password reset link", %{conn: conn} do
|
test "Creating without a password returns a password reset link", %{conn: conn} do
|
||||||
accounts =
|
accounts =
|
||||||
conn
|
conn
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue