Module: OtpCredentialsHelper
- Defined in:
- lib/generators/authentication/templates/helpers/otp_credentials_helper.rb
Overview
Helper for one-time-password authentication methods
Automatically generated by the orthodox gem (https://github.com/bodacious/orthodox)
Instance Method Summary collapse
- #qrcode(otp_credential) ⇒ Object private
-
#svg_url_for_otp_credential(otp_credential) ⇒ Object
SVG code for a given OtpCredential.
Instance Method Details
#qrcode(otp_credential) ⇒ Object (private)
29 30 31 |
# File 'lib/generators/authentication/templates/helpers/otp_credentials_helper.rb', line 29 def qrcode(otp_credential) RQRCode::QRCode.new(otp_credential.url) end |
#svg_url_for_otp_credential(otp_credential) ⇒ Object
SVG code for a given OtpCredential. Use this to add a QR code to a page
16 17 18 19 20 21 22 23 24 25 |
# 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 |