Merge pull request #6259 from pfaffman/patch-2

FIX: disable_2fa fix method selection
This commit is contained in:
Guo Xiang Tan 2018-08-21 17:29:42 +08:00 committed by GitHub
commit 0f07494b12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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