Clean up after TOTP is disabled.

This commit is contained in:
Dominik Kwiatek 2020-11-01 18:31:20 +01:00
parent 5dd920eba2
commit 5eb4f32660
1 changed files with 1 additions and 0 deletions

View File

@ -203,6 +203,7 @@ class UserController < ApplicationController
def destroy_2fa
current_user.otp_module = :disabled
current_user.save!
TotpRecoveryCode.where(user_id: resource.id).delete_all
flash[:success] = 'Two factor authentication has been disabled for your account.'
redirect_to edit_user_security_path
end