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.

25 lines
572 B

  1. # frozen_string_literal: true
  2. module Settings
  3. module TwoFactorAuthentication
  4. class RecoveryCodesController < ApplicationController
  5. layout 'admin'
  6. before_action :authenticate_user!
  7. before_action :set_body_classes
  8. def create
  9. @recovery_codes = current_user.generate_otp_backup_codes!
  10. current_user.save!
  11. flash[:notice] = I18n.t('two_factor_authentication.recovery_codes_regenerated')
  12. render :index
  13. end
  14. private
  15. def set_body_classes
  16. @body_classes = 'admin'
  17. end
  18. end
  19. end
  20. end