module OtpCredentialsHelper

Helper for one-time-password authentication methods

Automatically generated by the orthodox gem (github.com/katanacode/orthodox) © Copyright 2019 Katana Code Ltd. All Rights Reserved.

Public Instance Methods

svg_url_for_otp_credential(otp_credential) click to toggle source

SVG code for a given OtpCredential. Use this to add a QR code to a page

otp_credential - An OtpCredential to show the SVG for.

Retuns String of valid HTML

# File lib/generators/authentication/templates/helpers/otp_credentials_helper.rb, line 16
def svg_url_for_otp_credential(otp_credential)
  qrcode = qrcode(otp_credential)
  qrcode.as_svg({
    offset: 0,
    color: '000',
    shape_rendering: 'crispEdges',
    module_size: 3,
    standalone: true      
  }).html_safe
end

Private Instance Methods

qrcode(otp_credential) click to toggle source
# File lib/generators/authentication/templates/helpers/otp_credentials_helper.rb, line 29
def qrcode(otp_credential)
  RQRCode::QRCode.new(otp_credential.url)
end