From e89677b110ef3b8998061339edc3ca66fa6c8a2b Mon Sep 17 00:00:00 2001 From: "KMY (Yuki Asuka)" Date: Wed, 24 Sep 2025 00:56:59 +0000 Subject: [PATCH] =?UTF-8?q?Add:=20E=E3=83=A1=E3=83=BC=E3=83=AB=E3=83=BB?= =?UTF-8?q?=E3=83=A6=E3=83=BC=E3=82=B6=E3=83=BC=E5=90=8D=E3=81=8B=E3=82=89?= =?UTF-8?q?=E3=82=A2=E3=82=AB=E3=82=A6=E3=83=B3=E3=83=88=E3=82=92=E6=A4=9C?= =?UTF-8?q?=E7=B4=A2=E3=81=99=E3=82=8Btootctl=E3=82=B3=E3=83=9E=E3=83=B3?= =?UTF-8?q?=E3=83=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/mastodon/cli/accounts.rb | 37 ++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/lib/mastodon/cli/accounts.rb b/lib/mastodon/cli/accounts.rb index 1b33f56055a901..4cbbb3dffeae64 100644 --- a/lib/mastodon/cli/accounts.rb +++ b/lib/mastodon/cli/accounts.rb @@ -42,6 +42,43 @@ def rotate(username = nil) end end + desc 'lookup_by_email', 'Lookup account username by email' + long_desc <<-LONG_DESC + Find account username by email for check the email is used in this server. + LONG_DESC + def lookup_by_email(email) + user = User.find_by(email: email) + account = user&.account + + if account.present? + say('Found', :green) + say("email : #{email}") + say("username : #{account.username}") + else + say('Not found', :red) + end + end + + desc 'lookup_by_username', 'Lookup account email by username' + long_desc <<-LONG_DESC + Find account username by email for login this server. + If you forgot password, use 'accounts modify username --reset-password'. + + NOTE: username is NOT indexed in PostgreSQL. This command affects the performance. + LONG_DESC + def lookup_by_username(username) + account = Account.find_by(username: username, domain: nil) + user = account&.user + + if user.present? + say('Found', :green) + say("username : #{username}") + say("email : #{user.email}") + else + say('Not found', :red) + end + end + option :email, required: true option :confirmed, type: :boolean option :role