From b096e30cffc79a4adf12be88da412a290cd0d190 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Tue, 18 Dec 2018 17:13:52 +0300 Subject: [#114] Added email confirmation resend action. Added tests for registration, authentication, email confirmation, confirmation resending. Made admin methods create confirmed users. --- lib/mix/tasks/pleroma/user.ex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/mix/tasks') diff --git a/lib/mix/tasks/pleroma/user.ex b/lib/mix/tasks/pleroma/user.ex index 3d30e3a81..51086a443 100644 --- a/lib/mix/tasks/pleroma/user.ex +++ b/lib/mix/tasks/pleroma/user.ex @@ -103,8 +103,8 @@ defmodule Mix.Tasks.Pleroma.User do bio: bio } - user = User.register_changeset(%User{}, params) - Repo.insert!(user) + changeset = User.register_changeset(%User{}, params, confirmed: true) + {:ok, _user} = User.register(changeset) Mix.shell().info("User #{nickname} created") -- cgit v1.2.3 From 69ad1039ba6cb94ea0f6c9d2c7171bdab789651f Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 23 Dec 2018 20:05:55 +0000 Subject: mix tasks: add legal boilerplate --- lib/mix/tasks/pleroma/common.ex | 4 ++++ lib/mix/tasks/pleroma/instance.ex | 4 ++++ lib/mix/tasks/pleroma/relay.ex | 4 ++++ lib/mix/tasks/pleroma/uploads.ex | 4 ++++ lib/mix/tasks/pleroma/user.ex | 4 ++++ 5 files changed, 20 insertions(+) (limited to 'lib/mix/tasks') diff --git a/lib/mix/tasks/pleroma/common.ex b/lib/mix/tasks/pleroma/common.ex index 36432c291..48c0c1346 100644 --- a/lib/mix/tasks/pleroma/common.ex +++ b/lib/mix/tasks/pleroma/common.ex @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2018 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Mix.Tasks.Pleroma.Common do @doc "Common functions to be reused in mix tasks" def start_pleroma do diff --git a/lib/mix/tasks/pleroma/instance.ex b/lib/mix/tasks/pleroma/instance.ex index 02e1ce27d..1ef40671c 100644 --- a/lib/mix/tasks/pleroma/instance.ex +++ b/lib/mix/tasks/pleroma/instance.ex @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2018 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Mix.Tasks.Pleroma.Instance do use Mix.Task alias Mix.Tasks.Pleroma.Common diff --git a/lib/mix/tasks/pleroma/relay.ex b/lib/mix/tasks/pleroma/relay.ex index 03586d6c3..cbe23f82e 100644 --- a/lib/mix/tasks/pleroma/relay.ex +++ b/lib/mix/tasks/pleroma/relay.ex @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2018 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Mix.Tasks.Pleroma.Relay do use Mix.Task alias Pleroma.Web.ActivityPub.Relay diff --git a/lib/mix/tasks/pleroma/uploads.ex b/lib/mix/tasks/pleroma/uploads.ex index 63299b2ae..f0eb13e1a 100644 --- a/lib/mix/tasks/pleroma/uploads.ex +++ b/lib/mix/tasks/pleroma/uploads.ex @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2018 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Mix.Tasks.Pleroma.Uploads do use Mix.Task alias Pleroma.{Upload, Uploaders.Local} diff --git a/lib/mix/tasks/pleroma/user.ex b/lib/mix/tasks/pleroma/user.ex index 51086a443..217a52fdd 100644 --- a/lib/mix/tasks/pleroma/user.ex +++ b/lib/mix/tasks/pleroma/user.ex @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2018 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Mix.Tasks.Pleroma.User do use Mix.Task import Ecto.Changeset -- cgit v1.2.3 From ab9cda315f2ee7b0a2a6e505eface5d7c65d50b4 Mon Sep 17 00:00:00 2001 From: spctrl Date: Sat, 29 Dec 2018 12:43:54 +0100 Subject: Change 'name' to 'instance_name' so option is used when running non-interactive --- lib/mix/tasks/pleroma/instance.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/mix/tasks') diff --git a/lib/mix/tasks/pleroma/instance.ex b/lib/mix/tasks/pleroma/instance.ex index 1ef40671c..0a2c891c0 100644 --- a/lib/mix/tasks/pleroma/instance.ex +++ b/lib/mix/tasks/pleroma/instance.ex @@ -75,7 +75,7 @@ defmodule Mix.Tasks.Pleroma.Instance do name = Common.get_option( options, - :name, + :instance_name, "What is the name of your instance? (e.g. Pleroma/Soykaf)" ) -- cgit v1.2.3 From 4aa977d3b3ad731465f83f2d382fe9d856995e90 Mon Sep 17 00:00:00 2001 From: spctrl Date: Fri, 4 Jan 2019 22:11:46 +0100 Subject: fix 486: Add option --assume-yes to allow it to work non-interactive --- lib/mix/tasks/pleroma/user.ex | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lib/mix/tasks') diff --git a/lib/mix/tasks/pleroma/user.ex b/lib/mix/tasks/pleroma/user.ex index 217a52fdd..c311d48e0 100644 --- a/lib/mix/tasks/pleroma/user.ex +++ b/lib/mix/tasks/pleroma/user.ex @@ -22,6 +22,7 @@ defmodule Mix.Tasks.Pleroma.User do - `--password PASSWORD` - the user's password - `--moderator`/`--no-moderator` - whether the user is a moderator - `--admin`/`--no-admin` - whether the user is an admin + - `-y`, `--assume-yes`/`--no-assume-yes` - whether to assume yes to all questions ## Generate an invite link. @@ -61,7 +62,11 @@ defmodule Mix.Tasks.Pleroma.User do bio: :string, password: :string, moderator: :boolean, - admin: :boolean + admin: :boolean, + assume_yes: :boolean + ], + aliases: [ + y: :assume_yes ] ) @@ -79,6 +84,7 @@ defmodule Mix.Tasks.Pleroma.User do moderator? = Keyword.get(options, :moderator, false) admin? = Keyword.get(options, :admin, false) + assume_yes? = Keyword.get(options, :assume_yes, false) Mix.shell().info(""" A user will be created with the following information: @@ -93,7 +99,7 @@ defmodule Mix.Tasks.Pleroma.User do - admin: #{if(admin?, do: "true", else: "false")} """) - proceed? = Mix.shell().yes?("Continue?") + proceed? = assume_yes? or Mix.shell().yes?("Continue?") unless not proceed? do Common.start_pleroma() -- cgit v1.2.3