29 lines
565 B
Ruby
29 lines
565 B
Ruby
|
class SuperAdminsController < ApplicationController
|
||
|
before_action :authenticate_super_admin!
|
||
|
|
||
|
def edit_otp
|
||
|
end
|
||
|
|
||
|
def enable_otp
|
||
|
current_super_admin.enable_otp!
|
||
|
@qrcode = generate_qr_code
|
||
|
sign_out :super_admin
|
||
|
end
|
||
|
|
||
|
protected
|
||
|
|
||
|
def authenticate_super_admin!
|
||
|
if !super_admin_signed_in?
|
||
|
redirect_to root_path
|
||
|
end
|
||
|
end
|
||
|
|
||
|
private
|
||
|
|
||
|
def generate_qr_code
|
||
|
issuer = 'DSManager'
|
||
|
label = "#{issuer}:#{current_super_admin.email}"
|
||
|
RQRCode::QRCode.new(current_super_admin.otp_provisioning_uri(label, issuer: issuer))
|
||
|
end
|
||
|
end
|