Fix deleting 2FA and regenerating codes not working

This commit is contained in:
Andreas Nedbal 2022-09-04 17:15:38 +02:00 committed by Andreas Nedbal
parent 8d1e32e0f3
commit a7e17a07cc
4 changed files with 5 additions and 5 deletions

View File

@ -36,7 +36,7 @@ class Settings::TwoFactorAuthentication::OtpAuthenticationController < Applicati
current_user.save! current_user.save!
current_user.totp_recovery_codes.delete_all current_user.totp_recovery_codes.delete_all
flash[:success] = t(".success") flash[:success] = t(".success")
redirect_to settings_two_factor_authentication_otp_authentication_path redirect_to settings_two_factor_authentication_otp_authentication_path, status: :see_other
end end
def reset def reset

View File

@ -1,6 +1,6 @@
%p= t(".body") %p= t(".body")
%p= t(".recovery_code_count", count: recovery_code_count) %p= t(".recovery_code_count", count: recovery_code_count)
= button_to t(".remove.action"), settings_two_factor_authentication_otp_authentication_path, class: "btn btn-danger", method: "delete", = link_to t(".remove.action"), settings_two_factor_authentication_otp_authentication_path, class: "btn btn-danger",
data: { confirm: t(".remove.confirm") } data: { turbo_confirm: t(".remove.confirm"), turbo_method: :delete }
= button_to t(".regenerate.action"), settings_two_factor_authentication_otp_authentication_reset_path, class: "btn btn-primary", method: "delete", = link_to t(".regenerate.action"), settings_two_factor_authentication_otp_authentication_reset_path, class: "btn btn-primary",
data: { confirm: t(".regenerate.confirm") } data: { turbo_confirm: t(".regenerate.confirm"), turbo_method: :delete }