This repository has been archived on 2024-07-31. You can view files and clone it, but cannot push or open issues or pull requests.
2017-04-21 22:23:17 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Settings
|
|
|
|
module TwoFactorAuthentication
|
|
|
|
class RecoveryCodesController < ApplicationController
|
|
|
|
layout 'admin'
|
|
|
|
|
|
|
|
before_action :authenticate_user!
|
2018-10-24 18:10:01 -04:00
|
|
|
before_action :set_body_classes
|
2017-04-21 22:23:17 -04:00
|
|
|
|
|
|
|
def create
|
|
|
|
@recovery_codes = current_user.generate_otp_backup_codes!
|
|
|
|
current_user.save!
|
|
|
|
flash[:notice] = I18n.t('two_factor_authentication.recovery_codes_regenerated')
|
|
|
|
render :index
|
|
|
|
end
|
2018-10-24 18:10:01 -04:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def set_body_classes
|
|
|
|
@body_classes = 'admin'
|
|
|
|
end
|
2017-04-21 22:23:17 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|