1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-19 13:19:39 +02:00
Maybe/app/helpers/mfa_helper.rb
Josh Pigford 972c850d27
Some checks are pending
Publish Docker image / ci (push) Waiting to run
Publish Docker image / Build docker image (push) Blocked by required conditions
MFA qr code fix
2025-02-06 15:26:50 -06:00

20 lines
546 B
Ruby

module MfaHelper
def generate_mfa_qr_code(provisioning_uri)
qr_code = RQRCode::QRCode.new(provisioning_uri).as_svg(
color: "141414",
module_size: 4,
standalone: true,
use_path: true,
svg_attributes: {
width: "240",
height: "240",
viewBox: "0 0 65 65"
}
)
# Whitelist specific SVG attributes and elements that we know are safe
sanitize qr_code,
tags: %w[svg g path rect],
attributes: %w[viewBox height width fill stroke stroke-width d x y class]
end
end