Method: Munificent::Admin::OTPController#setup

Defined in:
app/controllers/munificent/admin/otp_controller.rb

#setupObject



16
17
18
19
20
21
# File 'app/controllers/munificent/admin/otp_controller.rb', line 16

def setup
  session[:otp_secret] = ROTP::Base32.random
  totp = ROTP::TOTP.new(session[:otp_secret], issuer: ENV.fetch("OTP_ISSUER", nil))
  @otp_url = totp.provisioning_uri(current_user.email_address)
  @qr_code = RQRCode::QRCode.new(@otp_url).as_svg(standalone: false, module_size: 5)
end