mirror of
https://github.com/mastodon/mastodon.git
synced 2024-10-21 00:56:14 +00:00
26 lines
572 B
Ruby
26 lines
572 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Settings
|
|
module TwoFactorAuthentication
|
|
class RecoveryCodesController < ApplicationController
|
|
layout 'admin'
|
|
|
|
before_action :authenticate_user!
|
|
before_action :set_body_classes
|
|
|
|
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
|
|
|
|
private
|
|
|
|
def set_body_classes
|
|
@body_classes = 'admin'
|
|
end
|
|
end
|
|
end
|
|
end
|