You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
603 B

  1. # frozen_string_literal: true
  2. module Settings
  3. module TwoFactorAuthentication
  4. class RecoveryCodesController < BaseController
  5. include ChallengableConcern
  6. skip_before_action :require_functional!
  7. before_action :require_challenge!, on: :create
  8. def create
  9. @recovery_codes = current_user.generate_otp_backup_codes!
  10. current_user.save!
  11. UserMailer.two_factor_recovery_codes_changed(current_user).deliver_later!
  12. flash.now[:notice] = I18n.t('two_factor_authentication.recovery_codes_regenerated')
  13. render :index
  14. end
  15. end
  16. end
  17. end