0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

mastodonのオーナー、adminのメールアドレス、パスワードを変更する方法

0
Posted at

こんなアフォな事態になりましたので、書いてみました

まずは準備

su - mastodon
cd /home/mastodon/live

アクセストークンは保管されていたので、それでユーザー名を得る

curl -H "Authorization: Bearer アクセストークン" https://インスタンス/api/v1/accounts/verify_credentials

まぁ、Webで表記されていれば @hogehoge ってわかるはずですが、念のため再確認

コンソールを立ち上げる

RAILS_ENV=production bundle exec rails console

このコンソールが若干クセあるのですが、
コピペで一気に入れるとうまくいかないことがあります

必ず返答がありますので、タイピングして打つことをおすすめします

メールアドレスとパスワードの再設定

プライバシー保護のため、メールアドレスを参照することはできません

account = Account.find_by(username: "ユーザー名")

account.user.email = "email address"

account.user.password = "新しい安全なパスワード"

account.user.password_confirmation = "新しい安全なパスワード"

account.user.save!

メールアドレスを再設定した場合、メールで確認がありますので、クリックして認証しましょう

パスワード認証できるか確認する

account = Account.find_by(username: "ユーザー名")

account.user.valid_password?("確認したいパスワード")

true で正常、falseで異常

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?