clear security keys in disable_2fa rake task (#20586)

This commit is contained in:
Jay Pfaffman 2023-03-09 14:38:59 -06:00 committed by GitHub
parent f6063c684b
commit 4350a903ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -155,6 +155,7 @@ task "users:disable_2fa", [:username] => [:environment] do |_, args|
username = args[:username]
user = find_user(username)
UserSecondFactor.where(user_id: user.id, method: UserSecondFactor.methods[:totp]).each(&:destroy!)
UserSecurityKey.where(user_id: user.id).destroy_all
puts "2FA disabled for #{username}"
end