From 6df3006831a388a6517e6058efa9d90ec096fd78 Mon Sep 17 00:00:00 2001 From: MszPro Date: Tue, 9 Apr 2024 10:36:06 +0900 Subject: [PATCH 1/2] Also removing webauthn credentials on 2fa reset with admin cli --- lib/mastodon/cli/accounts.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/mastodon/cli/accounts.rb b/lib/mastodon/cli/accounts.rb index d3b7ebe5805..12d57a124db 100644 --- a/lib/mastodon/cli/accounts.rb +++ b/lib/mastodon/cli/accounts.rb @@ -166,6 +166,7 @@ module Mastodon::CLI user.disabled = true if options[:disable] user.approved = true if options[:approve] user.otp_required_for_login = false if options[:disable_2fa] + user.webauthn_credentials = [] if options[:disable_2fa] if user.save user.confirm if options[:confirm] From d068fd8b5ee837a3745b421c099883421709a8c8 Mon Sep 17 00:00:00 2001 From: MszPro Date: Wed, 10 Apr 2024 14:27:33 +0900 Subject: [PATCH 2/2] Using `User#disable_two_factor!` when disabling a user's two-factor via admin cli --- lib/mastodon/cli/accounts.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/mastodon/cli/accounts.rb b/lib/mastodon/cli/accounts.rb index 12d57a124db..dd80cca514d 100644 --- a/lib/mastodon/cli/accounts.rb +++ b/lib/mastodon/cli/accounts.rb @@ -165,8 +165,7 @@ module Mastodon::CLI user.disabled = false if options[:enable] user.disabled = true if options[:disable] user.approved = true if options[:approve] - user.otp_required_for_login = false if options[:disable_2fa] - user.webauthn_credentials = [] if options[:disable_2fa] + user.disable_two_factor! if options[:disable_2fa] if user.save user.confirm if options[:confirm]